Rectified L1 logistic regression with CUTLASS critical range encoding.
Project description
CUTLASS
CUTLASS (Critical-range rectified LASSO) packages the workflow developed in the project scripts into a reusable, publishable Python library. It exposes a scikit-learn inspired estimator that rectifies the input space into {-1, +1} indicators, trains an L1-penalised logistic model with an efficient coordinate-descent solver, and optionally compresses the model into a logical rule without any dependence on scikit-learn itself.
Features
- Rectifier transformer that infers critical ranges from the positive class and binarises features into {-1, +1}.
- Cross-validated L1 logistic model with warm-started coordinate descent and optional FISTA solver.
- Logical compression step mirroring the research code (top-k votes with
fixed magnitude
Kand several intercept policies). - Serialization helpers to persist rectifier limits and fitted models.
- Lightweight implementation that depends only on NumPy and pandas (matplotlib is optional for plotting diagnostics).
Installation
pip install cutlass
The plotting utilities used by the logical compression step are optional. To
enable them, install the plots extra:
pip install cutlass[plots]
Quick start
import pandas as pd
from cutlass import CutlassClassifier
# toy binary dataset
df = pd.DataFrame(
{
"feat_a": [0.1, 0.3, 0.7, 0.9],
"feat_b": [10, 13, 8, 5],
"INDC": [0, 0, 1, 1],
}
)
X = df.drop(columns=["INDC"])
y = df["INDC"]
clf = CutlassClassifier(
rectify=True,
Cs=15,
solver="cd",
cv=3,
logic_polish=True,
logic_scale=10.0,
)
clf.fit(X, y)
print(clf.predict_proba(X))
print("limits:", clf.limits_)
Vignettes
Additional step-by-step guides live under docs/vignettes/:
01_basic_rectified_workflow.md– reproduce the baseline rectified L1 fit.02_logical_polish.md– enable logic polishing and interpret diagnostics.03_batch_experiments.md– run batched experiments and export artifacts.
API highlights
cutlass.Rectifier: transformer implementing the critical-range binarisation.cutlass.CutlassLogisticCV: lower-level L1 logistic with cross-validation.cutlass.CutlassClassifier: full workflow composed of the rectifier, optional scaling, and the logistic path solver.cutlass.serialization: helpers for saving rectifier limits and fitted weights.
Refer to the docstrings for detailed parameter descriptions; they mirror the research scripts so existing experiment drivers can be migrated with minimal changes.
Development
To build the package locally:
python -m build
Run the unit tests (if any) with:
python -m pytest
License
MIT License. See LICENSE for details.
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
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 cutlass-0.1.0.tar.gz.
File metadata
- Download URL: cutlass-0.1.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ded68cbbd76e94560cb7990a4ac2bb94b18db137e0e02c187a90f30322bb744
|
|
| MD5 |
c71eeb410052bf0ddfb689e48007cb61
|
|
| BLAKE2b-256 |
f7a0d2653441400f281a7d3cb35f664a651393b1451c65f27cc4e95e88e66be4
|
File details
Details for the file cutlass-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cutlass-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff5e29a19e8386f938f5bda9ddfec13c19552e79f9e27b26224289223a958084
|
|
| MD5 |
23b8f87cb80c238456573fdd1f411913
|
|
| BLAKE2b-256 |
c9704a843e031d734122247e810fab43e35a8c9e3e6c015e6afe56f1dbc23a4d
|