A beginner-friendly machine learning library that automates preprocessing, training, and evaluation.
If you find this project helpful and want to support its development, please conside sponsoring! It helps me Develope more things.
- β‘ Minimal setup β no complex configuration
- π€ Automatic pipeline (scaling, splitting, evaluation)
- π Built-in metrics for regression & classification
- π§ Designed for beginners learning ML concepts
- π§© Clean and simple API inspired by sklearn
- π Automated evaluations with
evaluate_model
- Version : 1.1.1 - 1.0.5
- Release Date: 2026-08-20
- CHANGELOG
tests/* will be changed for each functions after documantation update.
- Linear Regression (Single & Multi-feature)
- Logistic Regression (Binary & Multi-class)
- Ridge Regression (L2 Regularization)
- Lasso Regression (L1 Regularization)
- Elastic Net (L1 + L2)
- KNNRegressor (Single & Multi-feature)
- KNNClassifier (Binary & Multi-class)
- Mean Squared Error (MSE)
- Mean Absolute Error (MAE)
- Root Mean Squared Error (RMSE)
- RΒ² Score
- Accuracy (for classification)
- Euclidian Distance (for KNN)
β Supports single-output and multi-output tasks
- StandardScaler
- MinMaxScaler
-
Train-Test Split
- Supports
stratifyfor balanced sampling
- Supports
All models in rslearn are implemented using Gradient Descent.
-
Feature scaling is highly recommended for stable and faster convergence.
-
Use:
StandardScaler(recommended)- or
MinMaxScaler
-
or just use
scale=Trueparameter whilefit()
models include Inbuilt StandardScaler Feature in fit() Method:
scale=True # default- Automatically applies feature scaling internally
- Helps prevent numerical instability
rslearn-ML/
β
βββ rslearn/
β β
β βββ BaseEstimators/
β β βββ __init__.py
β β βββ _base.py
β β βββ _estimator.py
β β
β βββ Errors/
β β βββ __init__.py
β β βββ _errors.py
β β
β βββ loader/
β β βββ __init__.py
β β βββ _pipeline_loader.py
β β βββ _model_loader.py
β β
β βββ linear_model/
β β βββ __init__.py
β β βββ README.md
β β βββ _LinearRegression.py
β β βββ _LogisticRegression.py
β β βββ _regulizations.py
β β
β βββ metrics/
β β βββ __init__.py
β β βββ README.md
β β βββ _evaluations.py
β β βββ regression_readme.md
β β βββ evaluation.md
β β βββ classification_readme.md
β β βββ _classification.py
β β βββ _distances.py
β β βββ _regression.py
β β
β βββ model_selection/
β β βββ __init__.py
β β βββ README.md
β β βββ _split.py
β β
β βββ neighbors/
β β βββ __init__.py
β β βββ README.md
β β βββ _knnClass.py
β β βββ _knnReg.py
β β
β βββ Pipeline/
β β βββ __init__.py
β β βββ README.md
β β βββ _pipeline.py
β β
β βββ preprocessing/
β β βββ __init__.py
β β βββ README.md
β β βββ _scaler.py
β β
β βββ __init__.py
β
βββ README.md
π Each module contains its own detailed README with usage examples and explanations.
git clone https://github.com/rslearn-lib/rslearn-ML-py.git
cd rslearn-ML-py/pip install rslearn-pypip install -r requirements.txtimport rslearn
from rslearn.linear_model import LinearRegression
import numpy as np
print(rslearn.__version__)
print(rslearn.__github_version__)
X = np.array([10, 20, 30])
y = np.array([5, 10, 15])
model = LinearRegression()
model.fit(X, y, scale=True) # Auto Scale if True, else Gradient Stability Backend
print(model.predict([40]))-
Each folder includes its own README.md
-
Covers:
- Usage
- Parameters
- Examples
- Internal working
Good ForDevelopers&Contributors
User Guide
ItzRustam
rslearn-lib
@software{rslearnML,
author = {Rustam Bhadouriya (ItzRustam)},
publisher = {rslearn-lib}
year = {2026},
title = {rslearn-ML: A Lightweight Machine Learning Library Built from Scratch},
url = {https://github.com/ItzRustam/rslearn-ML}
}This project is licensed under the GNU GPL v3 License.