Skip to content

Commit bac4f8a

Browse files
committed
Adding changelog and new model tuner updates
1 parent 29e4fce commit bac4f8a

21 files changed

+333
-43
lines changed

docs/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 741cf928a5633c3cf9847fb60a28953a
3+
config: 467fdae465f986bb3ac9ad8fa5e0cd8e
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/.buildinfo.bak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 86681157926dfda84249a46ada0c9ab6
3+
config: 741cf928a5633c3cf9847fb60a28953a
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/_sources/changelog.rst.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,60 @@ Changelog
2525
.. important::
2626
Complete version release history available `here <https://pypi.org/project/model-tuner/#history>`_
2727

28+
Version 0.0.26b (Beta)
29+
-----------------------
30+
31+
- Optimal threshold: Users can now specify target precision or recall and an optimal
32+
threshold is computed for that
33+
- Finalised testing: coverage is now at 86% total
34+
- New get_feature_names() helper function for extracting features
35+
- n_estimators calculation for boosting algorithms is now fixed
36+
37+
Version 0.0.25a
38+
----------------
39+
40+
- Pushed fixes for the get_feature_selection_pipeline method.
41+
- Updated scoring blocks for calibrated KFold models and folded confusion matrix metrics.
42+
- Added unittests for edge cases, including test_rfe_calibrate_model() and validating confusion matrix alignment.
43+
- Fixed mismatches between confusion matrix and classification report.
44+
- Provided fixes for all pipeline getter methods.
45+
- Integrated verify_imb_sampler prints into KFold logic.
46+
- Resolved typos in group split configurations and refined nested KFold bug fixes.
47+
- Adjusted fold metric calculations in report_model_metrics.
48+
- Moved optimal threshold logic into prediction functionality.
49+
- Enhanced return metrics dictionary logic to handle all cases and added multilabel classification tests.
50+
- Addressed Brier score calculation issues and optimized regression reports for KFold.
51+
- Introduced threshold print updates for clearer reporting.
52+
- Implemented SHAP scripts and tests for model explainability.
53+
- Removed outdated calibration reports from documentation and codebase.
54+
- Fixed bugs in regression metric calculations and refined KFold metric aggregation.
55+
56+
57+
Version 0.0.24a
58+
-----------------
59+
60+
- Updated .gitignore to incl. doctrees
61+
- Added pickleObjects tests and updated reqs, tests passed
62+
- Added boostrapper test and tests passed
63+
- Adding multi class test script
64+
- Updated Metrics Output
65+
- Added optl' threshold print inside return_metrics
66+
- KFold metric printing
67+
- Augmented predict_proba test, and train_val_test_split
68+
- Fixed pipeline_steps arg in model definition
69+
- Refactored metrics_df in report_model_metrics for aesthetics
70+
- Unit Tests
71+
- Made return_dict optional in return_metrics
72+
- Added openpyxl versions for all python versions in requirements.txt
73+
- Refactor metrics, foldwise metrics and foldwise con_mat, class_labels
74+
- Cleaned notebooks dir
75+
- Added model_tuner version print to scripts
76+
- Added fix for sort of pipeline_steps now optional:
77+
- Added required model_tuner import to xgb_multi.py
78+
- Added requisite model_tuner import to multi_class_test.py
79+
- Added catboost_multi_class.py script
80+
- Removed pip dependency from requirements
81+
2882
Version 0.0.23a
2983
--------------------
3084

docs/_sources/getting_started.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Welcome to Model Tuner's Documentation!
2525
========================================
2626

2727
.. important::
28-
This documentation is for ``model_tuner`` version ``0.0.023a``.
28+
This documentation is for ``model_tuner`` version ``0.0.026b``.
2929

3030

3131
What Does Model Tuner Offer?

docs/_sources/usage_guide.rst.txt

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ Here are some of the available methods:
14751475
14761476
Extracts both the preprocessing and feature selection parts of the pipeline.
14771477

1478-
**Example**::
1478+
**Definition**::
14791479

