Skip to content

Commit d38af2a

Browse files
committed
Release v0.3.0
1 parent b647ff6 commit d38af2a

12 files changed

Lines changed: 740 additions & 162 deletions

README.md

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![Version: 0.2.0](https://img.shields.io/static/v1?label=Version&message=0.2.0&color=blue&?style=plastic)
1+
![Version: 0.3.0](https://img.shields.io/static/v1?label=Version&message=0.3.0&color=blue&?style=plastic)
22
![Build: Passing](https://img.shields.io/static/v1?label=Build&message=passing&color=brightgreen)
33
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=default)](http://makeapullrequest.com)
@@ -13,7 +13,7 @@
1313
pip install git+https://github.com/AdrianAntico/RetroFit.git#egg=retrofit
1414

1515
# From pypi
16-
pip install retrofit==0.2.0
16+
pip install retrofit==0.3.0
1717
```
1818

1919
<br>
@@ -159,14 +159,15 @@ Regression + Classification calibration:
159159

160160
---
161161

162-
### 📈 7. ROC / PR / PR-ROC Curves
162+
### 📈 7. ROC / PR / PR-ROC Curves and Regression versions
163163

164164
RetroFit generates:
165165

166166
- ROC
167167
- Precision-Recall
168168
- AUC and Average Precision
169-
- QuickEcharts Area plots with gradient shading
169+
- Metrics vs Threshold curves (Accuracy, F1, TPR, FPR, Utility, etc.)
170+
- Interactive QuickEcharts plots with gradient fills
170171

171172
---
172173

@@ -200,6 +201,30 @@ All plots are powered by QuickEcharts:
200201
- Works with internal or external data
201202
- Returns both table and plot object
202203

204+
---
205+
206+
### 📑 10. Model Insights Reports
207+
208+
RetroFit can generate fully self-contained HTML Model Insights Reports for both regression and classification models.
209+
210+
### Reports include:
211+
- Data summary and feature overview
212+
- Core metrics table (sortable & paginated)
213+
- Calibration tables and plots
214+
- Classification-specific diagnostics:
215+
- ROC curve
216+
- Precision–Recall curve
217+
- Metrics vs Threshold plot
218+
- Feature importance
219+
- Interaction importance (CatBoost)
220+
- Partial Dependence Plots
221+
- SHAP summary and dependence plots (tree-based models)
222+
223+
### Reports are designed to be:
224+
- Analyst-friendly
225+
- Shareable (single HTML file)
226+
- Consistent with RetroFit’s evaluation engine
227+
- Safe for production diagnostics
203228

204229
<br>
205230

@@ -277,6 +302,12 @@ model.train()
277302
# Score train, validation, and test; store internally
278303
model.score()
279304

305+
# Build regression report
306+
path = model.build_model_insights_report(
307+
output_path="regression_report.html",
308+
theme="light"
309+
)
310+
280311
# Inspect scored data
281312
model.ScoredData["train"]
282313
model.ScoredData["validation"]
@@ -445,6 +476,12 @@ model.train()
445476
# Score train, validation, and test; store internally
446477
model.score()
447478

479+
# Build classification report
480+
path = model.build_model_insights_report(
481+
output_path="classification_report.html",
482+
theme="neon",
483+
)
484+
448485
# Inspect scored data
449486
model.ScoredData["train"]
450487
model.ScoredData["validation"]
@@ -467,6 +504,14 @@ imp = model.compute_feature_importance()
467504
# Get interaction importance
468505
interact = model.compute_catboost_interaction_importance()
469506

507+
# Evaluate scored data
508+
model.plot_classification_threshold_metrics(
509+
DataName="test",
510+
CostDict=dict(tpcost=1.0, fpcost=-1.0, fncost=-1.0, tncost=1.0),
511+
plot_name=f"{os.getcwd()}/my_thresh_plot",
512+
Theme="dark"
513+
)
514+
470515
# Store plot in working directory
471516
model.plot_classification_calibration(
472517
DataName="test",
@@ -722,6 +767,12 @@ model.train()
722767
# Score train, validation, and test; store internally
723768
model.score()
724769

770+
# Build regression report
771+
path = model.build_model_insights_report(
772+
output_path="regression_report.html",
773+
theme="light"
774+
)
775+
725776
# Inspect scored data
726777
model.ScoredData["train"]
727778
model.ScoredData["validation"]
@@ -935,6 +986,12 @@ model.train()
935986
# Score train, validation, and test; store internally
936987
model.score()
937988

989+
# Build classification report
990+
path = model.build_model_insights_report(
991+
output_path="classification_report.html",
992+
theme="neon",
993+
)
994+
938995
# Inspect scored data
939996
model.ScoredData["train"]
940997
model.ScoredData["validation"]
@@ -954,6 +1011,14 @@ segment_eval = model.evaluate(
9541011
# Get variable importance
9551012
imp = model.compute_feature_importance()
9561013

1014+
# Evaluate scored data
1015+
model.plot_classification_threshold_metrics(
1016+
DataName="test",
1017+
CostDict=dict(tpcost=1.0, fpcost=-1.0, fncost=-1.0, tncost=1.0),
1018+
plot_name=f"{os.getcwd()}/my_thresh_plot",
1019+
Theme="dark"
1020+
)
1021+
9571022
# Store plot in working directory
9581023
model.plot_classification_calibration(
9591024
DataName="test",
@@ -1236,6 +1301,12 @@ model.train()
12361301
# Score train, validation, and test; store internally
12371302
model.score()
12381303

1304+
# Build regression report
1305+
path = model.build_model_insights_report(
1306+
output_path="regression_report.html",
1307+
theme="light"
1308+
)
1309+
12391310
# Inspect scored data
12401311
model.ScoredData["train"]
12411312
model.ScoredData["validation"]
@@ -1448,6 +1519,12 @@ model.train()
14481519
# Score train, validation, and test; store internally
14491520
model.score()
14501521

1522+
# Build classification report
1523+
path = model.build_model_insights_report(
1524+
output_path="classification_report.html",
1525+
theme="neon",
1526+
)
1527+
14511528
# Inspect scored data
14521529
model.ScoredData["train"]
14531530
model.ScoredData["validation"]
@@ -1467,6 +1544,14 @@ segment_eval = model.evaluate(
14671544
# Get variable importance
14681545
imp = model.compute_feature_importance()
14691546

1547+
# Evaluate scored data
1548+
model.plot_classification_threshold_metrics(
1549+
DataName="test",
1550+
CostDict=dict(tpcost=1.0, fpcost=-1.0, fncost=-1.0, tncost=1.0),
1551+
plot_name=f"{os.getcwd()}/my_thresh_plot",
1552+
Theme="dark"
1553+
)
1554+
14701555
# Store plot in working directory
14711556
model.plot_classification_calibration(
14721557
DataName="test",
@@ -1708,6 +1793,11 @@ Below is a gallery of example evaluation plots produced by RetroFit.
17081793

17091794
<img src='https://raw.githubusercontent.com/AdrianAntico/RetroFit/main/retrofit/images/Categorical_PDP.PNG' align='center' width='1000' />
17101795

1796+
<br>
1797+
<br>
1798+
1799+
<img src='https://raw.githubusercontent.com/AdrianAntico/RetroFit/main/retrofit/images/Threshold_Plot.PNG' align='center' width='1000' />
1800+
17111801

17121802
</p>
17131803
</details>
-37.3 KB
Binary file not shown.

dist/retrofit-0.2.0.tar.gz

-45.7 KB
Binary file not shown.
4.14 MB
Binary file not shown.

dist/retrofit-0.3.0.tar.gz

4.15 MB
Binary file not shown.

0 commit comments

Comments
 (0)