ml-reliability-toolkit 0.1.0__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.
Files changed (30) hide show
  1. ml_reliability_toolkit-0.1.0/LICENSE +21 -0
  2. ml_reliability_toolkit-0.1.0/PKG-INFO +359 -0
  3. ml_reliability_toolkit-0.1.0/README.md +344 -0
  4. ml_reliability_toolkit-0.1.0/pyproject.toml +32 -0
  5. ml_reliability_toolkit-0.1.0/src/ml_reliability/__init__.py +3 -0
  6. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/__init__.py +0 -0
  7. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/calibration.py +152 -0
  8. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/cardinality.py +155 -0
  9. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/classification_metrics.py +151 -0
  10. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/distribution_shift.py +172 -0
  11. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/duplicates.py +104 -0
  12. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/generalization_gap.py +217 -0
  13. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/missing_values.py +103 -0
  14. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/model_performance.py +187 -0
  15. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/regression_metrics.py +202 -0
  16. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/schema.py +94 -0
  17. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/slice_analysis.py +155 -0
  18. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/__init__.py +41 -0
  19. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/base.py +74 -0
  20. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/categorical.py +181 -0
  21. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/distribution.py +154 -0
  22. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/feature_dropout.py +122 -0
  23. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/missing_values.py +142 -0
  24. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/stress/noise.py +161 -0
  25. ml_reliability_toolkit-0.1.0/src/ml_reliability/checks/target_distribution.py +189 -0
  26. ml_reliability_toolkit-0.1.0/src/ml_reliability/core/__init__.py +0 -0
  27. ml_reliability_toolkit-0.1.0/src/ml_reliability/core/result.py +15 -0
  28. ml_reliability_toolkit-0.1.0/src/ml_reliability/py.typed +0 -0
  29. ml_reliability_toolkit-0.1.0/src/ml_reliability/reporting.py +642 -0
  30. ml_reliability_toolkit-0.1.0/src/ml_reliability/suite.py +611 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Meharsai26
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,359 @@
1
+ Metadata-Version: 2.4
2
+ Name: ml-reliability-toolkit
3
+ Version: 0.1.0
4
+ Summary: Pre-deployment reliability checks for machine-learning systems.
5
+ Author: Meharsai26
6
+ Author-email: Meharsai26 <meharsai514@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Dist: numpy>=2.0
10
+ Requires-Dist: pandas>=2.3.3
11
+ Requires-Dist: scikit-learn>=1.7.2 ; extra == 'demo'
12
+ Requires-Python: >=3.10
13
+ Provides-Extra: demo
14
+ Description-Content-Type: text/markdown
15
+
16
+ # ML Reliability Toolkit
17
+
18
+ A Python toolkit for assessing machine-learning reliability beyond basic accuracy. It combines data-quality validation, model diagnostics, distribution analysis, and controlled stress testing to identify potential issues before deployment.
19
+
20
+ ## Features
21
+
22
+ ### 1. Data Quality Checks
23
+ - Missing-value detection
24
+ - Duplicate-row detection
25
+ - Dataset schema validation
26
+ - Feature-cardinality and identifier detection
27
+ - Target-distribution analysis
28
+
29
+ ### 2. Model Evaluation
30
+ - Classification performance using accuracy
31
+ - Regression performance using R-squared
32
+ - Generalization-gap analysis
33
+ - Classification metrics (precision, recall, and F1-score)
34
+ - Regression metrics (MAE and RMSE)
35
+ - Classification calibration analysis
36
+ - Slice-based performance analysis
37
+ - Train/test distribution-shift analysis
38
+
39
+ ### 3. Stress Testing
40
+
41
+ Evaluate model behavior under controlled input perturbations:
42
+
43
+ | Stress test | Purpose |
44
+ |---|---|
45
+ | `missing_values` | Inject missing values into test features |
46
+ | `feature_noise` | Add noise to numerical features |
47
+ | `feature_dropout` | Mask selected feature values |
48
+ | `categorical_corruption` | Corrupt selected categorical values |
49
+ | `distribution_perturbation` | Shift and scale numerical features |
50
+
51
+ Stress tests require a compatible model, test features, test targets, and a recognized task type.
52
+
53
+ ### 4. Reporting
54
+
55
+ Reporting is available in four formats:
56
+
57
+ - Console output
58
+ - JSON
59
+ - Markdown
60
+ - HTML
61
+
62
+ JSON, Markdown, and HTML reports can be exported to files. Reports include the overall assessment, individual check results, recommendations, and stress-test outcomes.
63
+
64
+ ## Requirements
65
+
66
+ - Python 3.10 or newer
67
+ - NumPy 2.0 or newer
68
+ - pandas 2.3.3 or newer
69
+ - scikit-learn 1.7.2 or newer (required for the included demos)
70
+
71
+ ## Installation
72
+
73
+ ### Install from source
74
+
75
+ Clone the repository and navigate to the project directory.
76
+
77
+ Install the package and development dependencies:
78
+
79
+ ```bash
80
+ uv sync
81
+ ```
82
+
83
+ Install the optional dependencies required for the demos:
84
+
85
+ ```bash
86
+ uv sync --extra demo
87
+ ```
88
+
89
+ ### Install a locally built wheel
90
+
91
+ ```bash
92
+ uv pip install ./dist/ml_reliability_toolkit-0.1.0-py3-none-any.whl
93
+ ```
94
+
95
+ ### PyPI publication
96
+
97
+ The package has not yet been published to PyPI. Once published, it can be installed using:
98
+
99
+ ```bash
100
+ pip install ml-reliability-toolkit
101
+ ```
102
+
103
+ ## Basic Usage
104
+
105
+ The following example runs applicable data-quality and target-distribution checks.
106
+
107
+ ```python
108
+ import pandas as pd
109
+ from ml_reliability import ReliabilitySuite
110
+
111
+ X_train = pd.DataFrame(
112
+ {
113
+ "age": [22, 25, 30, 35, 40],
114
+ "income": [25000, 32000, 45000, 52000, 65000],
115
+ }
116
+ )
117
+
118
+ y_train = pd.Series([0, 0, 1, 1, 1])
119
+
120
+ report = ReliabilitySuite().run(
121
+ X_train=X_train,
122
+ y_train=y_train,
123
+ )
124
+
125
+ print("Reliability score:", report.score)
126
+ print("Grade:", report.grade)
127
+
128
+ for check in report.checks:
129
+ print(check.title, check.passed, check.message)
130
+ ```
131
+
132
+ Only applicable checks are executed. Model-performance checks require a model and test data.
133
+
134
+ ## Model Evaluation
135
+
136
+ The toolkit supports classification and regression workflows.
137
+
138
+ Set the task type explicitly when automatic target inference is unsuitable.
139
+
140
+ ```python
141
+ suite = ReliabilitySuite(task_type="classification")
142
+
143
+ report = suite.run(
144
+ X_train=X_train,
145
+ y_train=y_train,
146
+ X_test=X_test,
147
+ y_test=y_test,
148
+ model=trained_model,
149
+ )
150
+ ```
151
+
152
+ Supported basic performance metrics:
153
+
154
+ - Classification: Accuracy
155
+ - Regression: R-squared
156
+
157
+ Additional checks cover classification metrics, regression metrics, calibration, generalization gaps, and slice-based analysis.
158
+
159
+ A successfully calculated metric does not automatically mean the model is reliable. Review the metric values and check results.
160
+
161
+ ## Running the Demos
162
+
163
+ The project includes two executable examples demonstrating classification and regression workflows.
164
+
165
+ Install the optional demo dependency first:
166
+
167
+ ```bash
168
+ uv sync --extra demo
169
+ ```
170
+
171
+ ### Classification Demo
172
+
173
+ Uses the Breast Cancer Wisconsin dataset and a Logistic Regression model.
174
+
175
+ Run:
176
+
177
+ ```bash
178
+ uv run python demo/demo_classification.py
179
+ ```
180
+
181
+ The demo:
182
+ - Loads and splits the dataset.
183
+ - Trains a Logistic Regression pipeline.
184
+ - Runs the reliability checks.
185
+ - Executes stress tests.
186
+ - Displays individual check results and evidence.
187
+ - Generates JSON, Markdown, and HTML reports.
188
+
189
+ ### Regression Demo
190
+
191
+ Uses the California Housing dataset and a Random Forest Regressor.
192
+
193
+ Run:
194
+
195
+ ```bash
196
+ uv run python demo/demo_regression.py
197
+ ```
198
+
199
+ The demo:
200
+ - Loads and splits the dataset.
201
+ - Trains a Random Forest regression pipeline.
202
+ - Runs the reliability checks.
203
+ - Executes stress tests.
204
+ - Displays individual check results and evidence.
205
+ - Generates JSON, Markdown, and HTML reports.
206
+
207
+ **Note:** Both demos create a `demo_outputs/` directory containing their generated reports. The first execution of the regression demo may require an internet connection to download the California Housing dataset.
208
+
209
+ ## Stress Testing
210
+
211
+ Stress tests can be configured through the `stress_tests` argument.
212
+
213
+ ```python
214
+ report = suite.run(
215
+ X_train=X_train,
216
+ y_train=y_train,
217
+ X_test=X_test,
218
+ y_test=y_test,
219
+ model=trained_model,
220
+ stress_tests={
221
+ "missing_values": {
222
+ "rate": 0.1,
223
+ "random_state": 42,
224
+ },
225
+ "feature_noise": {
226
+ "noise_level": 0.1,
227
+ "random_state": 42,
228
+ },
229
+ "feature_dropout": {
230
+ "features": ["age"],
231
+ },
232
+ "categorical_corruption": {
233
+ "columns": ["city"],
234
+ "rate": 0.1,
235
+ "random_state": 42,
236
+ },
237
+ "distribution_perturbation": {
238
+ "shift": 0.2,
239
+ "scale": 1.1,
240
+ "random_state": 42,
241
+ },
242
+ },
243
+ )
244
+ ```
245
+
246
+ All five configurations are optional. Use only those relevant to your dataset and model.
247
+
248
+ Stress-test results are reported separately from the overall reliability score.
249
+
250
+ A stress test's `passed` field indicates whether its evaluation completed successfully. It does not indicate that the model met a robustness threshold.
251
+
252
+ ## Reporting and Export
253
+
254
+ ### Console
255
+
256
+ ```python
257
+ from ml_reliability.reporting import format_console_report
258
+
259
+ print(format_console_report(report))
260
+ ```
261
+
262
+ ### JSON
263
+
264
+ ```python
265
+ report.to_json("reliability_report.json")
266
+ ```
267
+
268
+ JSON output contains report details, check results, and stress-test outcomes. Non-finite numeric values are converted to `null` to produce standards-compliant JSON.
269
+
270
+ ### Markdown
271
+
272
+ ```python
273
+ report.to_markdown("reliability_report.md")
274
+ ```
275
+
276
+ ### HTML
277
+
278
+ ```python
279
+ report.to_html("reliability_report.html")
280
+ ```
281
+
282
+ HTML reports can be opened in a web browser.
283
+
284
+ ## Understanding the Reliability Score
285
+
286
+ The overall score is calculated as the arithmetic mean of valid scored checks.
287
+
288
+ A check score must be numeric, finite, non-boolean, and between 0 and 100 to contribute to the overall score.
289
+
290
+ | Grade | Score |
291
+ |---|---:|
292
+ | A | 90-100 |
293
+ | B | 75-89.99 |
294
+ | C | 60-74.99 |
295
+ | D | 40-59.99 |
296
+ | F | Below 40 |
297
+ | N/A | No valid scored checks |
298
+
299
+ Important considerations:
300
+
301
+ - Checks without a score do not contribute to the average.
302
+ - Invalid check scores are excluded and identified in the report.
303
+ - Critical failures are highlighted separately; they do not receive an additional severity-based scoring penalty.
304
+ - Stress-test outcomes are excluded from the overall score.
305
+ - Regression MAE and RMSE are calculated, but do not contribute to the overall score when no scoring thresholds are configured.
306
+ - A high score does not guarantee that a model is accurate, fair, robust, or production-ready.
307
+
308
+ The score represents the applicable checks performed with the supplied inputs, not a universal measure of model quality.
309
+
310
+ ## Known Limitations
311
+
312
+ - Cardinality detection is heuristic. High-cardinality numerical features are not necessarily identifiers.
313
+ - Distribution perturbation applies synthetic transformations and may not represent realistic production data changes.
314
+ - Stress-test outcomes depend on the selected dataset, model, perturbation settings, and random seed.
315
+ - Regression metrics require suitable thresholds to contribute to the overall reliability score.
316
+ - Reliability results should be interpreted alongside domain-specific validation and appropriate evaluation datasets.
317
+
318
+ ## Development and Testing
319
+
320
+ Run the complete test suite:
321
+
322
+ ```bash
323
+ uv run pytest -q
324
+ ```
325
+
326
+ Run Python compilation checks:
327
+
328
+ ```bash
329
+ uv run python -m compileall -q src demo
330
+ ```
331
+
332
+ ## Project Structure
333
+
334
+ ```text
335
+ ml-reliability-toolkit/
336
+ |-- demo/
337
+ | |-- demo_classification.py
338
+ | `-- demo_regression.py
339
+ |-- src/
340
+ | `-- ml_reliability/
341
+ | |-- checks/
342
+ | | `-- stress/
343
+ | |-- core/
344
+ | |-- reporting.py
345
+ | `-- suite.py
346
+ |-- tests/
347
+ |-- pyproject.toml
348
+ |-- README.md
349
+ `-- uv.lock
350
+ ```
351
+
352
+ ## Current Status
353
+
354
+ - Package: `ml-reliability-toolkit`
355
+ - Version: `0.1.0`
356
+ - Python: `>=3.10`
357
+ - Latest verified full test run: 479 tests passed.
358
+
359
+ The toolkit is intended to support pre-deployment assessment. Its results should be interpreted alongside domain-specific validation, appropriate evaluation datasets, and human review. It is not a guarantee of production reliability.
@@ -0,0 +1,344 @@
1
+ # ML Reliability Toolkit
2
+
3
+ A Python toolkit for assessing machine-learning reliability beyond basic accuracy. It combines data-quality validation, model diagnostics, distribution analysis, and controlled stress testing to identify potential issues before deployment.
4
+
5
+ ## Features
6
+
7
+ ### 1. Data Quality Checks
8
+ - Missing-value detection
9
+ - Duplicate-row detection
10
+ - Dataset schema validation
11
+ - Feature-cardinality and identifier detection
12
+ - Target-distribution analysis
13
+
14
+ ### 2. Model Evaluation
15
+ - Classification performance using accuracy
16
+ - Regression performance using R-squared
17
+ - Generalization-gap analysis
18
+ - Classification metrics (precision, recall, and F1-score)
19
+ - Regression metrics (MAE and RMSE)
20
+ - Classification calibration analysis
21
+ - Slice-based performance analysis
22
+ - Train/test distribution-shift analysis
23
+
24
+ ### 3. Stress Testing
25
+
26
+ Evaluate model behavior under controlled input perturbations:
27
+
28
+ | Stress test | Purpose |
29
+ |---|---|
30
+ | `missing_values` | Inject missing values into test features |
31
+ | `feature_noise` | Add noise to numerical features |
32
+ | `feature_dropout` | Mask selected feature values |
33
+ | `categorical_corruption` | Corrupt selected categorical values |
34
+ | `distribution_perturbation` | Shift and scale numerical features |
35
+
36
+ Stress tests require a compatible model, test features, test targets, and a recognized task type.
37
+
38
+ ### 4. Reporting
39
+
40
+ Reporting is available in four formats:
41
+
42
+ - Console output
43
+ - JSON
44
+ - Markdown
45
+ - HTML
46
+
47
+ JSON, Markdown, and HTML reports can be exported to files. Reports include the overall assessment, individual check results, recommendations, and stress-test outcomes.
48
+
49
+ ## Requirements
50
+
51
+ - Python 3.10 or newer
52
+ - NumPy 2.0 or newer
53
+ - pandas 2.3.3 or newer
54
+ - scikit-learn 1.7.2 or newer (required for the included demos)
55
+
56
+ ## Installation
57
+
58
+ ### Install from source
59
+
60
+ Clone the repository and navigate to the project directory.
61
+
62
+ Install the package and development dependencies:
63
+
64
+ ```bash
65
+ uv sync
66
+ ```
67
+
68
+ Install the optional dependencies required for the demos:
69
+
70
+ ```bash
71
+ uv sync --extra demo
72
+ ```
73
+
74
+ ### Install a locally built wheel
75
+
76
+ ```bash
77
+ uv pip install ./dist/ml_reliability_toolkit-0.1.0-py3-none-any.whl
78
+ ```
79
+
80
+ ### PyPI publication
81
+
82
+ The package has not yet been published to PyPI. Once published, it can be installed using:
83
+
84
+ ```bash
85
+ pip install ml-reliability-toolkit
86
+ ```
87
+
88
+ ## Basic Usage
89
+
90
+ The following example runs applicable data-quality and target-distribution checks.
91
+
92
+ ```python
93
+ import pandas as pd
94
+ from ml_reliability import ReliabilitySuite
95
+
96
+ X_train = pd.DataFrame(
97
+ {
98
+ "age": [22, 25, 30, 35, 40],
99
+ "income": [25000, 32000, 45000, 52000, 65000],
100
+ }
101
+ )
102
+
103
+ y_train = pd.Series([0, 0, 1, 1, 1])
104
+
105
+ report = ReliabilitySuite().run(
106
+ X_train=X_train,
107
+ y_train=y_train,
108
+ )
109
+
110
+ print("Reliability score:", report.score)
111
+ print("Grade:", report.grade)
112
+
113
+ for check in report.checks:
114
+ print(check.title, check.passed, check.message)
115
+ ```
116
+
117
+ Only applicable checks are executed. Model-performance checks require a model and test data.
118
+
119
+ ## Model Evaluation
120
+
121
+ The toolkit supports classification and regression workflows.
122
+
123
+ Set the task type explicitly when automatic target inference is unsuitable.
124
+
125
+ ```python
126
+ suite = ReliabilitySuite(task_type="classification")
127
+
128
+ report = suite.run(
129
+ X_train=X_train,
130
+ y_train=y_train,
131
+ X_test=X_test,
132
+ y_test=y_test,
133
+ model=trained_model,
134
+ )
135
+ ```
136
+
137
+ Supported basic performance metrics:
138
+
139
+ - Classification: Accuracy
140
+ - Regression: R-squared
141
+
142
+ Additional checks cover classification metrics, regression metrics, calibration, generalization gaps, and slice-based analysis.
143
+
144
+ A successfully calculated metric does not automatically mean the model is reliable. Review the metric values and check results.
145
+
146
+ ## Running the Demos
147
+
148
+ The project includes two executable examples demonstrating classification and regression workflows.
149
+
150
+ Install the optional demo dependency first:
151
+
152
+ ```bash
153
+ uv sync --extra demo
154
+ ```
155
+
156
+ ### Classification Demo
157
+
158
+ Uses the Breast Cancer Wisconsin dataset and a Logistic Regression model.
159
+
160
+ Run:
161
+
162
+ ```bash
163
+ uv run python demo/demo_classification.py
164
+ ```
165
+
166
+ The demo:
167
+ - Loads and splits the dataset.
168
+ - Trains a Logistic Regression pipeline.
169
+ - Runs the reliability checks.
170
+ - Executes stress tests.
171
+ - Displays individual check results and evidence.
172
+ - Generates JSON, Markdown, and HTML reports.
173
+
174
+ ### Regression Demo
175
+
176
+ Uses the California Housing dataset and a Random Forest Regressor.
177
+
178
+ Run:
179
+
180
+ ```bash
181
+ uv run python demo/demo_regression.py
182
+ ```
183
+
184
+ The demo:
185
+ - Loads and splits the dataset.
186
+ - Trains a Random Forest regression pipeline.
187
+ - Runs the reliability checks.
188
+ - Executes stress tests.
189
+ - Displays individual check results and evidence.
190
+ - Generates JSON, Markdown, and HTML reports.
191
+
192
+ **Note:** Both demos create a `demo_outputs/` directory containing their generated reports. The first execution of the regression demo may require an internet connection to download the California Housing dataset.
193
+
194
+ ## Stress Testing
195
+
196
+ Stress tests can be configured through the `stress_tests` argument.
197
+
198
+ ```python
199
+ report = suite.run(
200
+ X_train=X_train,
201
+ y_train=y_train,
202
+ X_test=X_test,
203
+ y_test=y_test,
204
+ model=trained_model,
205
+ stress_tests={
206
+ "missing_values": {
207
+ "rate": 0.1,
208
+ "random_state": 42,
209
+ },
210
+ "feature_noise": {
211
+ "noise_level": 0.1,
212
+ "random_state": 42,
213
+ },
214
+ "feature_dropout": {
215
+ "features": ["age"],
216
+ },
217
+ "categorical_corruption": {
218
+ "columns": ["city"],
219
+ "rate": 0.1,
220
+ "random_state": 42,
221
+ },
222
+ "distribution_perturbation": {
223
+ "shift": 0.2,
224
+ "scale": 1.1,
225
+ "random_state": 42,
226
+ },
227
+ },
228
+ )
229
+ ```
230
+
231
+ All five configurations are optional. Use only those relevant to your dataset and model.
232
+
233
+ Stress-test results are reported separately from the overall reliability score.
234
+
235
+ A stress test's `passed` field indicates whether its evaluation completed successfully. It does not indicate that the model met a robustness threshold.
236
+
237
+ ## Reporting and Export
238
+
239
+ ### Console
240
+
241
+ ```python
242
+ from ml_reliability.reporting import format_console_report
243
+
244
+ print(format_console_report(report))
245
+ ```
246
+
247
+ ### JSON
248
+
249
+ ```python
250
+ report.to_json("reliability_report.json")
251
+ ```
252
+
253
+ JSON output contains report details, check results, and stress-test outcomes. Non-finite numeric values are converted to `null` to produce standards-compliant JSON.
254
+
255
+ ### Markdown
256
+
257
+ ```python
258
+ report.to_markdown("reliability_report.md")
259
+ ```
260
+
261
+ ### HTML
262
+
263
+ ```python
264
+ report.to_html("reliability_report.html")
265
+ ```
266
+
267
+ HTML reports can be opened in a web browser.
268
+
269
+ ## Understanding the Reliability Score
270
+
271
+ The overall score is calculated as the arithmetic mean of valid scored checks.
272
+
273
+ A check score must be numeric, finite, non-boolean, and between 0 and 100 to contribute to the overall score.
274
+
275
+ | Grade | Score |
276
+ |---|---:|
277
+ | A | 90-100 |
278
+ | B | 75-89.99 |
279
+ | C | 60-74.99 |
280
+ | D | 40-59.99 |
281
+ | F | Below 40 |
282
+ | N/A | No valid scored checks |
283
+
284
+ Important considerations:
285
+
286
+ - Checks without a score do not contribute to the average.
287
+ - Invalid check scores are excluded and identified in the report.
288
+ - Critical failures are highlighted separately; they do not receive an additional severity-based scoring penalty.
289
+ - Stress-test outcomes are excluded from the overall score.
290
+ - Regression MAE and RMSE are calculated, but do not contribute to the overall score when no scoring thresholds are configured.
291
+ - A high score does not guarantee that a model is accurate, fair, robust, or production-ready.
292
+
293
+ The score represents the applicable checks performed with the supplied inputs, not a universal measure of model quality.
294
+
295
+ ## Known Limitations
296
+
297
+ - Cardinality detection is heuristic. High-cardinality numerical features are not necessarily identifiers.
298
+ - Distribution perturbation applies synthetic transformations and may not represent realistic production data changes.
299
+ - Stress-test outcomes depend on the selected dataset, model, perturbation settings, and random seed.
300
+ - Regression metrics require suitable thresholds to contribute to the overall reliability score.
301
+ - Reliability results should be interpreted alongside domain-specific validation and appropriate evaluation datasets.
302
+
303
+ ## Development and Testing
304
+
305
+ Run the complete test suite:
306
+
307
+ ```bash
308
+ uv run pytest -q
309
+ ```
310
+
311
+ Run Python compilation checks:
312
+
313
+ ```bash
314
+ uv run python -m compileall -q src demo
315
+ ```
316
+
317
+ ## Project Structure
318
+
319
+ ```text
320
+ ml-reliability-toolkit/
321
+ |-- demo/
322
+ | |-- demo_classification.py
323
+ | `-- demo_regression.py
324
+ |-- src/
325
+ | `-- ml_reliability/
326
+ | |-- checks/
327
+ | | `-- stress/
328
+ | |-- core/
329
+ | |-- reporting.py
330
+ | `-- suite.py
331
+ |-- tests/
332
+ |-- pyproject.toml
333
+ |-- README.md
334
+ `-- uv.lock
335
+ ```
336
+
337
+ ## Current Status
338
+
339
+ - Package: `ml-reliability-toolkit`
340
+ - Version: `0.1.0`
341
+ - Python: `>=3.10`
342
+ - Latest verified full test run: 479 tests passed.
343
+
344
+ The toolkit is intended to support pre-deployment assessment. Its results should be interpreted alongside domain-specific validation, appropriate evaluation datasets, and human review. It is not a guarantee of production reliability.