14801480
def get_preprocessing_and_feature_selection_pipeline(self):
14811481
steps = [
@@ -1489,7 +1489,7 @@ Here are some of the available methods:
14891489
14901490
Extracts only the feature selection part of the pipeline.
14911491

1492-
**Example**::
1492+
**Definition**::
14931493

14941494
def get_feature_selection_pipeline(self):
14951495
steps = [
@@ -1503,7 +1503,7 @@ Here are some of the available methods:
15031503
15041504
Extracts only the preprocessing part of the pipeline.
15051505

1506-
**Example**::
1506+
**Definition**::
15071507

15081508
def get_preprocessing_pipeline(self):
15091509
preprocessing_steps = [
@@ -1513,6 +1513,39 @@ Here are some of the available methods:
15131513
]
15141514
return self.PipelineClass(preprocessing_steps)
15151515

1516+
Extracting Feature names
1517+
--------------------------
1518+
When performing feature selection with tools such as Recursive Feature Elimination (RFE) or
1519+
when using ColumnTransformers the feature names that are fed to the model can be obscured
1520+
and different from the original. To get the transformed feature names or to extract the
1521+
feature names that were selected by the feature selection process we have provided the
1522+
`get_feature_names()` method.
1523+
1524+
.. py:function:: get_feature_names()
1525+
1526+
Extracts the feature names after they have been processed by the pipeline.
1527+
This does not work if a ColumnTransformerm, OneHotEncoder or some form of
1528+
feature selection is not present in the pipeline.
1529+
1530+
**Definition**::
1531+
1532+
def get_feature_names(self):
1533+
if self.pipeline_steps is None or not self.pipeline_steps:
1534+
raise ValueError("You must provide pipeline steps to use get_feature_names")
1535+
if hasattr(self.estimator, "steps"):
1536+
estimator_steps = self.estimator[:-1]
1537+
else:
1538+
estimator_steps = self.estimator.estimator[:-1]
1539+
return estimator_steps.get_feature_names_out().tolist()
1540+
1541+
**Example Usage**::
1542+
1543+
### Assuming you already have fitted a model with some form of feature selection
1544+
### or feature transformation in the pipeline e.g. one hot encoder:
1545+
1546+
feat_names = model.get_feature_names()
1547+
1548+
15161549
Summary
15171550
--------
15181551

@@ -2880,7 +2913,8 @@ Step 3: Extract feature names from the training data, and initialize the SHAP ex
28802913
import shap
28812914
28822915
## Feature names are required for interpretability in SHAP plots
2883-
feature_names = X_train.columns.to_list()
2916+
## If feature selection, Column Transformer or One Hot Encoders were used
2917+
feature_names = model.get_feature_names()
28842918
28852919
## Initialize the SHAP explainer with the model
28862920
explainer = shap.TreeExplainer(xgb_classifier)
@@ -2901,7 +2935,7 @@ Step 5: Generate a summary plot of SHAP values
29012935
29022936
## Plot SHAP values
29032937
## Summary plot of SHAP values for all features across all data points
2904-
shap.summary_plot(shap_values, X_test_transformed, feature_names=feature_names,)
2938+
shap.summary_plot(shap_values, X_test_transformed, feature_names=feature_names)
29052939
29062940
29072941
.. raw:: html

docs/_static/documentation_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const DOCUMENTATION_OPTIONS = {
2-
VERSION: '0.0.23a0',
2+
VERSION: '0.0.26b0',
33
LANGUAGE: 'en',
44
COLLAPSE_INDEX: false,
55
BUILDER: 'html',

docs/about.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9-
<title>GitHub Repository &mdash; Model Tuner 0.0.23a0 documentation</title>
9+
<title>GitHub Repository &mdash; Model Tuner 0.0.26b0 documentation</title>
1010
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
1111
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
1212
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
@@ -16,7 +16,7 @@
1616
<link rel="canonical" href="https://uclamii.github.io/model_tuner/about.html" />
1717
<script src="_static/jquery.js?v=5d32c60e"></script>
1818
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
19-
<script src="_static/documentation_options.js?v=2b808d0e"></script>
19+
<script src="_static/documentation_options.js?v=eb2198be"></script>
2020
<script src="_static/doctools.js?v=9bcbadda"></script>
2121
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
2222
<script src="_static/clipboard.min.js?v=a7894cd8"></script>

docs/caveats.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9-
<title>Zero Variance Columns &mdash; Model Tuner 0.0.23a0 documentation</title>
9+
<title>Zero Variance Columns &mdash; Model Tuner 0.0.26b0 documentation</title>
1010
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
1111
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
1212
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
@@ -16,7 +16,7 @@
1616
<link rel="canonical" href="https://uclamii.github.io/model_tuner/caveats.html" />
1717
<script src="_static/jquery.js?v=5d32c60e"></script>
1818
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
19-
<script src="_static/documentation_options.js?v=2b808d0e"></script>
19+
<script src="_static/documentation_options.js?v=eb2198be"></script>
2020
<script src="_static/doctools.js?v=9bcbadda"></script>
2121
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
2222
<script src="_static/clipboard.min.js?v=a7894cd8"></script>

docs/changelog.html

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9-
<title>Changelog &mdash; Model Tuner 0.0.23a0 documentation</title>
9+
<title>Changelog &mdash; Model Tuner 0.0.26b0 documentation</title>
1010
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
1111
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
1212
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
@@ -16,7 +16,7 @@
1616
<link rel="canonical" href="https://uclamii.github.io/model_tuner/changelog.html" />
1717
<script src="_static/jquery.js?v=5d32c60e"></script>
1818
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
19-
<script src="_static/documentation_options.js?v=2b808d0e"></script>
19+
<script src="_static/documentation_options.js?v=eb2198be"></script>
2020
<script src="_static/doctools.js?v=9bcbadda"></script>
2121
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
2222
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
@@ -85,6 +85,9 @@
8585
<li class="toctree-l1"><a class="reference internal" href="about.html#acknowledgements">Acknowledgements</a></li>
8686
<li class="toctree-l1"><a class="reference internal" href="about.html#citing-model-tuner">Citing Model Tuner</a></li>
8787
<li class="toctree-l1 current"><a class="current reference internal" href="#">Changelog</a><ul>
88+
<li class="toctree-l2"><a class="reference internal" href="#version-0-0-26b-beta">Version 0.0.26b (Beta)</a></li>
89+
<li class="toctree-l2"><a class="reference internal" href="#version-0-0-25a">Version 0.0.25a</a></li>
90+
<li class="toctree-l2"><a class="reference internal" href="#version-0-0-24a">Version 0.0.24a</a></li>
8891
<li class="toctree-l2"><a class="reference internal" href="#version-0-0-23a">Version 0.0.23a</a></li>
8992
<li class="toctree-l2"><a class="reference internal" href="#version-0-0-22a">Version 0.0.22a</a></li>
9093
<li class="toctree-l2"><a class="reference internal" href="#version-0-0-21a">Version 0.0.21a</a></li>
@@ -142,6 +145,62 @@ <h1>Changelog<a class="headerlink" href="#changelog" title="Link to this heading
142145
<p class="admonition-title">Important</p>
143146
<p>Complete version release history available <a class="reference external" href="https://pypi.org/project/model-tuner/#history">here</a></p>
144147
</div>
148+
<section id="version-0-0-26b-beta">
149+
<h2>Version 0.0.26b (Beta)<a class="headerlink" href="#version-0-0-26b-beta" title="Link to this heading"></a></h2>
150+
<ul class="simple">
151+
<li><p>Optimal threshold: Users can now specify target precision or recall and an optimal</p></li>
152+
</ul>
153+
<p>threshold is computed for that
154+
- Finalised testing: coverage is now at 86% total
155+
- New get_feature_names() helper function for extracting features
156+
- n_estimators calculation for boosting algorithms is now fixed</p>
157+
</section>
158+
<section id="version-0-0-25a">
159+
<h2>Version 0.0.25a<a class="headerlink" href="#version-0-0-25a" title="Link to this heading"></a></h2>
160+
<ul class="simple">
161+
<li><p>Pushed fixes for the get_feature_selection_pipeline method.</p></li>
162+
<li><p>Updated scoring blocks for calibrated KFold models and folded confusion matrix metrics.</p></li>
163+
<li><p>Added unittests for edge cases, including test_rfe_calibrate_model() and validating confusion matrix alignment.</p></li>
164+
<li><p>Fixed mismatches between confusion matrix and classification report.</p></li>
165+
<li><p>Provided fixes for all pipeline getter methods.</p></li>
166+
<li><p>Integrated verify_imb_sampler prints into KFold logic.</p></li>
167+
<li><p>Resolved typos in group split configurations and refined nested KFold bug fixes.</p></li>
168+
<li><p>Adjusted fold metric calculations in report_model_metrics.</p></li>
169+
<li><p>Moved optimal threshold logic into prediction functionality.</p></li>
170+
<li><p>Enhanced return metrics dictionary logic to handle all cases and added multilabel classification tests.</p></li>
171+
<li><p>Addressed Brier score calculation issues and optimized regression reports for KFold.</p></li>
172+
<li><p>Introduced threshold print updates for clearer reporting.</p></li>
173+
<li><p>Implemented SHAP scripts and tests for model explainability.</p></li>
174+
<li><p>Removed outdated calibration reports from documentation and codebase.</p></li>
175+
<li><p>Fixed bugs in regression metric calculations and refined KFold metric aggregation.</p></li>
176+
</ul>
177+
</section>
178+
<section id="version-0-0-24a">
179+
<h2>Version 0.0.24a<a class="headerlink" href="#version-0-0-24a" title="Link to this heading"></a></h2>
180+
<ul class="simple">
181+
<li><p>Updated .gitignore to incl. doctrees</p></li>
182+
<li><p>Added pickleObjects tests and updated reqs, tests passed</p></li>
183+
<li><p>Added boostrapper test and tests passed</p></li>
184+
<li><p>Adding multi class test script</p></li>
185+
<li><p>Updated Metrics Output</p></li>
186+
<li><p>Added optl’ threshold print inside return_metrics</p></li>
187+
<li><p>KFold metric printing</p></li>
188+
<li><p>Augmented predict_proba test, and train_val_test_split</p></li>
189+
<li><p>Fixed pipeline_steps arg in model definition</p></li>
190+
<li><p>Refactored metrics_df in report_model_metrics for aesthetics</p></li>
191+
<li><p>Unit Tests</p></li>
192+
<li><p>Made return_dict optional in return_metrics</p></li>
193+
<li><p>Added openpyxl versions for all python versions in requirements.txt</p></li>
194+
<li><p>Refactor metrics, foldwise metrics and foldwise con_mat, class_labels</p></li>
195+
<li><p>Cleaned notebooks dir</p></li>
196+
<li><p>Added model_tuner version print to scripts</p></li>
197+
<li><p>Added fix for sort of pipeline_steps now optional:</p></li>
198+
<li><p>Added required model_tuner import to xgb_multi.py</p></li>
199+
<li><p>Added requisite model_tuner import to multi_class_test.py</p></li>
200+
<li><p>Added catboost_multi_class.py script</p></li>
201+
<li><p>Removed pip dependency from requirements</p></li>
202+
</ul>
203+
</section>
145204
<section id="version-0-0-23a">
146205
<h2>Version 0.0.23a<a class="headerlink" href="#version-0-0-23a" title="Link to this heading"></a></h2>
147206
<ul class="simple">

docs/genindex.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>Index &mdash; Model Tuner 0.0.23a0 documentation</title>
8+
<title>Index &mdash; Model Tuner 0.0.26b0 documentation</title>
99
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
1010
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
1111
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
@@ -15,7 +15,7 @@
1515
<link rel="canonical" href="https://uclamii.github.io/model_tuner/genindex.html" />
1616
<script src="_static/jquery.js?v=5d32c60e"></script>
1717
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
18-
<script src="_static/documentation_options.js?v=2b808d0e"></script>
18+
<script src="_static/documentation_options.js?v=eb2198be"></script>
1919
<script src="_static/doctools.js?v=9bcbadda"></script>
2020
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
2121
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
@@ -131,6 +131,8 @@ <h2 id="B">B</h2>
131131
<li><a href="usage_guide.html#check_input_type">check_input_type()</a>
132132
</li>
133133
<li><a href="usage_guide.html#evaluate_bootstrap_metrics">evaluate_bootstrap_metrics()</a>
134+
</li>
135+
<li><a href="usage_guide.html#get_feature_names">get_feature_names()</a>
134136
</li>
135137
<li><a href="usage_guide.html#get_feature_selection_pipeline">get_feature_selection_pipeline()</a>
136138
</li>
@@ -178,21 +180,28 @@ <h2 id="G">G</h2>
178180
<table style="width: 100%" class="indextable genindextable"><tr>
179181
<td style="width: 33%; vertical-align: top;"><ul>
180182
<li>
183+
get_feature_names()
184+
185+
<ul>
186+
<li><a href="usage_guide.html#get_feature_names">built-in function</a>
187+
</li>
188+
</ul></li>
189+
<li>
181190
get_feature_selection_pipeline()
182191

183192
<ul>
184193
<li><a href="usage_guide.html#get_feature_selection_pipeline">built-in function</a>
185194
</li>
186195
</ul></li>
196+
</ul></td>
197+
<td style="width: 33%; vertical-align: top;"><ul>
187198
<li>
188199
get_preprocessing_and_feature_selection_pipeline()
189200

190201
<ul>
191202
<li><a href="usage_guide.html#get_preprocessing_and_feature_selection_pipeline">built-in function</a>
192203
</li>
193204
</ul></li>
194-
</ul></td>
195-
<td style="width: 33%; vertical-align: top;"><ul>
196205
<li>
197206
get_preprocessing_pipeline()
198207

0 commit comments

Comments
 (0)