Skip to content

edwinafful2004/Machine_Learning_Specialisation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Linear Regression from Scratch โ€” Python & NumPy

This project demonstrates a complete implementation of Linear Regression from scratch using only Python and NumPy.
It covers fundamental concepts of Machine Learning, including cost function computation, gradient derivation, and gradient descent optimization.


๐Ÿ“˜ Project Overview

Linear Regression is one of the simplest yet most powerful algorithms in Machine Learning.
In this project, we:

  • Implement the Cost Function:
    J(w,b) = (1 / 2m) * ฮฃ (f_wb(xแถฆ) - yแถฆ)ยฒ
  • Compute Gradients for parameters w and b: โˆ‚J/โˆ‚w = (1/m) * ฮฃ (f_wb(xแถฆ) - yแถฆ)xแถฆ
    โˆ‚J/โˆ‚b = (1/m) * ฮฃ (f_wb(xแถฆ) - yแถฆ)
  • Use Gradient Descent to update parameters iteratively: w := w - ฮฑ โˆ‚J/โˆ‚w
    b := b - ฮฑ โˆ‚J/โˆ‚b

๐Ÿงฉ Features

  • Compute cost and gradients manually
  • Implement gradient descent loop
  • Visualize training data and fitted line
  • Compare predicted vs actual values
  • Modular code structure with comments

๐Ÿงฎ Example Results

Parameter Value
Initial w 0
Initial b 0
Final w ~2.0
Final b ~0.0
Final Cost โ‰ˆ 0.0

๐Ÿš€ Technologies Used

  • Python 3
  • NumPy
  • Matplotlib
  • Jupyter Notebook

๐Ÿง  Learning Outcomes

  • Understand linear regression fundamentals
  • Derive and compute the gradient from scratch
  • Implement optimization using gradient descent
  • Strengthen Python and NumPy vectorization skills

๐Ÿ“‚ Repository Structure

linear-regression-from-scratch/
โ”‚
โ”œโ”€โ”€ Linear_Regression_From_Scratch.ipynb   # Main Jupyter Notebook
โ”œโ”€โ”€ README.md                              # Project documentation


๐Ÿง‘โ€๐Ÿ’ป Author

Edwin Kofi Afful
๐Ÿ“ Computer Science & Engineering Student
๐Ÿ’ก Passionate about AI, Quantum Computing, and Machine Learning


๐ŸŒŸ Acknowledgments

Inspired by Andrew Ngโ€™s Machine Learning Specialization and DeepLearning.AI resources.
Built as part of foundational practice for understanding gradient-based optimization.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published