From-scratch linear and multiple regression library for the Data Blog portfolio
Project description
Regression Library
A lightweight, from-scratch linear and multiple regression library implemented in Python with NumPy. Perfect for educational demonstration, portfolios, and quick testing of regression mechanics.
Features
- Simple Linear Regression: Supports Batch Gradient Descent with complete loss and coefficient history, and closed-form OLS estimation.
- Multiple Linear Regression: Analytical Normal Equation solver for multidimensional datasets.
- Visualization & Animation: Real-time animation of gradient descent fitting and static regression line plotting with Matplotlib.
- Dataset Loaders: Pre-packaged synthetic generators and subsets of classic real datasets (Iris and Housing).
Quick Start
Installation
Clone the repository and install dependencies:
pip install -r requirements.txt
Running the Interactive Demo
To explore interactive fits on various datasets and watch the live training animation:
python main.py
Library Usage
You can easily import and train models in your own scripts:
from data_blog import LinearRegression, x, y
# Instantiate and fit using Gradient Descent
model = LinearRegression(learning_rate=0.01, epochs=1000)
model.fit(x, y)
print(f"Intercept: {model.b_0:.4f}")
print(f"Slope: {model.b_1:.4f}")
print(f"R-squared Score: {model.score(x, y):.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 Distribution
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 data_blog_regression-0.1.1.tar.gz.
File metadata
- Download URL: data_blog_regression-0.1.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bde9dcd5ac9bbaa3a325a60030b6ce3e53909e19ca7a92125abcce69100127b1
|
|
| MD5 |
f865f660bd2d12fef136716662f8a51f
|
|
| BLAKE2b-256 |
99bd0c231dd2ebb5f9e13c56126c9d27ce83a7a261b56d1ad52b6b90cef84dab
|
File details
Details for the file data_blog_regression-0.1.1-py3-none-any.whl.
File metadata
- Download URL: data_blog_regression-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33015e13840acc6ddcce8199bb8d002e2b4118403e9410d116c090764a881eb7
|
|
| MD5 |
9fd46bbdb025038a16aed75b72def6bd
|
|
| BLAKE2b-256 |
b4882fc340019286c70f53e5866ec3094c280c11be32f80acf6de6802c85fb57
|