How many times you have heard that your residuals should be independent, normally distributed with mean zero, and with constant variance?

No matter if your answer is zero or a million times. This thread can help you

It doesn't even matter that you don't know about residuals👇

First of all: What is a residual?

It is a synonym for error. It is the difference between the expected output and the output of our model:

Y - Ym

Where Ym is the output of our model. So residuals can be positive or negative and we need them to stay close to zero
1: Independence

We don't want the error in for some input to be dependent on the error for another input

That would mean there is information about the relationship between inputs and outputs that our model is missing and that is present in the residuals2
2: Mean equals zero

Well, this is an intuitive one, isn't it?

We have said already that we need residuals close to zero. There should be both negative and positive residuals.

But we don't want a single huge positive error and then a lot of small negative ones

Let's continue
3: Normally distributed

The mean of the residuals is zero, but that's not enough

We need about 50% of the errors to be negative and the other half to be positive

Also, we need most of the errors to be close to zero

In other words, we need the errors to be normally distributed
4: Constant variance

Last but not least. We need the errors to show a constant variance. This is a property called homoscedasticity 🥵

That means our model is equally good (or bad) for all inputs

Non-constant variance denotes our model is missing relevant information
Generally, if the residuals of your model don't meet all the above requirements we should dump it

But it might depend on the problem

Note that and include a residual analysis in your machine learning pipeline starting right now!!!
And that's it!

I hope you have enjoyed this thread and you have learned something new

I have been kind of inactive these days but I publish content like this one from time to time

So, if you like ML, AI, algorithms, and Comp-Sci in general, consider following

Stay tuned!

More from All

You May Also Like

हिमालय पर्वत की एक बड़ी पवित्र गुफा थी।उस गुफा के निकट ही गंगा जी बहती थी।एक बार देवर्षि नारद विचरण करते हुए वहां आ पहुंचे।वह परम पवित्र गुफा नारद जी को अत्यंत सुहावनी लगी।वहां का मनोरम प्राकृतिक दृश्य,पर्वत,नदी और वन देख उनके हृदय में श्रीहरि विष्णु की भक्ति अत्यंत बलवती हो उठी।


और देवर्षि नारद वहीं बैठकर तपस्या में लीन हो गए।इन्द्र नारद की तपस्या से घबरा गए।उन्हें हमेशा की तरह अपना सिंहासन व स्वर्ग खोने का डर सताने लगा।इसलिए इन्द्र ने नारद की तपस्या भंग करने के लिए कामदेव को उनके पास भेज दिया।वहां पहुंच कामदेव ने अपनी माया से वसंतऋतु को उत्पन्न कर दिया।


पेड़ और पौधों पर रंग बिरंगे फूल खिल गए और कोयलें कूकने लगी,पक्षी चहकने लगे।शीतल,मंद,सुगंधित और सुहावनी हवा चलने लगी।रंभा आदि अप्सराएं नाचने लगीं ।किन्तु कामदेव की किसी भी माया का नारद पे कोई प्रभाव नहीं पड़ा।तब कामदेव को डर सताने लगा कि कहीं नारद क्रोध में आकर मुझे श्राप न देदें।

जैसे ही नारद ने अपनी आंखें खोली, उसी क्षण कामदेव ने उनसे क्षमा मांगी।नारद मुनि को तनिक भी क्रोध नहीं आया और उन्होने शीघ्र ही कामदेव को क्षमा कर दिया।कामदेव प्रसन्न होकर वहां से चले गए।कामदेव के चले जाने पर देवर्षि के मन में अहंकार आ गया कि मैने कामदेव को हरा दिया।

नारद फिर कैलाश जा पहुंचे और शिवजी को अपनी विजयगाथा सुनाई।शिव समझ गए कि नारद अहंकारी हो गए हैं और अगर ये बात विष्णु जी जान गए तो नारद के लिए अच्छा नहीं होगा।ये सोचकर शिवजी ने नारद को भगवन विष्णु को ये बात बताने के लीए मना किया। परंतु नारद जी को ये बात उचित नहीं लगी।
महाभारत की कहानी कौन नहीं जानता।लेकिन क्या आपको पता है कि महाभारत के ज्यादातर पात्र किसी न किसी श्राप में फंसे थे।अगर ये श्राप न होते तो कदाचित महाभारत की कहानी कुछ और होती।हिन्दु पौराणिक ग्रंथों में विभिन्न श्रापों का वर्णन मिलता है व हर श्राप के पीछे कोई कहानी अवश्य होती है।


आइए आज जानते हैं महाभारत कथा में वर्णित कुछ श्रापों के बारे में।

1) राजा पाण्डु को ऋषि किन्दम का श्राप

एकबार महाराज पाण्डु शिकार खेलने वन गए।झाडियों के पीछे कुछ हिल रहा था। मृग है सोचकर राजा ने बाण चलाया जो जाकर ऋषि किन्दम और उनकी पत्नी को लगा।वे दोनो रति-क्रीड़ा में लिप्त थे।

जब राजा ने उन्हें देखा तो बहुत दुखी हुए कि ये मुझसे क्या पाप हो गया।बहुत क्षमा याचना के बाद भी किन्दम ऋषि ने पाण्डु को श्राप दे दिया कि जब भी वो किसी स्त्री को काम भावना से स्पर्श करेंगे उसी क्षण उनकी मृत्यु हो जाएगी।पश्चाताप करने, वे सिंहासन पे अन्धे राजा धृतराष्ट्र को बैठाकर...


..स्वयं अपनी रानियों कुंती व माद्री के साथ वन चले गए।पांडवों का जन्म भी कुंती को ऋषि दुर्वासा द्वारा दिए गए मंत्र से हुआ था जिसमे किसी भी देव का स्मरण कर उस देव से कुंती,पुत्र प्राप्त कर सकती थी।एक बार माद्री पे मोहित हो जब पांडु ने उसे स्पर्श किया,उसी क्षण पांडु की मृत्यु होगयी।


2) उर्वशी का अर्जुन को श्राप

महाभारत युद्ध से पहले जब अर्जुन दिव्यास्त्र प्राप्त करने स्वर्ग गए तो वहां उर्वशी नाम की अप्सरा उन पर मोहित हो गयी। अर्जुन ने जब उन्हें अपनी माता के समान बताया तो यह सुनकर उर्वशी क्रोधित हो गयी और अर्जुन को श्राप दे डाला कि तुम नपुंसक की भांति...