Skip to main content

A simple sklearn-like ML library built from scratch

Project description

๐Ÿš€ rslearn

A beginner-friendly machine learning library that automates preprocessing, training, and evaluation.

License Python Status Contributions


NOTE

This is Python version of this library visit more.

Origination - rslearn-lib


โœจ Why rslearn?

  • โšก 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

Release & Changes

  • Version : 1.0.8 - 1.0.2
  • Release Date: 2026-06-25

Latest (In Pipeline & linear_model):

  • KNN Regression & Classification Both
  • Evaluation & auto scaling support

More Info: CHANGELOG

Download Version Specific Module

Downloads - Module

๐Ÿ“Š Linear Models

  • Linear Regression (Single & Multi-feature)
  • Logistic Regression (Binary & Multi-class)
  • Ridge Regression (L2 Regularization)
  • Lasso Regression (L1 Regularization)
  • Elastic Net (L1 + L2)

๐Ÿ“ Metrics

  • Mean Squared Error (MSE)
  • Mean Absolute Error (MAE)
  • Root Mean Squared Error (RMSE)
  • Rยฒ Score
  • Accuracy (for classification)

โœ” Supports single-output and multi-output tasks


๐Ÿ”ง Preprocessing

  • StandardScaler
  • MinMaxScaler

๐Ÿงช Model Selection

  • Train-Test Split

    • Supports stratify for balanced sampling

โš™๏ธ Optimization Details

All models in rslearn are implemented using Gradient Descent.

โš ๏ธ Important:

  • Feature scaling is highly recommended for stable and faster convergence.

  • Use:

    • StandardScaler (recommended)
    • or MinMaxScaler

๐Ÿค– Auto Standard Scaling (Linear, Logistic, Ridge, Lasso, ElasticNet)

models include Inbuilt StandardScaler Feature in fit() Method:

scale=True  # default
  • Automatically applies feature scaling internally
  • Helps prevent numerical instability

๐Ÿ“ Project Structure

rslearn/
โ”‚
โ”œโ”€โ”€ linear_model/
โ”‚   โ”œโ”€โ”€ _linear_regression.py
โ”‚   โ”œโ”€โ”€ _logistic_regression.py
โ”‚   โ”œโ”€โ”€ _ridge.py
โ”‚   โ”œโ”€โ”€ _lasso.py
โ”‚   โ”œโ”€โ”€ _elastic_net.py
โ”‚
โ”œโ”€โ”€ preprocessing/
โ”‚   โ”œโ”€โ”€ _scaler.py
โ”‚
โ”œโ”€โ”€ metrics/
โ”‚   โ”œโ”€โ”€ _regression.py
โ”‚
โ”œโ”€โ”€ model_selection/
โ”‚   โ”œโ”€โ”€ _split.py
โ”‚
โ””โ”€โ”€ README.md

๐Ÿ“Œ Each module contains its own detailed README with usage examples and explanations.


๐Ÿ› ๏ธ Installation

Clone the repository

git clone https://github.com/rslearn-lib/rslearn-ML-py.git
cd rslearn-ML-py/

Install Usable Library (Stable - Latest)

pip install rslearn-py

Download Version Specific Module

Downloads Older Library

Install dependencies

pip install -r requirements.txt

๐Ÿ“Œ Quick Example

from rslearn.linear_model import LinearRegression
from rslearn.preprocessing import StandardScaler
import numpy as np

X = np.array([10, 20, 30])
y = np.array([5, 10, 15])

scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)

model = LinearRegression()
model.fit(X_scaled, y)

print(model.predict([40]))

๐Ÿ“š Documentation

  • Each folder includes its own README.md

  • Covers:

    • Usage
    • Parameters
    • Examples
    • Internal working

๐ŸŽฏ Goals of this Project

  • Understand ML algorithms from scratch
  • Build a sklearn-like API
  • Create reusable and modular ML components
  • Learn real-world ML system design
  • Check Self Ability

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

ItzRustam

๐Ÿ”จ Origination

rslearn-lib


๐Ÿ“œ License

This project is licensed under the GNU GPL v3 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rslearn_py-1.0.3.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rslearn_py-1.0.3-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file rslearn_py-1.0.3.tar.gz.

File metadata

  • Download URL: rslearn_py-1.0.3.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for rslearn_py-1.0.3.tar.gz
Algorithm Hash digest
SHA256 819f691274b23494e48bf9934828f3d298639936f15416f3e358469d5e1502b5
MD5 09b4792496c4e2e86339936f68d54e79
BLAKE2b-256 8314416d1f498b74314aec167215c95f7d3394c4fe03de64a2537b0c5fa186f3

See more details on using hashes here.

File details

Details for the file rslearn_py-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: rslearn_py-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for rslearn_py-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 877f369ccdfab3a11207a19bd413345bc2d9e33eedde32f8ee270277d7256d19
MD5 fee1b4f25db951fc4347cbf9b7a5e889
BLAKE2b-256 51eb1cbac323bfbc74baf40e2143186940ed460a5bab5b6837155fa17acf9e61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page