Master Regression,
From First Principles.

LineSight is a transparent Python library designed to teach you how regression actually works — not just how to call it. Every model exposes its internal mechanics through plain-English explanations, real-time training animations, and over 30 diagnostic visualizations.

6 Models
30+ Visualizations
109 Tests
quickstart.py
from linesight import LinearRegression

model = LinearRegression(
    learning_rate=0.01,
    epochs=1000,
    store_history=True
)
model.fit(X, y)

# See your equation
model.show_equation()
→  ŷ = 2.01x + 0.98

# Understand the fit
model.explain_fit(X, y)
→  R² = 0.998 — explains 99.8% of variance

# Watch it learn
model.animate_training(X, y)

Tutorials

Hands-on, end-to-end walkthroughs that teach regression concepts through working code. Each tutorial runs directly in Jupyter Notebooks — zero configuration required.

Models

Six regression and classification models built on a consistent, scikit-learn-style API. Every model exposes fit(), predict(), score(), and get_training_history() — making it easy to compare algorithms side by side.

LinearRegression

Ordinary least squares via gradient descent. Directly exposes learned m (slope) and b (intercept) for full transparency.

Gradient Descent

MultipleLinearRegression

Multi-feature regression with per-feature importance ranking, Variance Inflation Factor (VIF) diagnostics, and partial regression analysis.

Gradient Descent

RidgeRegression

L2-penalized regression that prevents overfitting by shrinking coefficients toward zero. Includes visual constraint region overlays and shrinkage path plots.

Gradient Descent

LassoRegression

L1-penalized regression for automatic feature selection. Visualize sparsity paths that reveal at which regularization strength each feature is eliminated.

Coordinate Descent

ElasticNetRegression

Combines L1 and L2 penalties with a tunable mixing ratio. Visualize the trade-off between sparsity (Lasso) and stability (Ridge) in a unified framework.

Coordinate Descent

LogisticRegression

Binary classification via the sigmoid function. Renders decision boundaries, probability surfaces, ROC/AUC curves, and confusion matrices for comprehensive evaluation.

Gradient Descent

Three Transparent Layers

Every model in LineSight is decomposed into three clearly separated layers — computation, interpretation, and visualization — so you always know exactly what is happening and why.

engine/

The numerical core. Clean, readable implementations of gradient descent and coordinate descent that expose named weights and bias parameters instead of opaque theta vectors.

explain/

Natural-language interpretation layer. Automatically translates coefficients, regularization effects, and decision boundaries into human-readable explanations with contextual annotations.

visualization/

Publication-quality matplotlib visualizations and animations. Includes loss surfaces, residual diagnostics, training convergence animations, prediction intervals, and 30+ additional methods.

Get Started in Seconds

Install LineSight with a single command and begin exploring regression models immediately. No additional configuration required.

1
Install the package
pip install linesight
2
Or install for development
git clone https://github.com/AnshumanTiwari2006/linesight && cd linesight && pip install -e ".[dev]"
3
Requires
Python ≥ 3.9 NumPy ≥ 1.24 Matplotlib ≥ 3.6