evalkit-ml 0.1.1__tar.gz

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,500 @@
1
+ Metadata-Version: 2.4
2
+ Name: evalkit-ml
3
+ Version: 0.1.1
4
+ Summary: ML model evaluation toolkit
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy
8
+ Requires-Dist: pandas
9
+ Requires-Dist: scikit-learn
10
+ Requires-Dist: pyyaml>=6.0
11
+ Provides-Extra: test
12
+ Requires-Dist: pytest>=8.0; extra == "test"
13
+
14
+ # EvalKit
15
+
16
+ [![CI](https://img.shields.io/badge/CI-GitHub%20Actions-blue)](.github/workflows/ci.yml)
17
+ [![Python](https://img.shields.io/badge/python-3.9%2B-blue)](pyproject.toml)
18
+ [![Version](https://img.shields.io/badge/version-0.1.0-informational)](pyproject.toml)
19
+ [![License](https://img.shields.io/badge/license-not%20specified-lightgrey)](pyproject.toml)
20
+
21
+ **A lightweight, production-focused evaluation and monitoring toolkit for scikit-learn models.**
22
+
23
+ EvalKit helps you evaluate models, track performance, detect data drift, compare runs, enforce custom evaluation rules, and integrate model checks directly into CI/CD.
24
+
25
+ ```text
26
+ Train → Predict → Evaluate → Monitor → Compare → Validate → CI/CD
27
+ ```
28
+
29
+ ## Why EvalKit?
30
+
31
+ Model evaluation often ends with a few metrics printed in a notebook.
32
+
33
+ EvalKit turns that into a repeatable engineering workflow:
34
+
35
+ * 📊 **Model evaluation** — classification and regression metrics
36
+ * 🔍 **Diagnostics** — confusion matrices, class distributions, and dataset profiling
37
+ * 📈 **Performance tracking** — training and prediction latency
38
+ * 🧪 **Run history** — save and compare evaluation results
39
+ * 🔄 **Data drift detection** — numeric and categorical feature drift
40
+ * 🏷️ **Model versioning** — deterministic model configuration versions
41
+ * 🚨 **Regression detection** — detect performance degradation against previous runs
42
+ * 🧩 **Custom metrics & rules** — extend evaluation for your own requirements
43
+ * 🔌 **Monitoring hooks** — connect evaluation results to external workflows
44
+ * 🤖 **CI/CD integration** — automatically fail builds when evaluation rules fail
45
+ * 🖥️ **CLI** — run evaluations and comparisons outside Python
46
+ * 📦 **JSON reports** — save evaluation results for automation and analysis
47
+
48
+ ---
49
+
50
+ ## Installation
51
+
52
+ ### From source
53
+
54
+ ```powershell
55
+ python -m pip install -e .
56
+ ```
57
+
58
+ Once installed, the `evalkit` CLI is available:
59
+
60
+ ```powershell
61
+ evalkit --help
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Quick Start
67
+
68
+ ```python
69
+ from evalkit import track
70
+
71
+ tracker = track(model)
72
+
73
+ tracker.fit(X_train, y_train)
74
+
75
+ tracker.predict(X_test)
76
+
77
+ report = tracker.evaluate(y_test)
78
+
79
+ report.show()
80
+ ```
81
+
82
+ Save the evaluation:
83
+
84
+ ```python
85
+ report.save("current.json")
86
+ ```
87
+
88
+ A report contains information such as:
89
+
90
+ ```text
91
+ Model
92
+ Version
93
+ Metrics
94
+ Diagnostics
95
+ Dataset Profile
96
+ Performance
97
+ Drift
98
+ Timestamp
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Model Evaluation
104
+
105
+ EvalKit automatically detects whether the model is a classifier or regressor.
106
+
107
+ ### Classification
108
+
109
+ Supported metrics include:
110
+
111
+ * Accuracy
112
+ * Precision
113
+ * Recall
114
+ * F1
115
+
116
+ ### Regression
117
+
118
+ Supported metrics include:
119
+
120
+ * MAE
121
+ * MSE
122
+ * RMSE
123
+ * R²
124
+
125
+ Example:
126
+
127
+ ```python
128
+ tracker = track(model)
129
+
130
+ tracker.fit(X_train, y_train)
131
+ tracker.predict(X_test)
132
+
133
+ report = tracker.evaluate(y_test)
134
+ report.show()
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Data & Feature Monitoring
140
+
141
+ EvalKit profiles the datasets used during evaluation and can detect changes between training and evaluation data.
142
+
143
+ ### Numeric features
144
+
145
+ Uses **Population Stability Index (PSI)** to identify distribution changes.
146
+
147
+ ### Categorical features
148
+
149
+ Compares categorical distributions and reports drift using PSI.
150
+
151
+ Example report:
152
+
153
+ ```text
154
+ Data Drift:
155
+
156
+ Numeric:
157
+ age: PSI=0.0842 Status=stable
158
+ income: PSI=0.7341 Status=drifted
159
+
160
+ Categorical:
161
+ city: PSI=0.4217 Status=drifted
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Model Versioning
167
+
168
+ EvalKit automatically generates a deterministic version from the model configuration.
169
+
170
+ For example:
171
+
172
+ ```text
173
+ RandomForestClassifier
174
+ → v-caaca18c
175
+ ```
176
+
177
+ Changing the model configuration produces a different version.
178
+
179
+ This makes it possible to identify which model configuration produced an evaluation result.
180
+
181
+ ---
182
+
183
+ ## Run History & Comparison
184
+
185
+ History is explicit rather than globally shared.
186
+
187
+ ```python
188
+ tracker = track(
189
+ model,
190
+ history_file="history.json"
191
+ )
192
+ ```
193
+
194
+ This allows separate models or experiments to maintain independent histories.
195
+
196
+ Compare two reports:
197
+
198
+ ```powershell
199
+ evalkit compare `
200
+ --current current.json `
201
+ --previous previous.json
202
+ ```
203
+
204
+ Example:
205
+
206
+ ```text
207
+ ACCURACY
208
+ 0.9412 -> 0.9125
209
+ Change: -0.0287
210
+ Status: DEGRADED
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Regression Checks
216
+
217
+ EvalKit can detect whether a model's performance has degraded compared with a previous evaluation.
218
+
219
+ ```powershell
220
+ evalkit check `
221
+ --report current.json `
222
+ --previous previous.json `
223
+ --threshold accuracy=0.02 `
224
+ --threshold f1=0.02
225
+ ```
226
+
227
+ Metric direction is handled automatically.
228
+
229
+ For example:
230
+
231
+ ```text
232
+ Accuracy ↓ → degradation
233
+ RMSE ↑ → degradation
234
+ R² ↑ → improvement
235
+ ```
236
+
237
+ ---
238
+
239
+ ## CI/CD
240
+
241
+ EvalKit can act as a quality gate in CI pipelines.
242
+
243
+ ```powershell
244
+ evalkit check `
245
+ --report current.json `
246
+ --previous previous.json
247
+ ```
248
+
249
+ Exit codes:
250
+
251
+ ```text
252
+ 0 → Passed
253
+ 1 → Regression / rule failure
254
+ ```
255
+
256
+ This makes EvalKit suitable for automated CI/CD workflows.
257
+
258
+ ### GitHub Actions
259
+
260
+ A typical workflow can simply run:
261
+
262
+ ```yaml
263
+ - name: Run EvalKit checks
264
+ run: evalkit check --report current.json --previous previous.json
265
+ ```
266
+
267
+ A failed evaluation causes the CI job to fail automatically.
268
+
269
+ ---
270
+
271
+ ## Configuration
272
+
273
+ Create an `evalkit.yaml` file:
274
+
275
+ ```yaml
276
+ thresholds:
277
+ accuracy: 0.02
278
+ precision: 0.02
279
+ recall: 0.02
280
+ f1: 0.02
281
+
282
+ rules:
283
+ accuracy:
284
+ min: 0.8
285
+ ```
286
+
287
+ This keeps evaluation policy separate from application code.
288
+
289
+ ---
290
+
291
+ ## Custom Metrics
292
+
293
+ Register reusable metrics:
294
+
295
+ ```python
296
+ from evalkit import register_metric
297
+
298
+ register_metric(
299
+ "custom_score",
300
+ my_metric_function
301
+ )
302
+ ```
303
+
304
+ Or provide metrics directly:
305
+
306
+ ```python
307
+ tracker = track(
308
+ model,
309
+ metrics={
310
+ "custom_score": my_metric_function
311
+ }
312
+ )
313
+ ```
314
+
315
+ This allows EvalKit to support domain-specific evaluation without modifying the core library.
316
+
317
+ ---
318
+
319
+ ## Custom Evaluation Rules
320
+
321
+ Define rules for model quality requirements.
322
+
323
+ For example:
324
+
325
+ ```yaml
326
+ rules:
327
+ accuracy:
328
+ min: 0.8
329
+ ```
330
+
331
+ A rule failure can cause the CI check to return exit code `1`.
332
+
333
+ This lets you enforce requirements such as:
334
+
335
+ ```text
336
+ Accuracy must be ≥ 0.80
337
+ F1 must be ≥ 0.75
338
+ RMSE must be ≤ 50
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Monitoring Hooks
344
+
345
+ Evaluation results can be passed to monitoring hooks.
346
+
347
+ Hooks are isolated from model evaluation, meaning a monitoring hook failure does **not** silently break the model evaluation itself.
348
+
349
+ This makes integrations safer for production workflows.
350
+
351
+ ---
352
+
353
+ ## CLI
354
+
355
+ Available commands:
356
+
357
+ ```powershell
358
+ evalkit check --report current.json --previous previous.json
359
+
360
+ evalkit compare --current current.json --previous previous.json
361
+
362
+ evalkit history --file evalkit_history.json
363
+ ```
364
+
365
+ For automation, output formats are available:
366
+
367
+ ```powershell
368
+ evalkit check ... --output json
369
+ ```
370
+
371
+ or:
372
+
373
+ ```powershell
374
+ evalkit check ... --output github
375
+ ```
376
+
377
+ ---
378
+
379
+ ## Architecture
380
+
381
+ ```text
382
+ ┌─────────────────┐
383
+ │ scikit-learn │
384
+ │ Model │
385
+ └────────┬────────┘
386
+
387
+ track()
388
+
389
+ ┌────────▼────────┐
390
+ │ ModelTracker │
391
+ └────────┬────────┘
392
+
393
+ ┌──────────────────┼──────────────────┐
394
+ │ │ │
395
+ ▼ ▼ ▼
396
+ Evaluation Monitoring Versioning
397
+ │ │ │
398
+ ▼ ▼ ▼
399
+ Metrics Drift Model ID
400
+ Diagnostics Features
401
+ Profiling Predictions
402
+ │ │
403
+ └──────────┬───────┘
404
+
405
+ EvaluationReport
406
+
407
+ ┌──────────┼──────────┐
408
+ ▼ ▼ ▼
409
+ History Compare Rules
410
+ │ │ │
411
+ └──────────┼──────────┘
412
+
413
+ CI / CLI
414
+ ```
415
+
416
+ ---
417
+
418
+ ## Design Goals
419
+
420
+ EvalKit is designed around a few principles:
421
+
422
+ **Simple**
423
+
424
+ Wrap an existing scikit-learn model without changing your ML workflow.
425
+
426
+ **Explicit**
427
+
428
+ History and monitoring configuration should be controlled by the user rather than hidden global state.
429
+
430
+ **Extensible**
431
+
432
+ Custom metrics, rules, and monitoring hooks can be added without modifying the core evaluator.
433
+
434
+ **CI-friendly**
435
+
436
+ Evaluation results should be machine-readable and capable of failing a build when quality requirements are not met.
437
+
438
+ **Production-focused**
439
+
440
+ Evaluation should include more than a single accuracy number: performance, data quality, drift, model version, and reproducibility all matter.
441
+
442
+ ---
443
+
444
+ ## Development
445
+
446
+ Clone the repository and install it in editable mode:
447
+
448
+ ```powershell
449
+ python -m pip install -e .
450
+ ```
451
+
452
+ Run the test suite:
453
+
454
+ ```powershell
455
+ pytest
456
+ ```
457
+
458
+ Run the examples:
459
+
460
+ ```powershell
461
+ python examples/basic_classification.py
462
+
463
+ python examples/regression.py
464
+
465
+ python examples/drift.py
466
+
467
+ python examples/versioning.py
468
+ ```
469
+
470
+ ---
471
+
472
+ ## Project Status
473
+
474
+ EvalKit is currently under active development.
475
+
476
+ The core evaluation, monitoring, comparison, versioning, CLI, and CI/CD workflows are implemented and covered by automated validation.
477
+
478
+ Current validation includes:
479
+
480
+ ```text
481
+ 5 tests passed
482
+ Classification example ✓
483
+ Regression example ✓
484
+ CLI check/compare/history ✓
485
+ CI exit codes 0/1 ✓
486
+ Custom metrics ✓
487
+ Custom rules ✓
488
+ Monitoring hooks ✓
489
+ Edge cases ✓
490
+ ```
491
+
492
+ ---
493
+
494
+ ## License
495
+
496
+ Add your project license here.
497
+
498
+ ---
499
+
500
+ **EvalKit — evaluate models like production systems, not just notebooks.**