A linear regression implementation using stochastic gradient descent with python.
This project is part of the #100DaysOfMLCode challenge proposed By Siraj Raval.
To visualize the jupyter notebooks content, you can use the links below.
- Hardcoded simple linear regression: linear-regression-hardcoded.ipynb.
- Hardcoded simple linear regression with gradient descent: linear-regression-GradientDescent-Hardcoded.ipynb.
I'm using pipenv for the dependencies. So for installing dependencies, you need to:
- pip install pipenv After that you only need to execute pipenv install.
If you don't want to use pipenv, you can install the dependencies manually:
- numpy: pip install numpy
- matplotlib: pip install matplotlib
- pandas: pip install pandas
- ipykernel: pip install ipykernel
- sklearn: pip install sklearn
- scipy: pip install scipy
- moviepy: pipenv install moviepy
- requests: pipenv install requests
I'm also using a video codec to render the animation into a gif file. The one i'm using is imagemagick.
If you are using pipenv:
- Go to the project directory
- Execute in a command promt (windows) or a terminal (linux): pipenv shell
- Execute: python -m ipykernel install --user --name=my-virtualenv-name
- Execute: jupyter notebook
- In the jupyter notebook web app, open the corresponding .ipynb file.
If you don't use pipenv:
- Execute: jupyter notebook
- In the jupyter notebook web app, open the corresponding .ipynb file.
Note: If you are unfamiliar with jupyter notebook, you can visit their website to learn more:
- How to install: http://jupyter.org/install.
- How to run: https://jupyter.readthedocs.io/en/latest/running.html.
- Full documentation: https://jupyter.org/documentation.
- Mohamed Ali Touir
- Github: https://github.com/touir1
- Email: [email protected]
- Twitter: @TouirMohamedAli
linear-regression-SGD is published under the MIT license.
Siraj Raval for starting the #100DaysOfMLCode challenge.