Numerically stable EIKG polynomial regressors
Project description
EIKGP Regressor
EIKGPolynomialRegressor is a compact two-stage regression model inspired by the elementary image of a Kolmogorov-Gabor polynomial:
- Linear latent stage:
z = b0 + b1*x1 + ... + bm*xm - Polynomial output stage:
y_hat = a0 + a1*z + a2*z^2 + ... + ad*z^d
This implementation is built for numerical stability and sklearn-style workflows.
Important warning
The model is a compressed elementary image of the Kolmogorov-Gabor polynomial and is not equivalent to direct estimation of the full multivariate polynomial basis.
Installation
From PyPI (after release):
pip install eikgp-regressor
From source (editable):
pip install -e .
With optional dependencies:
pip install -e ".[dev]"
Basic usage
import numpy as np
from eikg import EIKGPolynomialRegressor
rng = np.random.default_rng(42)
X = rng.normal(size=(200, 3))
z = 1.0 + 1.8 * X[:, 0] - 0.9 * X[:, 1]
y = z + 0.15 * z**2 + rng.normal(0, 0.1, size=200)
model = EIKGPolynomialRegressor(
degree=3,
regularization="ridge",
alpha_ridge=1e-5,
scale=True,
normalize_latent=True,
)
model.fit(X, y)
pred = model.predict(X)
print(model.score(X, y))
Pipeline example
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from eikg import EIKGPolynomialRegressor
pipe = Pipeline(
[
("scaler", StandardScaler()),
("model", EIKGPolynomialRegressor(scale=False, degree=2)),
]
)
pipe.fit(X, y)
GridSearchCV example
from sklearn.model_selection import GridSearchCV
from eikg import EIKGPolynomialRegressor
search = GridSearchCV(
EIKGPolynomialRegressor(),
param_grid={
"degree": [1, 2, 3, 4],
"regularization": ["none", "ridge"],
"alpha_ridge": [1e-8, 1e-5, 1e-3],
},
scoring="neg_mean_squared_error",
cv=5,
)
search.fit(X, y)
print(search.best_params_)
Automatic degree selection
from eikg import EIKGPolynomialRegressorCV
cv_model = EIKGPolynomialRegressorCV(
max_degree=6,
cv=5,
scoring="neg_mean_squared_error",
regularization="ridge",
alpha_ridge=1e-5,
)
cv_model.fit(X, y)
print(cv_model.selected_degree_, cv_model.best_score_)
Main limitations
- Model expressiveness is bounded by one latent linear projection.
- Very high
degreecan still be unstable without meaningful scaling/normalization. - Quality of fit depends on whether target structure is well-approximated by polynomial-in-latent form.
Development quality checks
ruff check .
mypy eikg
pytest
You can install git hooks for automatic local checks:
pre-commit install
pre-commit run --all-files
Build and publish
Build distribution artifacts:
python -m pip install -e ".[dev]"
python -m build
python -m twine check dist/*
Upload to TestPyPI:
python -m twine upload --repository testpypi dist/*
Upload to PyPI:
python -m twine upload dist/*
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
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 eikgp_regressor-0.1.1.tar.gz.
File metadata
- Download URL: eikgp_regressor-0.1.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2aff9db99341ebe28563d44e4b34887566f3a7bbf0ad37a6d78f7b5a935a36d
|
|
| MD5 |
2451c88bcd7b1b413373be9eb426c934
|
|
| BLAKE2b-256 |
7e6c0350145582f6a3cc1846f48ecd0137320e8d6144e143894315f9cc4e4ed8
|
File details
Details for the file eikgp_regressor-0.1.1-py3-none-any.whl.
File metadata
- Download URL: eikgp_regressor-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb7e37b17c4dabb7dae8741c958552f423729d8b95a82ad6ba891bdb2e0f92a
|
|
| MD5 |
5068ba649fc737d26d3d97548396fa92
|
|
| BLAKE2b-256 |
82c920b6f982746c6f7d53145b62e7abf91205aa8898ee7a536a5efd2671a6a2
|