/linear_regression_using_GD

Linear regression using gradient descent from scratch in C with GNUplot

Primary LanguageCMIT LicenseMIT

Linear Regression using Gradient Descent in C

A from scratch implementation of Linear Regression algorithm with 2 fitting parameters. The parameters are optimised using Gradient Descent algorithm. The implementation also utilises GNUplot to plot the data and cost over epochs.

Getting Started

  • Clone the repo into your folder

    git clone https://github.com/sanjeev309/linear_regression_using_GD

  • Experiment with values of EPOCH, LEARNING_RATE and default theta values in main.cpp

  • Execute make command to compile into an executable

    make compile

  • Run the executable

    ./linear_reg

  • Clean for a rebuild

    make clean

Prerequisites

*nix OS, gcc compiler, basic C programming and curiosity.

Breakout

Gradient Descent Algorithm for LR

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • This project dates back to 3+ years when I just began with Andrew Ng's ML course in MATLAB. A lot of gratitude for him and the initiative.