Skip to main content

Chebyshev polynomial feature expansion and regression for scikit-learn

Project description

poly-basis-ml

Chebyshev polynomial feature expansion and regression for scikit-learn.

PyPI version Tests

Installation

pip install poly-basis-ml

Quick start

from poly_basis_ml import ChebyshevRegressor
from sklearn.datasets import make_friedman1
from sklearn.model_selection import train_test_split

X, y = make_friedman1(n_samples=1000, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

model = ChebyshevRegressor(complexity=5, alpha=0.1)
model.fit(X_train, y_train)
print(f"R2: {model.score(X_test, y_test):.3f}")

Key features

  • ChebyshevExpander --- standalone sklearn transformer for polynomial feature expansion
  • ChebyshevRegressor --- convenience estimator wrapping Chebyshev expansion + Ridge
  • ChebyshevModelTreeRegressor --- decision tree with Chebyshev polynomial leaf models
  • Bivariate interactions --- optional product, contrast, and additive interaction features

How it works

Features are mapped to [-1, 1] via MinMaxScaler, then expanded into Chebyshev polynomial basis functions with proper intercept handling (one T0 term retained, redundant constant columns stripped). The resulting design matrix is fitted with Ridge regression. For the model tree variant, a decision tree first partitions the data into regions, then each leaf fits a separate ChebyshevRegressor for smooth local approximation.

Main classes

ChebyshevRegressor

Parameter Default Description
complexity 5 Chebyshev polynomial degree
alpha 1.0 Ridge regularisation strength
clip_input True Clip prediction-time inputs to training range
include_interactions False Add bivariate interaction features

ChebyshevModelTreeRegressor

Parameter Default Description
max_depth 3 Maximum depth of routing tree
min_samples_leaf 200 Minimum samples per leaf for polynomial fit
complexity 2 Chebyshev degree for leaf models
alpha 10.0 Ridge regularisation for leaf models

Citation

@article{gerber2026revisiting,
  title={Revisiting Chebyshev Polynomial and Anisotropic RBF Models for Tabular Regression},
  author={Gerber, Luciano and Lloyd, Chris},
  year={2026}
}

Licence

MIT

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

poly_basis_ml-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

poly_basis_ml-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: poly_basis_ml-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for poly_basis_ml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 94e10e0012b9c84ff42332baf2d58aacedb9d3726337df9c66315fc473681187
MD5 ebc2c0b99d7ed39651f0a965d32a37d0
BLAKE2b-256 8f090e09d9c2694b06ae5835db2269830e092e577a06c8b7f9dacbb396b4b3fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for poly_basis_ml-0.1.0.tar.gz:

Publisher: publish.yml on gerberl/poly-basis-ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: poly_basis_ml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for poly_basis_ml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 989dad888097c88288fc4e182f87486d9f010a5ec232c8ffc74c2b2d688303ad
MD5 b8932bc21cb0a2345f9f9ec4f10ffc9c
BLAKE2b-256 8095efa69eaf5133074ea1793b9b2a590574f3820bf913a0a8502891c0695376

See more details on using hashes here.

Provenance

The following attestation bundles were made for poly_basis_ml-0.1.0-py3-none-any.whl:

Publisher: publish.yml on gerberl/poly-basis-ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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