Metadata-Version: 2.4
Name: eikgp-regressor
Version: 0.1.1
Summary: Numerically stable EIKG polynomial regressors
Author: EIKG Contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/your-org/eikgp-regressor
Project-URL: Repository, https://github.com/your-org/eikgp-regressor
Project-URL: Issues, https://github.com/your-org/eikgp-regressor/issues
Keywords: regression,machine-learning,scikit-learn,numerical-analysis
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Provides-Extra: pandas
Requires-Dist: pandas>=1.5; extra == "pandas"
Provides-Extra: scipy
Requires-Dist: scipy>=1.10; extra == "scipy"
Provides-Extra: sklearn
Requires-Dist: scikit-learn>=1.3; extra == "sklearn"
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pandas>=1.5; extra == "dev"
Requires-Dist: scikit-learn>=1.3; extra == "dev"
Requires-Dist: scipy>=1.10; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pre-commit>=3.7; extra == "dev"
Dynamic: license-file

# EIKGP Regressor

`EIKGPolynomialRegressor` is a compact two-stage regression model inspired by the elementary image of a Kolmogorov-Gabor polynomial:

1. Linear latent stage:
   `z = b0 + b1*x1 + ... + bm*xm`
2. 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):

```bash
pip install eikgp-regressor
```

From source (editable):

```bash
pip install -e .
```

With optional dependencies:

```bash
pip install -e ".[dev]"
```

## Basic usage

```python
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

```python
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

```python
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

```python
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 `degree` can 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

```bash
ruff check .
mypy eikg
pytest
```

You can install git hooks for automatic local checks:

```bash
pre-commit install
pre-commit run --all-files
```

## Build and publish

Build distribution artifacts:

```bash
python -m pip install -e ".[dev]"
python -m build
python -m twine check dist/*
```

Upload to TestPyPI:

```bash
python -m twine upload --repository testpypi dist/*
```

Upload to PyPI:

```bash
python -m twine upload dist/*
```

