Skip to main content

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


Download files

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

Source Distribution

data_blog_regression-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

data_blog_regression-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file data_blog_regression-0.1.0.tar.gz.

File metadata

  • Download URL: data_blog_regression-0.1.0.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

Hashes for data_blog_regression-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a017513058f758dfbb3f91befee3d4ef54b5c504ce81dffd6cada55a030d96e
MD5 f55121bd1732980e8e3f27d7640d9c05
BLAKE2b-256 0d040ebe0d436da6199d38d3792484d3cd61be4acaa7c48d6772453d41e7fde5

See more details on using hashes here.

File details

Details for the file data_blog_regression-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: data_blog_regression-0.1.0-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

Hashes for data_blog_regression-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92f8505e2fc95df1d9441b1bbd0079d62d5bd5d3c6d71009097624ef5a75ebf8
MD5 9656d58e67ac2fd9f29917989f7799be
BLAKE2b-256 ae88bed4e756a27bdb74e77f5c8c4b8b06b3192b3ca0834ca1aa516391bc6afd

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