Linear Regression using the Gradient Descent algorithm, NumPy, SymPy, and Matplotlib
Gradient Descent is an algorithm that finds the local extrema of a function. This is applicable to machine learning, because we want to find the optimal parameters that minimize our loss function. In machine learning, loss functions quantify the amount of error between the predicted values from a machine learning model and the actual expected values. In this notebook, we will perform linear regression by using gradient descent to find the optimal slope and y-intercept.
Gradient Descent Algorithm Formula
Linear Regression Formula
Loss Function
jupyter notebook
Build the JupyterLab Docker image and start it
docker build -t gradient-descent .
docker run --rm -p 8888:8888 -v "$(pwd)":/home/jovyan/work gradient-descent
Open JupyterLab at the following URL: http://127.0.0.1:8888/lab
Start the Docker image
docker compose up --build -d
Open JupyterLab at the following URL: http://127.0.0.1:8888/lab
Clean up the Docker container
docker compose down --volumes --rmi local