Skip to main content

Better Regressions

Advanced regression methods with an sklearn-like interface.

Current Features

  • Linear:
    • Configurable regularization: Ridge with given alpha / BayesianRidge / ARD
    • "Better bias" option to properly regularize the intercept term
  • AdaptiveLinear: Ridge regression with automatic shrinkage of features (like ARDRegression, but works in a different way and works better with correlated features)
  • Scaler:
    • Configurable preprocessing: Standard scaling (by second moment) / Quantile transformation with uniform/normal output / Power transformation
    • AutoScaler to automatically select the best scaling method based on validation split
  • Smooth: Boosting-based regression using smooth functions for features
    • SuperSmoother: Adaptive-span smoother for arbitrary complex functions.
    • Angle: Bagging of piecewise-linear functions, it's less flexible but because of that it's more robust to overfitting.
  • Soft: Mixture of regressors based on quantile classification
  • Stabilize: Robust scaling & clipping transformation for features/targets
  • AutoClassifier: Classification with automatic model selection (LogisticRegression or XGBoost, with auto depth selection)
  • BinnedRegression: Bins features and target, then trains a classifier. This way it can learn non-linear relationships and it also models the target distribution (not only its mean).
  • EDA: Exploratory Data Analysis utilities
    • plot_distribution: Visualize sample distributions with fitted t-distribution parameters
    • plot_trend: Automatically detect and visualize relationships between variables + Pearson/Spearman correlation
      • For discrete features: Shows violin plots with distribution at each value
      • For continuous features: Fits trend lines with variance estimation and confidence intervals

Installation

pip install better-regressions

Basic Usage

from better_regressions import auto_angle, auto_linear, Linear, Scaler, AutoClassifier
from better_regressions.eda import plot_distribution, plot_trend
from sklearn.datasets import make_regression, make_moons
import numpy as np

X, y = make_regression(n_samples=100, n_features=5, noise=0.1)
model = auto_angle(n_breakpoints=2)
model.fit(X, y)
y_pred = model.predict(X)
print(repr(model))

# Classification example
dataset = make_moons(n_samples=200, noise=0.3)
Xc, yc = dataset
clf = AutoClassifier(depth="auto")
clf.fit(Xc, yc)
yc_pred = clf.predict(Xc)

# EDA example
plot_distribution(y, name="Target Distribution")
plot_trend(X[:, 0], y, name="Feature 0 vs Target")

Building new verison

  1. Update __version__ in better_regressions/__init__.py and pyproject.toml
  2. python -m build
  3. python -m twine upload dist/*

Metadata

Release files for better-regressions 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for better-regressions 0.9.0
File Size Uploaded Provenance Actions
better_regressions-0.9.0.tar.gz 374.9 kB Without provenance Details for better_regressions-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for better-regressions 0.9.0
File Interpreter ABI Platform Actions
better_regressions-0.9.0-py3-none-any.whl Python 3 none any Details for better_regressions-0.9.0-py3-none-any.whl

Total release size: 408.8 kB

Release files / better_regressions-0.9.0.tar.gz

Download URL better_regressions-0.9.0.tar.gz
Size 374.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bb5b5a9078b0d6726f732af3f5f006e46acd32587442ad79914719f06bcb2ca5
BLAKE2b-256 checksum
How to use checksums
d3fcdd2ed2c729c85b8bb969e5324bb3b73f5c26ee8d437916893c56e9b4b867
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / better_regressions-0.9.0-py3-none-any.whl

Download URL better_regressions-0.9.0-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3787cb5f72e36e77064e57702bf824da933ae8a5806c2eca2044b495709940a
BLAKE2b-256 checksum
How to use checksums
8dc239fb370c1b6808b685429a8f8d7143a233c15f9085b224d518150d969232
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Security for better-regressions 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page