codadapt 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,566 @@
1
+ Metadata-Version: 2.4
2
+ Name: codadapt
3
+ Version: 1.0.0
4
+ Summary: Native tabular learning with adaptive coded memory and shared multi-resolution encoding
5
+ Author: Luca Lullo
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/lucalullo/codadapt
8
+ Project-URL: Repository, https://github.com/lucalullo/codadapt
9
+ Project-URL: Issues, https://github.com/lucalullo/codadapt/issues
10
+ Keywords: tabular,machine-learning,adaptive-codes,numpy
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: <3.15,>=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy>=1.24
24
+ Requires-Dist: pandas>=2.0
25
+ Requires-Dist: scikit-learn>=1.4
26
+ Requires-Dist: scipy>=1.8
27
+ Requires-Dist: threadpoolctl>=3.1
28
+ Provides-Extra: ebm
29
+ Requires-Dist: interpret-core==0.7.8; extra == "ebm"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7.4; extra == "dev"
32
+ Requires-Dist: ruff>=0.9; extra == "dev"
33
+ Requires-Dist: build>=1.2; extra == "dev"
34
+ Requires-Dist: twine>=5; extra == "dev"
35
+ Requires-Dist: nbformat>=5.9; extra == "dev"
36
+ Requires-Dist: nbclient>=0.10; extra == "dev"
37
+ Requires-Dist: ipykernel>=6.29; extra == "dev"
38
+ Provides-Extra: benchmark
39
+ Requires-Dist: psutil>=5.9; extra == "benchmark"
40
+ Dynamic: license-file
41
+
42
+ # CodAdapt
43
+
44
+ CodAdapt is a compact native tabular model family with mixed predictive competitiveness across tasks. Its native estimator uses **adaptive coded memory with shared multi-resolution encoding** for binary and multiclass classification and single-target regression, while preserving a scikit-learn-style API.
45
+
46
+ **CodAdapt 1.0.0 provides a stable native API for binary classification, Shared OVR multiclass and regression. SafeBlend and the optional EBM compiler remain experimental.** The compiler can export supported additive EBM models into compact standalone CodAdapt lookup models that no longer require the EBM teacher at inference time.
47
+
48
+ The 1.x stability contract covers the documented native API. It is intended for reproducible evaluation and practical tabular workflows; stability does not imply benchmark leadership. It does not claim universal superiority over established tree-based models.
49
+
50
+ ## Highlights
51
+
52
+ - automatic native binary/multiclass detection with shared-OVR encoding and artifacts;
53
+ - simple estimator API through `CodAdapt`, `CodAdaptClassifier`, and `CodAdaptRegressor`;
54
+ - `fit`, `predict`, `predict_proba`, `get_params`, `set_params`, cloning, pipelines, and cross-validation compatibility;
55
+ - automatic handling of numerical, string/object, categorical, boolean, nullable-boolean, and missing values in pandas DataFrames;
56
+ - dense numeric NumPy input, with optional explicit categorical column indices;
57
+ - train-only quantile buckets and categorical vocabularies;
58
+ - explicit handling of missing, rare observed, and unseen categories;
59
+ - shared finest encoding with nested coarse-to-fine integer resolutions;
60
+ - adaptive residual-memory levels with validation-based and feature-level stopping;
61
+ - compact coded interaction tables controlled by a lookup budget;
62
+ - compact serialized models are a consistently observed strength on the frozen blind panel;
63
+ - an opt-in compact native SafeBlend regression option, with independently replicated serialized compactness and mixed predictive competitiveness;
64
+ - sample weights, explicit validation sets, deterministic random states, and best-state restoration;
65
+ - pickle/joblib persistence;
66
+ - CPU-only NumPy runtime;
67
+ - Python 3.10–3.14, with separate compatibility gates for the native core and optional extras;
68
+ - optional fully native `SafeBlendRegressor` and EBM compilation in `codadapt.experimental`.
69
+
70
+ The native CodAdapt default remains the architecture selected during the 0.1 development process. No experimental strategy flag is required. The classifier detects multiclass targets automatically without changing binary defaults.
71
+
72
+ ## Installation
73
+
74
+ Use Python **3.10–3.14** in a virtual environment:
75
+
76
+ ```bash
77
+ python -m venv .venv
78
+ # Activate the environment using your platform's normal command.
79
+ python -m pip install codadapt
80
+ python -c "import codadapt; print(codadapt.__version__)"
81
+ ```
82
+
83
+ For an exact 1.0.0 environment, use `python -m pip install codadapt==1.0.0`.
84
+ You can also install a locally built `dist/codadapt-1.0.0-py3-none-any.whl`.
85
+ Retain artifact SHA256 and dependency versions. See the
86
+ [compatibility policy](https://github.com/lucalullo/codadapt/blob/main/docs/PYTHON_COMPATIBILITY.md)
87
+ and [release procedure](https://github.com/lucalullo/codadapt/blob/main/docs/RELEASING.md).
88
+
89
+ To compile an already fitted supported EBM teacher, install the optional dependency:
90
+
91
+ ```bash
92
+ python -m pip install "interpret-core==0.7.8"
93
+ ```
94
+
95
+ Native fit, validation, prediction and persistence require only CodAdapt and its
96
+ numerical dependencies. The EBM dependency is needed only for explicit compilation,
97
+ and is not retained or required by the compiled model. Native SafeBlend needs no
98
+ external learner. Kaggle/other hosted images require their own smoke test; local
99
+ Windows checks do not qualify those images.
100
+
101
+ ### Local checkout
102
+
103
+ ```bash
104
+ python -m venv .venv
105
+ python -m pip install --upgrade pip
106
+ python -m pip install -e .
107
+ ```
108
+
109
+ For development, tests, lint, and benchmark helpers:
110
+
111
+ ```bash
112
+ python -m pip install -e ".[dev,benchmark]"
113
+ python -m ruff check .
114
+ python -m ruff format --check .
115
+ python -m pytest
116
+ ```
117
+
118
+ Runtime requirements are NumPy 1.24+, pandas 2.0+, scikit-learn 1.4+, SciPy 1.8+, and threadpoolctl 3.1+. Native training requires no external ML model. `psutil` is an optional benchmark dependency; the `ebm` extra is only an explicit compiler/import tool.
119
+
120
+ ## Quick start
121
+
122
+ ### Binary classification
123
+
124
+ ```python
125
+ import pandas as pd
126
+ from codadapt import CodAdapt
127
+
128
+ X = pd.DataFrame(
129
+ {
130
+ "age": [22, 45, 31, 54, 28, 61, 38, 49],
131
+ "income": [32_000, 78_000, None, 91_000, 46_000, 105_000, 58_000, None],
132
+ "city": ["Rome", "Milan", "Rome", "Turin", None, "Milan", "Rome", "Turin"],
133
+ }
134
+ )
135
+ y = [0, 1, 0, 1, 0, 1, 0, 1]
136
+
137
+ model = CodAdapt(random_state=42, verbosity=0, early_stopping=False)
138
+ model.fit(X, y)
139
+
140
+ labels = model.predict(X)
141
+ probabilities = model.predict_proba(X)[:, 1]
142
+ ```
143
+
144
+ `early_stopping=False` is used here only because the example is extremely small. On normal datasets the default `early_stopping=True` creates a deterministic internal validation split.
145
+
146
+ ### Multiclass classification
147
+
148
+ ```python
149
+ from codadapt import CodAdaptClassifier
150
+ from sklearn.datasets import make_classification
151
+ from sklearn.model_selection import train_test_split
152
+
153
+ X, y = make_classification(
154
+ n_samples=240, n_features=6, n_informative=4, n_redundant=0, n_classes=3, random_state=42
155
+ )
156
+ X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=42)
157
+ model = CodAdaptClassifier(random_state=42, verbosity=0)
158
+ model.fit(X_train, y_train)
159
+
160
+ pred = model.predict(X_test)
161
+ proba = model.predict_proba(X_test)
162
+ ```
163
+
164
+ Multiclass targets are detected automatically; `CodAdapt` is the same classifier
165
+ alias. For K classes, `proba` has shape `(n_samples, K)` in `classes_` order.
166
+ Native sigmoid head probabilities are normalized across classes; ties select the
167
+ first class. Encoding and validation rows are shared, while fitting remains
168
+ independent per target class. See the [multiclass contract](https://github.com/lucalullo/codadapt/blob/main/docs/API.md#multiclass-shared-ovr).
169
+
170
+ ### Regression
171
+
172
+ ```python
173
+ from codadapt import CodAdaptRegressor
174
+ from sklearn.datasets import make_regression
175
+ from sklearn.model_selection import train_test_split
176
+
177
+ X, y = make_regression(n_samples=240, n_features=6, noise=1.0, random_state=42)
178
+ X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
179
+ model = CodAdaptRegressor(random_state=42, verbosity=0)
180
+ model.fit(X_train, y_train)
181
+
182
+ predictions = model.predict(X_test)
183
+ ```
184
+
185
+ ## Cross-validation
186
+
187
+ CodAdapt follows the scikit-learn estimator protocol:
188
+
189
+ ```python
190
+ import numpy as np
191
+ from codadapt import CodAdaptClassifier
192
+ from sklearn.datasets import make_classification
193
+ from sklearn.model_selection import cross_val_score
194
+
195
+ X, y = make_classification(n_samples=240, n_features=6, random_state=42)
196
+ model = CodAdaptClassifier(random_state=42, verbosity=0)
197
+ scores = cross_val_score(model, X, y, cv=5, scoring="roc_auc")
198
+
199
+ print(f"Mean ROC-AUC: {np.mean(scores):.6f}")
200
+ ```
201
+
202
+ ## Data handling
203
+
204
+ For large datasets, native estimators expose `memory_budget_mb=512`
205
+ (positive integer MiB), including external validation in the admission estimate.
206
+ See [LARGE_DATASETS.md](docs/LARGE_DATASETS.md) before increasing it. The budget
207
+ is not a total-RSS cap or an OOM guarantee.
208
+
209
+ With pandas DataFrames, supported numeric columns are treated as numerical features. String/object, `category`, boolean, and nullable-boolean columns are handled as categorical features. Missing values are handled natively.
210
+
211
+ Integer-coded categorical columns should be declared explicitly:
212
+
213
+ ```python
214
+ model = CodAdapt(
215
+ categorical_features=["postal_code"],
216
+ random_state=42,
217
+ )
218
+ ```
219
+
220
+ For dense NumPy arrays, input must be numeric. Integer column indices may be supplied through `categorical_features` when numeric codes should be interpreted as categories.
221
+
222
+ At prediction time, DataFrames must contain the same unique column names used during fitting. Column order may differ and is realigned automatically; missing or unexpected columns are rejected.
223
+
224
+ ## Validation and sample weights
225
+
226
+ Without an explicit validation set, CodAdapt creates an internal validation split when `early_stopping=True`.
227
+
228
+ For a user-controlled holdout:
229
+
230
+ ```python
231
+ from codadapt import CodAdaptRegressor
232
+ from sklearn.datasets import make_regression
233
+ from sklearn.model_selection import train_test_split
234
+
235
+ X, y = make_regression(n_samples=240, n_features=6, random_state=42)
236
+ X_train, X_valid, y_train, y_valid = train_test_split(X, y, random_state=42)
237
+ model = CodAdaptRegressor(random_state=42).fit(X_train, y_train, eval_set=(X_valid, y_valid))
238
+ ```
239
+
240
+ Preprocessing is fitted only on the effective training rows. Validation data does not determine quantile thresholds or categorical vocabularies.
241
+
242
+ Per-row non-negative sample weights are supported:
243
+
244
+ ```python
245
+ import numpy as np
246
+ from codadapt import CodAdaptRegressor
247
+ from sklearn.datasets import make_regression
248
+
249
+ X_train, y_train = make_regression(n_samples=240, n_features=6, random_state=42)
250
+ weights = np.linspace(0.5, 1.5, len(y_train))
251
+ model = CodAdaptRegressor(random_state=42).fit(X_train, y_train, sample_weight=weights)
252
+ ```
253
+
254
+ Rows with zero effective weight are removed before preprocessing and validation splitting.
255
+
256
+ ## Experimental native SafeBlend regression
257
+
258
+ `SafeBlendRegressor` is an opt-in, regression-only **native Base + Rational** diversity
259
+ blend. It uses the standard CodAdapt installation, with no external teacher or ML
260
+ model dependency. Its internal weight is frozen at 0.30; validation fallback selects
261
+ Base when the blend does not strictly improve internal validation RMSE. There is no
262
+ final refit. `CodAdaptRegressor` remains the default.
263
+
264
+ ```python
265
+ from codadapt.experimental import SafeBlendRegressor
266
+ from sklearn.datasets import make_regression
267
+ from sklearn.model_selection import train_test_split
268
+
269
+ X, y = make_regression(n_samples=240, n_features=6, random_state=42)
270
+ X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
271
+ model = SafeBlendRegressor(random_state=42, verbosity=0, n_jobs=4)
272
+ model.fit(X_train, y_train)
273
+ predictions = model.predict(X_test)
274
+ print(model.branch_, model.alpha_)
275
+ ```
276
+
277
+ The later [independent regression qualification](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md#independent-safeblend-regression-qualification)
278
+ supports SafeBlend as an experimental **compact regression specialist**. Across
279
+ **nine NEW_EXTERNAL datasets and 45 frozen group/time splits**, median RMSE was
280
+ **+4.62% worse** than the preregistered external leader (Base: **+4.65%**), with
281
+ dataset wins/ties/losses **2/0/7**. The worst dataset mean degradation was **+30.85%**
282
+ and the worst split **+116.29%**. Predictive quality leadership was not confirmed.
283
+
284
+ Serialized size was **0.129×** the leader; a deep-RAM advantage was **not demonstrated**.
285
+ Warm inference latency ratios for batches 1/32/1k/100k were
286
+ **0.765× / 0.765× / 0.684× / 0.807×**, while fit cost was **1.210×** the leader.
287
+ These are hardware- and protocol-specific measurements. Validation fallback reduces
288
+ risk but does not eliminate harmful admissions on unseen domains: **32 BLEND / 13
289
+ BASE** selections included **9 harmful admissions out of 32 BLEND** selections.
290
+
291
+ The earlier five-dataset blind result (**−0.67% RMSE**, **0.120× serialized size**)
292
+ remains historical evidence: its quality advantage **did not replicate** on the
293
+ larger independent panel; serialized compactness **did replicate**. The panels use
294
+ different leader rules and are not pooled.
295
+
296
+ Historical Round 78 local research-runtime medians were approximately **4.13× fit time**,
297
+ **1.09× serialized memory**, **1.08× deep memory** and **1.19–1.23× inference
298
+ latency** versus Base. Public schema validation adds overhead; results depend on
299
+ hardware and workload. See [the native SafeBlend contract](https://github.com/lucalullo/codadapt/blob/main/docs/SAFE_BLEND_EXPERIMENTAL.md)
300
+ for inputs, fitted diagnostics, persistence, costs and limitations.
301
+
302
+ ## Experimental EBM compilation
303
+
304
+ CodAdapt 1.0.0 retains an **experimental, opt-in** compiler for supported additive `interpret-core==0.7.8` EBM models. Install the [optional `ebm` extra](#installation) when compiling a fitted teacher; the native CodAdapt installation remains independent of interpret.
305
+
306
+ ```python
307
+ from codadapt.experimental import compile_ebm
308
+ import pandas as pd
309
+ from interpret.glassbox import ExplainableBoostingClassifier
310
+ from sklearn.datasets import make_classification
311
+ from sklearn.model_selection import train_test_split
312
+
313
+ X, y = make_classification(n_samples=240, n_features=6, random_state=42)
314
+ X = pd.DataFrame(X, columns=[f"feature_{j}" for j in range(X.shape[1])])
315
+ X_train, X_valid, y_train, y_valid = train_test_split(X, y, stratify=y, random_state=42)
316
+ X_test = X_valid
317
+ teacher = ExplainableBoostingClassifier(
318
+ interactions=0, outer_bags=2, max_rounds=100, n_jobs=1, random_state=42
319
+ )
320
+ teacher.fit(X_train, y_train)
321
+ compiled = compile_ebm(
322
+ teacher,
323
+ X_verify=X_valid,
324
+ )
325
+
326
+ predictions = compiled.predict(X_test)
327
+ probabilities = compiled.predict_proba(X_test) # binary classifiers only
328
+ ```
329
+
330
+ The compiler performs preflight checks and post-compilation fidelity verification. Unsupported models, unsupported schemas, insufficient capacity, or failed verification are rejected explicitly rather than silently approximated.
331
+
332
+ For the verified contract:
333
+
334
+ - binary additive EBM classification is supported;
335
+ - scalar additive EBM regression is supported; interactions and multiclass teachers are not;
336
+ - regression predictions and binary raw scores are preserved exactly on verification data;
337
+ - classification probabilities must match within `atol=1e-15, rtol=0`, not necessarily bitwise;
338
+ - standalone loading and inference without interpret passed 36/36 cases in the frozen local Windows environment; CodAdapt and its normal runtime dependencies remain required;
339
+ - the fitted teacher is used during compilation and is not retained in the compiled model;
340
+ - the compiler is optional and does not replace the native CodAdapt estimator.
341
+
342
+ In the frozen Windows/WSL validation panel (12 datasets × 3 splits, 36 cases per environment, one thread on the same physical host), median compiled/EBM memory ratios were **0.195× deep retained memory** and **0.236× serialized size**. These are panel measurements, not universal memory bounds.
343
+
344
+ Runtime performance is workload- and environment-dependent. **The historical single-row speed advantage did not replicate**, and a general inference-speed advantage has not been established. Independent-hardware validation remains pending. See the complete [compiler benchmark disclosure](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md#experimental-ebm-compiler--frozen-local-validation) for fidelity, memory and all measured batch sizes.
345
+
346
+ See [docs/EBM_COMPILER.md](https://github.com/lucalullo/codadapt/blob/main/docs/EBM_COMPILER.md) before deployment.
347
+
348
+ ## Main parameters
349
+
350
+ The defaults are intended to be the starting point. Advanced users can control model size and training behavior explicitly:
351
+
352
+ ```python
353
+ model = CodAdapt(
354
+ n_bins=32,
355
+ n_tables=8,
356
+ features_per_table=3,
357
+ table_size=256,
358
+ lookup_budget=24,
359
+ l2=5.0,
360
+ early_stopping=True,
361
+ random_state=42,
362
+ verbosity=0,
363
+ )
364
+ ```
365
+
366
+ Estimator constructor parameters are keyword-only. The pre-1.0 API cleanup removes
367
+ seven inactive legacy controls; existing configurations must drop those arguments.
368
+ `features_per_table` controls only the conservative memory estimate, not interaction
369
+ order. See the [API and migration guide](https://github.com/lucalullo/codadapt/blob/main/docs/API.md).
370
+
371
+ ## How CodAdapt works
372
+
373
+ At a high level:
374
+
375
+ ```text
376
+ raw tabular features
377
+ ↓
378
+ train-only shared bucket encoding
379
+ ↓
380
+ nested coarse-to-fine integer resolutions
381
+ ↓
382
+ adaptive feature and interaction allocation
383
+ ↓
384
+ compact coded-memory lookups
385
+ ↓
386
+ residual corrections across accepted levels
387
+ ↓
388
+ prediction
389
+ ```
390
+
391
+ Numeric features are discretized from train-only quantiles. Categorical features use stable integer buckets. The finest representation is computed once and mapped to coarser resolutions through cached integer maps. Each accepted level adds compact main-effect and coded interaction tables; validation stopping prevents unnecessary deeper levels.
392
+
393
+ Prediction is dominated by integer addressing, table lookups, and additions rather than tree traversal or neural-network layers.
394
+
395
+ See [docs/ALGORITHM.md](https://github.com/lucalullo/codadapt/blob/main/docs/ALGORITHM.md) for the detailed formulation.
396
+
397
+ ## Performance
398
+
399
+ The [independent regression qualification](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md#independent-safeblend-regression-qualification)
400
+ takes precedence for SafeBlend positioning: **nine NEW_EXTERNAL datasets, 45 frozen
401
+ splits, zero tuning and 270/270 SUCCESS jobs**. It confirms serialized compactness,
402
+ with weaker predictive quality than the external leader on median RMSE.
403
+
404
+ The earlier [Frozen Blind External Benchmark](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md#frozen-blind-external-benchmark)
405
+ remains the primary binary/multiclass evidence: **16 NEW_EXTERNAL primary
406
+ datasets, 72 conditions and 381 frozen jobs**, with **380 SUCCESS** and one
407
+ **MEMORY_GUARD_REJECT** coverage/system limitation. Dataset selection and the
408
+ protocol preceded metrics; there was zero tuning and all baseline presets were fixed.
409
+
410
+ | Earlier blind task / model | Datasets | Median primary-loss delta vs preregistered baseline leader |
411
+ | --- | ---: | ---: |
412
+ | Regression / CodAdaptRegressor Base | 5 | +2.41% RMSE |
413
+ | Regression / SafeBlendRegressor | 5 | −0.67% RMSE |
414
+ | Binary / CodAdaptClassifier | 6 | +9.36% logloss |
415
+ | Multiclass / CodAdaptClassifier | 5 | +22.03% logloss |
416
+
417
+ Positive loss deltas mean worse quality. The baseline leader is defined per source
418
+ by a preregistered rule across fixed HGB, LightGBM, CatBoost and XGBoost presets;
419
+ it is not always HGB. Paired condition deltas are aggregated within each source,
420
+ then by equal-source median. The earlier five-source SafeBlend quality advantage
421
+ did not replicate: the later independent panel measured **+4.62% RMSE** for SafeBlend
422
+ and **+4.65%** for Base. Its serialized ratio remained small (**0.120× → 0.129×**).
423
+ The independent verdict is **COMPACT_REGRESSION_SPECIALIST_CONFIRMED**, with the
424
+ quality-specialist gate unmet. The earlier blind library-wide verdict remains
425
+ **PRODUCT_POSITION_MIXED**; the two panels are not pooled.
426
+
427
+ Binary remains a known competitive weakness on the current blind panel; its
428
+ logloss gap is much less extreme than in the first small external pilot.
429
+ Shared OVR is technically validated, compact and robust as an API, but its
430
+ predictive competitiveness did not generalize uniformly to this blind panel.
431
+ These are single-host, hardware- and protocol-dependent results; performance
432
+ depends on domain. NEW_EXTERNAL is qualified against recoverable source history,
433
+ with incomplete early research catalogs. See the public
434
+ [methodology and limits](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md#blind-methodology-and-limits).
435
+
436
+ Earlier external pilots are secondary/historical evidence; development and
437
+ transfer panels are research evidence. They remain documented separately and
438
+ do not override the independent regression qualification or the blind
439
+ binary/multiclass panel for current product positioning.
440
+
441
+ The frozen 0.1 engineering comparison used 12 datasets and five shared splits per dataset against budget-matched LightGBM. CodAdapt did **not** win mean predictive quality on those datasets. It did, however, win median raw-input inference latency on 10/12 datasets and retained-model memory on 12/12.
442
+
443
+ With ratios defined as `LightGBM / CodAdapt`, the median fit-speed ratio was `0.887x`, the inference-speed ratio was `1.258x`, and the retained-model-memory ratio was `8.830x`.
444
+
445
+ These are local experimental measurements, not universal performance claims. Hardware, dataset, package versions, thread settings, split choice, and workload can change the result.
446
+
447
+ The experimental EBM compiler has a separate performance profile. It is intended primarily as a compact deployment path, not as a claim that compiled inference is faster for every batch size or workload.
448
+
449
+ The frozen native multiclass transfer panel (9 datasets × 3 splits) was exactly
450
+ equivalent to independent native OVR. Shared-OVR/independent ratios were about
451
+ 0.605× fit, 0.662× serialized size, 0.232× deep memory and 0.334× batch1k latency.
452
+ These are panel-specific engineering comparisons, not superiority over boosting.
453
+
454
+ The earlier leakage-audited external pilot covered **6 real datasets, 11 evaluation
455
+ units and 36 valid fits** against fixed HGB and Dummy references. Technical checks
456
+ passed while predictive results varied by task, source and metric. Its small-panel
457
+ quality estimates are retained in the [historical external qualification disclosure](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md#external-leakage-audited-product-qualification),
458
+ separately from the stronger blind evidence above.
459
+
460
+ See [BENCHMARKS.md](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md) for the public benchmark disclosure.
461
+
462
+ A lightweight sanity benchmark can be run with:
463
+
464
+ ```bash
465
+ python benchmarks/run_benchmarks.py --quick
466
+ ```
467
+
468
+ ## Persistence
469
+
470
+ Native CodAdapt models support pickle/joblib persistence in matching environments.
471
+ Cross-version, cross-Python and cross-dependency loading is not guaranteed. See
472
+ [the stability and persistence contract](https://github.com/lucalullo/codadapt/blob/main/docs/STABILITY.md).
473
+
474
+ ```python
475
+ import pickle
476
+ import numpy as np
477
+ from codadapt import CodAdaptClassifier
478
+ from sklearn.datasets import make_classification
479
+ from sklearn.pipeline import make_pipeline
480
+ from sklearn.preprocessing import StandardScaler
481
+
482
+ X, y = make_classification(n_samples=160, n_features=4, random_state=42)
483
+ model = make_pipeline(StandardScaler(), CodAdaptClassifier(random_state=42)).fit(X, y)
484
+ restored = pickle.loads(pickle.dumps(model)) # only trusted, locally created bytes
485
+ np.testing.assert_array_equal(model.predict_proba(X), restored.predict_proba(X))
486
+ ```
487
+
488
+ Compiled EBM models retain no teacher. Loading and inference without interpret were verified in the frozen local Windows environment; this is not a guarantee across every platform or future dependency version.
489
+
490
+ As with any pickle/joblib artifact, load only trusted files and prefer matching dependency versions across environments.
491
+
492
+ ## Documentation
493
+
494
+ - [Stability and persistence contract](https://github.com/lucalullo/codadapt/blob/main/docs/STABILITY.md)
495
+ - [Release qualification procedure](https://github.com/lucalullo/codadapt/blob/main/docs/RELEASING.md)
496
+ - [API reference, including native multiclass Shared OVR](https://github.com/lucalullo/codadapt/blob/main/docs/API.md)
497
+ - [Algorithm](https://github.com/lucalullo/codadapt/blob/main/docs/ALGORITHM.md)
498
+ - [Python compatibility and release gate](https://github.com/lucalullo/codadapt/blob/main/docs/PYTHON_COMPATIBILITY.md)
499
+ - [Experimental native SafeBlend](https://github.com/lucalullo/codadapt/blob/main/docs/SAFE_BLEND_EXPERIMENTAL.md)
500
+ - [Experimental EBM compiler](https://github.com/lucalullo/codadapt/blob/main/docs/EBM_COMPILER.md)
501
+ - [Research master](https://github.com/lucalullo/codadapt/blob/main/docs/research/RESEARCH_MASTER.md)
502
+ - [Research state](https://github.com/lucalullo/codadapt/blob/main/docs/research/RESEARCH_STATE.json)
503
+ - [Benchmark disclosure](https://github.com/lucalullo/codadapt/blob/main/BENCHMARKS.md)
504
+ - [Release notes](https://github.com/lucalullo/codadapt/blob/main/RELEASE_NOTES.md)
505
+ - [Changelog](https://github.com/lucalullo/codadapt/blob/main/CHANGELOG.md)
506
+ - [Contributing](https://github.com/lucalullo/codadapt/blob/main/CONTRIBUTING.md)
507
+ - [Security](https://github.com/lucalullo/codadapt/blob/main/SECURITY.md)
508
+
509
+ ## Research continuity
510
+
511
+ `docs/research/RESEARCH_MASTER.md` and `docs/research/RESEARCH_STATE.json` are tracked in the repository so future development sessions can reconstruct the experimental history, rejected directions, open questions, and next research steps without requiring the private raw experiment tree.
512
+
513
+ These files are development documentation and are intentionally excluded from the Python wheel and source distribution.
514
+
515
+ ## Limitations
516
+
517
+ - `features_per_table` affects only the memory estimate; numeric resolution is capped at 16 bins;
518
+ - single-label binary and multiclass classification;
519
+ - single-target regression only;
520
+ - no multilabel, ranking, or multi-output interface;
521
+ - dense input only; sparse matrices are unsupported;
522
+ - mixed NumPy object arrays are unsupported; use pandas DataFrames for heterogeneous data;
523
+ - raw datetime, complex, and infinite-valued features are unsupported;
524
+ - CPU only; no GPU or online/incremental training interface;
525
+ - very high categorical cardinality is capped by `max_categories`, with rare and unseen categories handled through dedicated buckets;
526
+ - early stopping reserves validation rows unless an external `eval_set` is provided;
527
+ - the EBM compiler supports only its documented additive binary/regression contract;
528
+ - compiled EBM classification probabilities are numerically equivalent within tolerance, not guaranteed bitwise-identical;
529
+ - compiled EBM runtime is workload- and environment-dependent, with no general speed advantage established or independent-hardware validation completed;
530
+ - performance and memory results are hardware- and workload-specific;
531
+ - binary classification has a +9.36% median blind logloss gap versus the preregistered baseline leader on six datasets;
532
+ - multiclass has a +22.03% median blind logloss gap on five datasets, despite successful technical qualification of Shared OVR;
533
+ - Base regression has a +2.41% median blind RMSE gap on five datasets;
534
+ - SafeBlend's later independent panel was weaker than external leaders: +4.62% median RMSE, 2/0/7 dataset wins/ties/losses, worst dataset mean +30.85% and worst split +116.29%; predictive quality varies by domain;
535
+ - validation fallback does not eliminate downside: 9 of 32 admitted blends harmed test RMSE relative to their internal Base;
536
+ - independently replicated serialized compactness (0.129× the leader) is stronger evidence than predictive quality leadership; no deep-RAM advantage was demonstrated;
537
+ - the earlier five-dataset −0.67% RMSE advantage did not replicate; neither repeated splits nor the separate historical panel enlarge the nine-source independent sample;
538
+ - Covtype-like large-N multiclass workloads remain excluded by the conservative safe-memory guard in the tested configuration; no actual out-of-memory event was measured;
539
+ - the blind benchmark's single MEMORY_GUARD_REJECT is a coverage/system limitation; successful predictions do not guarantee every large-batch measurement fits the budget;
540
+ - the blind benchmark covers only 16 datasets (5 regression, 6 binary, 5 multiclass); repeated conditions are not independent datasets, and performance depends on domain;
541
+ - this release does not claim state-of-the-art accuracy or general superiority over established tree-based models.
542
+
543
+ ## Status
544
+
545
+ CodAdapt 1.0.0 stabilizes the documented native API while preserving RC2 training,
546
+ prediction and resource-admission behavior. Native multiclass Shared OVR is included;
547
+ SafeBlend and the EBM compiler remain opt-in and experimental. Source preparation
548
+ does not perform publication or create a tag.
549
+
550
+ Current independent evidence supports SafeBlend as a **compact regression specialist**,
551
+ with strong serialized-size savings and faster inference on the tested hardware,
552
+ but weaker median predictive quality than the external leader. Classification
553
+ competitiveness remains mixed on the earlier blind panel.
554
+
555
+ The native API follows the 1.x contract described in
556
+ [STABILITY.md](https://github.com/lucalullo/codadapt/blob/main/docs/STABILITY.md).
557
+ Experimental and private components are excluded from the stable contract. See the [release notes](https://github.com/lucalullo/codadapt/blob/main/RELEASE_NOTES.md)
558
+ for migration, known limitations and persistence scope.
559
+
560
+ ## License
561
+
562
+ CodAdapt is created by Luca Lullo and released under the [MIT License](https://github.com/lucalullo/codadapt/blob/main/LICENSE).
563
+
564
+ ## Author
565
+
566
+ Created by [Luca Lullo](https://github.com/lucalullo).
@@ -0,0 +1,21 @@
1
+ codadapt/__init__.py,sha256=piZZGjwwN1zzpgi8V4LoKAGwBjm5McJR6sFbUKkk9iI,306
2
+ codadapt/_base.py,sha256=PPst84OVL6nqHk0RkEBVJDUS9SzP2rHBWREPdTH1Krk,16868
3
+ codadapt/_core.py,sha256=okoxZMyhRAIlssUrq0pY7uY5g8liS1O8o6sYAl9zWBU,3029
4
+ codadapt/_multiclass.py,sha256=TjmNaiuDq4-n4uylAQB2hyxMms5JzOBAF9sOd1oJ6sk,8860
5
+ codadapt/_multiclass_artifact.py,sha256=QJCbbauBhAhWt4Dy1fi2uOTZBOW3RJb89gCVpEwowMc,2321
6
+ codadapt/_multiclass_packing.py,sha256=1hTdLsQE4GN1yL_8qhA-GVSiPQjSc0GcqoKwtPPMV4E,5562
7
+ codadapt/_training.py,sha256=NRESGmxw4wUqeUnm-QZ-otthfMNatfzo1eBOtUf_gOc,16936
8
+ codadapt/_version.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
9
+ codadapt/classifier.py,sha256=O1qKdtcDNX8BC4LUDO-I0W2GYqtaq5KxSDEA2VTMuQA,4497
10
+ codadapt/preprocessing.py,sha256=d2ydwrAwOBV21a_wKJc7s7zVf31r3DDkpb5RsTrfXBM,19468
11
+ codadapt/regressor.py,sha256=GkoQrL1dt-myCGIOcDjN5XJxIN6CBdFVYbmuoMuoVzo,410
12
+ codadapt/experimental/__init__.py,sha256=6OIA9hh7zbq5PPA9Eofgye49mfhwusVOwS8i8zrY3TQ,385
13
+ codadapt/experimental/_compiler.py,sha256=_jVdeVTyD6avNPQOJ9Su6c2tpHT8GNDyYb4-RLv_GgM,7574
14
+ codadapt/experimental/_model.py,sha256=44xTf3hUR_wBuISi0qwnazpKhNbS8x5OwBji9qGARJ0,6974
15
+ codadapt/experimental/_rational.py,sha256=evdIJ0csKrp8KrBQjOt3ABL9UGOpXQAfMbNSrKulxp8,4979
16
+ codadapt/experimental/_safe_blend.py,sha256=sXhwIZNn7aewJHJJQehUSCPulA9Jv6RoLat0Lcz8iTA,10052
17
+ codadapt-1.0.0.dist-info/licenses/LICENSE,sha256=JjpsLwFJYqnf5cLIjQPq10yyR1J6ZjsVYtGA8nZEZ0Y,1067
18
+ codadapt-1.0.0.dist-info/METADATA,sha256=8BcMIB3TzV0zvoR722iiIwBEeBLpgfEoAcdIF8Z-Eb4,29981
19
+ codadapt-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
20
+ codadapt-1.0.0.dist-info/top_level.txt,sha256=QDEfQ-9BsDJtvgk1KvVIqnY1ZDHAqQtd2idUH16zFqc,9
21
+ codadapt-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luca Lullo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ codadapt