A custom implementation of core Machine Learning algorithms built entirely in Java without external ML libraries.
To deconstruct the "black box" of libraries like Scikit-learn and understand the mathematical foundations of algorithms by engineering them from the ground up.
- Linear Regression: Using Gradient Descent optimization.
- K-Nearest Neighbors (KNN): Custom distance metric calculations.
- Logistic Regression: Sigmoid activation and cost function minimization.
- (Add whatever else we worked on: Decision Trees, K-Means, etc.)
- Language: Java (OOP principles)
- Math: Linear Algebra & Calculus logic implemented raw.
- Tools: Maven/Gradle (if you used them), JUnit for testing.
Building this from scratch taught me the "magic" behind libraries like Scikit-Learn:
- Math to Code: How to translate mathematical formulas (like Gradient Descent and Euclidean Distance) into efficient Java code.
- OOP Design: structuring a clean architecture where different models (KNN, Linear Regression) share a common interface.
- Data Handling: Writing manual logic to normalize and split data without relying on Pandas.
Ways I plan to make this engine better:
- Add More Algorithms: Implement Logistic Regression and a simple Neural Network.
- CSV Support: Build a parser to read real datasets from
.csvfiles automatically. - Optimization: Improve matrix multiplication performance for larger datasets.
This project is built with standard Java (no external ML dependencies).
Option 1: Using Eclipse (Recommended)
- Clone this repo:
git clone https://github.com/YOUR-USERNAME/YOUR-REPO.git - Open Eclipse and go to
File > Open Projects from File System. - Select the project folder.
- Navigate to
src/ml/app/Main.java. - Right-click and select Run As > Java Application.
Option 2: Terminal
cd src
javac ml/app/Main.java
java ml.app.Main