In this project, I break down the basic idea of Linear Regression with One Variable without using Scikit-Learn, just simple to understand how the Simple Linear Regression works in the background.
-
Python: Version 3.10
-
NumPy: Version 1.23.0
-
Pandas:: Version 1.4.4
-
Matplotlib: Version 3.5.3
-
Spyder IDE: Version 5.3.2
-
I implemented here an algorithm from scratch to find the best fit line of a list of point[x,y]. I have applied 2 different datasets I found online, I draw the graphs of each one of them 2 graphs for each, on for the dataset with the fit line. and the second for the epochs and error, so you can understand how the error work and when it is not recommended to increase the iterations (as it will be waste of resources). So, as you see in the errors graphs almost the slope is Zero (There is no change in values).
-
When you change your dataset and change the number of iterations and alpha value you might find the output as NaN or an Overflow Error. To solve this, multiply the dataset by 0.01 for example (This depends on the dataset), but this may solve the problem.
-
For all the equation I used, why it is like this? How could you derive them also? Please check the References.
Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Do not forget to give the project a star! Thanks again!
Distributed under the MIT License. See LICENSE.txt
for more information.
-
This is important Article, as it illustrates how to deal the partial dervatives.
-
I recommend this article because it shows you an Example using Python
- Via Email : Mahmoud.Nady@Ejust.edu.eg
- Via FaceBook.