This repository contains Linear Regression implementation from scratch.
This implementation contains training with batch and mini-batch gradient descent. To reproduce the results random_state parameter can be used.
Implemented methods of regularization:
- L1 (Lasso),
- L2 (Ridge),
- ElasticNet,
Custom learning rate (float or callable per epoch) can be set during model initialization.
Implemented and supported metrics:
- MSE,
- RMSE,
- MAE,
- MAPE,
- R² score,
Verbose training output can be set for every n epochs.
To install all required dependencies, execute the following command:
pip install requirements.txt
To start main script, execute the following command:
python main.py
The notebook notebooks/kaggle_example.ipynb demonstrates how to use the implemented from scratch Linear Regression on a real-world dataset.
- First, you need to download dataset from Kaggle: House Pricing Prediction.
- Create data/ directory in the root of the project, rename the downloaded file to "housing.csv" and put there.
- Go to notebooks/ directory and run housing.ipynb notebook.