Machine Learning From Scratch with NumPy Welcome to Machine Learning From Scratch, a comprehensive repository where I implement core machine learning algorithms and concepts directly from first principles using pure Python and NumPy. This project focuses on understanding and building ML foundations from the ground up, without relying on high-level ML libraries.
๐ About This repo is dedicated to demystifying machine learning through hands-on implementation of essential algorithms using only:
Mathematical formulas
NumPy for numerical computations
Python for clear, straightforward code
You'll find implementations for:
Supervised learning algorithms (Linear Regression, Logistic Regression, Decision Trees, etc.)
Classification metrics (Precision, Recall, F1 Score, Accuracy)
Regression metrics (MSE, RMSE, Rยฒ Score)
Other important utilities and helper functions
With this project, I aim to provide learners and enthusiasts a solid understanding of how ML algorithms really work under the hood.
๐ป Features Detailed, math-backed implementations of ML algorithms
Metrics like Precision, Recall, F1 Score implemented from scratch
Error and performance metrics such as MSE, RMSE, Accuracy, and Rยฒ Score
Clear, commented code for easy learning and customization
No dependencies except NumPy โ no scikit-learn or TensorFlow used
๐ Topics Covered Data preprocessing and handling
Regression models: Linear Regression and evaluation
Classification models: Logistic Regression and evaluation metrics
Performance metrics: Precision, Recall, Accuracy, F1 Score, MSE, RMSE, Rยฒ
Understanding the math behind these algorithms and metrics
๐ง Installation Clone the repository:
bash git clone https://github.com/your-username/ml-from-scratch.git cd ml-from-scratch Install NumPy if you donโt have it already:
bash pip install numpy Run scripts directly with Python.
๐ Usage Import the functions or classes and use them in your projects or experiments. Example for using the precision function:
python import numpy as np from precision import precision
y_true = np.array([1, 0, 1, 1, 0]) y_pred = np.array([1, 0, 0, 1, 0])
print("Precision:", precision(y_true, y_pred)) ๐ References Detailed explanations of metrics and algorithms are in the code comments aligned with fundamental mathematical formulas.
Inspired by standard textbooks and courses on machine learning and statistical learning theory.
๐ Contributions Contributions, suggestions, and improvements are welcome! Feel free to open issues or pull requests.
๐ License This project is licensed under the MIT License โ see the LICENSE file for details.
Thank you for visiting! Happy learning and coding! ๐
Would you like me to customize this README further based on specific algorithms or files you have in your repo?