Advanced regression methods with sklearn-like interface
Project description
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
- Configurable regularization: Ridge with given
AdaptiveLinear: Ridge regression with automatic shrinkage of features (likeARDRegression, 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
AutoScalerto automatically select the best scaling method based on validation split
Smooth: Boosting-based regression using smooth functions for featuresSuperSmoother: 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 classificationStabilize: Robust scaling & clipping transformation for features/targetsAutoClassifier: 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 utilitiesplot_distribution: Visualize sample distributions with fitted t-distribution parametersplot_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")
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
better_regressions-0.7.0.tar.gz
(364.5 kB
view details)
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 better_regressions-0.7.0.tar.gz.
File metadata
- Download URL: better_regressions-0.7.0.tar.gz
- Upload date:
- Size: 364.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b4a772c5c035a89e306906df4ab493c948f97acba58187928213672fa8ff22e
|
|
| MD5 |
daf1d44bcc18beb86ad634d65f954890
|
|
| BLAKE2b-256 |
2562b84bcaeabb7cfd042ab9f2556808bd4b8e42f349803aef379c0496ad84bc
|
File details
Details for the file better_regressions-0.7.0-py3-none-any.whl.
File metadata
- Download URL: better_regressions-0.7.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
499133870168e004153559b0a930c2c77ec8c15e7d55c1449d1b5c77e4304f69
|
|
| MD5 |
5f9e6117710a90e7c9d2e15ede848192
|
|
| BLAKE2b-256 |
40d67d3eccc6cdebf4902b12ce61af68f413d714945ba6d0946e14cd4f18feef
|