Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

100 Days of Machine Learning: Day 6

Linear Regression with Gradient Descent in Python


This repository contains an implementation of gradient descent for linear regression using Python. The purpose of this project is to demonstrate how gradient descent can be used to optimize a simple linear regression model.


This project requires the following Python libraries:


You can install the required libraries using the following command:

pip install numpy
pip install matplotlib


The notebook file contains the implementation of the gradient descent algorithm for a simple linear regression problem. You can modify the code to experiment with different datasets or tweak the parameters of the algorithm.


1. Introduction

Simple linear regression is a fundamental machine learning technique used to predict the relationship between two continuous variables. It aims to find the best-fit line that minimizes the error between predicted values and actual values.

Gradient descent is an optimization algorithm that helps find the optimal values for the model parameters by minimizing the cost function. In this tutorial, we will implement gradient descent for a simple linear regression problem using Python.

2. Prerequisites

  • Basic understanding of Python programming
  • Familiarity with NumPy and Matplotlib libraries

3. Dataset

We will use a small synthetic dataset (x = [1, 2, 3, 4, 5], y = [3, 4, 5, 6, 7]) to demonstrate the implementation of gradient descent for simple linear regression. Feel free to replace it with your dataset.