Educational regression models built from scratch in Python
Project description
LinearRegression From Scratch
A minimal, easy-to-understand implementation of Linear Regression in Python using only NumPy.
Designed for educational purposes to show how gradient descent optimizes linear models step by step.
🚀 Features
- Fits simple linear models with gradient descent
- Clean OOP class structure
- Pure NumPy implementation (no scikit-learn)
- Supports multi-feature data
- Easy to extend for regularization
- Printed training loss progress
- Simple
fit,predict, andevaluateinterface
📦 How to wrok?
from predictive_models import LinearRegression
toy dataset
X_train = np.array([[1], [2], [3], [4], [5]]) y_train = np.array([2, 4, 6, 8, 10])
initialize model
model = LinearRegression(learning_rate=0.01, epochs=1000)
train
model.fit(X_train, y_train)
predict
predictions = model.predict(X_train)
evaluate
mse, r2 = model.evaluate(X_train, y_train)
print("Predictions:", predictions) print(f"MSE: {mse:.4f}, R2: {r2:.4f}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file MLPredictiveModels-0.5-py3-none-any.whl.
File metadata
- Download URL: MLPredictiveModels-0.5-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bde435d4fae91284ae8c6b3af6097ec46f4d067b560c1714637ea50403eeba8
|
|
| MD5 |
94acc7747aaa670eae7821af55f84f7b
|
|
| BLAKE2b-256 |
509854b9c7071bdb9bdeefee73b50b6768f4623d718eec5d695a37a62b3a4571
|