Skip to content

๐Ÿง  Machine Learning Models from Scratch-- Educational project showcasing core Machine Learning algorithms โ€” Linear Regression, Logistic Regression, and K-Means โ€” implemented from scratch using Python and NumPy. Includes math explanations, visualizations, and comparisons with scikit-learn for clear model understanding.

License

Notifications You must be signed in to change notification settings

mfebykhoirusidqi/Machine-Learning-Models-from-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Machine learning from scratch Image Nov 3, 2025, 09_54_46 AM # Machine-Learning-Models-from-Scratch ๐Ÿง  Machine Learning Models from Scratch --- This repository demonstrates the mathematical intuition and implementation of essential machine learning algorithms built entirely from scratch using Python and NumPy. The goal is to bridge the gap between theoretical understanding and practical model development โ€” showing how core ML algorithms truly work behind the scenes. โœจ By studying and experimenting with this repository, you will gain a solid intuition about how modern AI models build upon these foundational algorithms โ€” transforming raw mathematics into intelligent systems.

๐Ÿš€ Project Overview

This project aims to rebuild key ML algorithms without using scikit-learn โ€” focusing on how they work mathematically and programmatically.
Each model is explained step-by-step through theory, code, and visualization.

Implemented Models

  • ๐Ÿ“ˆ Linear Regression โ€” Predicting continuous values using gradient descent.
  • ๐Ÿ” Logistic Regression โ€” Binary classification using sigmoid and cost function.
  • ๐ŸŽฏ K-Means Clustering โ€” Unsupervised grouping based on Euclidean distance.

๐Ÿ“˜ Notebook Explanation

The notebook explanation.ipynb includes:

  • Mathematical formulation and derivation.
  • Visual representation of training process.
  • Python implementation from scratch.
  • Comparison with scikit-learn results

Demo Result Linier Regression

Demo

โ–ถ๏ธ Usage

Run any model directly:

  • python src/linear_regression.py
  • python src/logistic_regression.py
  • python src/kmeans.py

Or open the interactive notebook: jupyter notebook explanation.ipynb

๐Ÿ“Š Key Insights

  1. Linear Regression shows clear trends fitting with gradient convergence.

  2. Logistic Regression demonstrates classification boundaries with sigmoid activation.

  3. K-Means visualizes centroid movement and cluster assignment.

๐Ÿงฎ Mathematical Foundation

This project covers:

  1. Gradient Descent Optimization

  2. Sigmoid Function and Binary Cross-Entropy

  3. Euclidean Distance and Centroid Updates

  4. Regression Metrics: MSE, RMSE, Rยฒ Score

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

Muhammad Feby Khoiru Sidqi

Data Angineer | Python Developer | AI Enthusiast | Education Research

โ€ข ๐Ÿ“ง Email:[email protected] โ€ข ๐ŸŒ LinkedIn : mfebykhoirusidqi โ€ข ๐Ÿ GitHub : https://github.com/mfebykhoirusidqi/Machine-Learning-Models-from-Scratch

โญ Contribute & Support

If you like this project, please โญ star this repository and share it with others. Contributions, ideas, and suggestions are always welcome!

About

๐Ÿง  Machine Learning Models from Scratch-- Educational project showcasing core Machine Learning algorithms โ€” Linear Regression, Logistic Regression, and K-Means โ€” implemented from scratch using Python and NumPy. Includes math explanations, visualizations, and comparisons with scikit-learn for clear model understanding.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published