multimodel-analysis 0.1.3__tar.gz → 0.2.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.
- multimodel_analysis-0.2.0/MANIFEST.in +7 -0
- {multimodel_analysis-0.1.3 → multimodel_analysis-0.2.0}/PKG-INFO +81 -73
- {multimodel_analysis-0.1.3 → multimodel_analysis-0.2.0}/multimodel_analysis/__init__.py +7 -5
- multimodel_analysis-0.2.0/multimodel_analysis/core/__init__.py +6 -0
- multimodel_analysis-0.2.0/multimodel_analysis/core/base.py +377 -0
- multimodel_analysis-0.2.0/multimodel_analysis/core/persistence.py +89 -0
- multimodel_analysis-0.2.0/multimodel_analysis/core/preprocessing.py +62 -0
- multimodel_analysis-0.2.0/multimodel_analysis/core/registry.py +90 -0
- multimodel_analysis-0.2.0/multimodel_analysis/core/utils.py +142 -0
- multimodel_analysis-0.2.0/multimodel_analysis/multimodel.py +39 -0
- multimodel_analysis-0.2.0/multimodel_analysis/supervised/__init__.py +5 -0
- multimodel_analysis-0.2.0/multimodel_analysis/supervised/classification.py +474 -0
- multimodel_analysis-0.2.0/multimodel_analysis/supervised/regression.py +279 -0
- multimodel_analysis-0.1.3/README.md → multimodel_analysis-0.2.0/multimodel_analysis.egg-info/PKG-INFO +377 -340
- multimodel_analysis-0.2.0/multimodel_analysis.egg-info/SOURCES.txt +22 -0
- multimodel_analysis-0.2.0/multimodel_analysis.egg-info/requires.txt +17 -0
- multimodel_analysis-0.2.0/pyproject.toml +52 -0
- multimodel_analysis-0.1.3/multimodel_analysis.egg-info/PKG-INFO → multimodel_analysis-0.2.0/readme.md +345 -369
- multimodel_analysis-0.2.0/requirements.txt +5 -0
- multimodel_analysis-0.2.0/setup.py +4 -0
- multimodel_analysis-0.1.3/MANIFEST.in +0 -4
- multimodel_analysis-0.1.3/architecture_diagram.png +0 -0
- multimodel_analysis-0.1.3/multi_modelml.png +0 -0
- multimodel_analysis-0.1.3/multimodel_analysis/multimodel.py +0 -987
- multimodel_analysis-0.1.3/multimodel_analysis.egg-info/SOURCES.txt +0 -15
- multimodel_analysis-0.1.3/multimodel_analysis.egg-info/requires.txt +0 -5
- multimodel_analysis-0.1.3/requirements.txt +0 -5
- multimodel_analysis-0.1.3/setup.py +0 -30
- multimodel_analysis-0.1.3/tests/test_multimodel.py +0 -173
- {multimodel_analysis-0.1.3 → multimodel_analysis-0.2.0}/LICENSE +0 -0
- {multimodel_analysis-0.1.3 → multimodel_analysis-0.2.0}/multimodel_analysis.egg-info/dependency_links.txt +0 -0
- {multimodel_analysis-0.1.3 → multimodel_analysis-0.2.0}/multimodel_analysis.egg-info/top_level.txt +0 -0
- {multimodel_analysis-0.1.3 → multimodel_analysis-0.2.0}/setup.cfg +0 -0
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multimodel_analysis
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A Python
|
|
5
|
-
Author: Uditya Narayan Tiwari
|
|
6
|
-
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Python package for automatic multi-model analysis (classification, regression and clustering)
|
|
5
|
+
Author-email: Uditya Narayan Tiwari <tiwarimerit@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/udityamerit/Multimodel-Analysis-Pacakge
|
|
8
|
+
Project-URL: Documentation, https://udityamerit.github.io/Multimodel-Analysis-Pacakge-Documentation/
|
|
7
9
|
Classifier: Programming Language :: Python :: 3
|
|
8
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
11
|
Classifier: Operating System :: OS Independent
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
13
|
Classifier: Intended Audience :: Science/Research
|
|
12
|
-
Requires-Python: >=3.
|
|
14
|
+
Requires-Python: >=3.9
|
|
13
15
|
Description-Content-Type: text/markdown
|
|
14
16
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: numpy
|
|
16
|
-
Requires-Dist: pandas
|
|
17
|
-
Requires-Dist: matplotlib
|
|
18
|
-
Requires-Dist: seaborn
|
|
19
|
-
Requires-Dist: scikit-learn
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
Requires-Dist: numpy>=1.22
|
|
18
|
+
Requires-Dist: pandas>=1.4
|
|
19
|
+
Requires-Dist: matplotlib>=3.5
|
|
20
|
+
Requires-Dist: seaborn>=0.12
|
|
21
|
+
Requires-Dist: scikit-learn>=1.3
|
|
22
|
+
Provides-Extra: excel
|
|
23
|
+
Requires-Dist: openpyxl>=3.0; extra == "excel"
|
|
24
|
+
Provides-Extra: boost
|
|
25
|
+
Requires-Dist: xgboost>=1.7; extra == "boost"
|
|
26
|
+
Requires-Dist: lightgbm>=3.3; extra == "boost"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
30
|
+
Requires-Dist: openpyxl>=3.0; extra == "dev"
|
|
25
31
|
Dynamic: license-file
|
|
26
|
-
Dynamic: requires-dist
|
|
27
|
-
Dynamic: requires-python
|
|
28
|
-
Dynamic: summary
|
|
29
32
|
|
|
30
33
|
# MultiModel Analysis
|
|
31
34
|
|
|
@@ -33,13 +36,7 @@ Dynamic: summary
|
|
|
33
36
|
<img src="https://raw.githubusercontent.com/udityamerit/Multimodel-Analysis-Pacakge/main/multi_modelml.png" alt="MultiModel Analysis Banner" width="100%"/>
|
|
34
37
|
</p>
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
[](https://pypi.org/project/multimodel-analysis/)
|
|
38
|
-
[](https://pypi.org/project/multimodel-analysis/)
|
|
39
|
-
[](https://pepy.tech/project/multimodel-analysis)
|
|
40
|
-
[](https://udityamerit.github.io/Multimodel-Analysis-Pacakge-Documentation/)
|
|
41
|
-
[](LICENSE)
|
|
42
|
-
[](https://scikit-learn.org/)
|
|
39
|
+
<p align="center"><a href="https://pypi.org/project/multimodel-analysis/"><img src="https://img.shields.io/pypi/v/multimodel-analysis.svg?color=blue" alt="PyPI Version"/></a> <a href="https://pypi.org/project/multimodel-analysis/"><img src="https://img.shields.io/pypi/pyversions/multimodel-analysis.svg" alt="Python Version"/></a> <a href="https://udityamerit.github.io/Multimodel-Analysis-Pacakge-Documentation/"><img src="https://img.shields.io/badge/Documentation-Live%20Docs-brightgreen.svg?logo=github&logoColor=white" alt="Live Documentation"/></a> <a href="https://pepy.tech/project/multimodel-analysis"><img src="https://pepy.tech/badge/multimodel-analysis" alt="Total Downloads"/></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"/></a> <a href="https://scikit-learn.org/"><img src="https://img.shields.io/badge/Built%20With-Scikit--Learn-orange?logo=scikit-learn&logoColor=white" alt="Built With Scikit-Learn"/></a></p>
|
|
43
40
|
|
|
44
41
|
**MultiModel Analysis** is a Python framework designed to automate model benchmarking, evaluation, and visualization for Supervised Machine Learning tasks (Classification and Regression). It provides a unified interface for training multiple baseline models, computing statistical evaluation metrics, generating diagnostic visualizations, and identifying optimal model candidates.
|
|
45
42
|
|
|
@@ -58,6 +55,7 @@ Dynamic: summary
|
|
|
58
55
|
- [Standalone Utility Functions](#standalone-utility-functions)
|
|
59
56
|
- [MultiModelClassifier](#multimodelclassifier)
|
|
60
57
|
- [MultiModelRegressor](#multimodelregressor)
|
|
58
|
+
- [Function Code Reference Guide (`func_code.md`)](#function-code-reference-guide-func_codemd)
|
|
61
59
|
- [Evaluation Metrics](#evaluation-metrics)
|
|
62
60
|
- [Dependencies](#dependencies)
|
|
63
61
|
- [License and Citation](#license-and-citation)
|
|
@@ -108,6 +106,7 @@ Selecting an appropriate estimator for a given tabular dataset requires benchmar
|
|
|
108
106
|
- Decision Tree Regressor (`DecisionTreeRegressor`)
|
|
109
107
|
- Random Forest Regressor (`RandomForestRegressor`)
|
|
110
108
|
- Gradient Boosting Regressor (`GradientBoostingRegressor`)
|
|
109
|
+
- AdaBoost Regressor (`AdaBoostRegressor`)
|
|
111
110
|
- *Custom Estimators*: User-supplied scikit-learn compatible regressors.
|
|
112
111
|
|
|
113
112
|
---
|
|
@@ -152,22 +151,22 @@ classifier = MultiModelClassifier(
|
|
|
152
151
|
n_jobs=-1
|
|
153
152
|
)
|
|
154
153
|
|
|
155
|
-
# 3. Train all classification models (
|
|
156
|
-
results = classifier.run_all_models()
|
|
154
|
+
# 3. Train all classification models (with optional random_state parameter)
|
|
155
|
+
results = classifier.run_all_models(random_state=42)
|
|
157
156
|
|
|
158
|
-
# 4. Display tabular performance report
|
|
159
|
-
df_report = classifier.show_tabular_report(
|
|
157
|
+
# 4. Display tabular performance report (models argument is optional!)
|
|
158
|
+
df_report = classifier.show_tabular_report(return_df=True)
|
|
160
159
|
|
|
161
160
|
# 5. Export tabular report to disk
|
|
162
161
|
save_report(df_report, "classification_report.csv")
|
|
163
162
|
|
|
164
163
|
# 6. Render & save diagnostic figures
|
|
165
|
-
classifier.plot_confusion_matrices(
|
|
166
|
-
classifier.plot_roc_curves(
|
|
167
|
-
classifier.plot_comparison(
|
|
164
|
+
classifier.plot_confusion_matrices(save_path="confusion_matrix.png")
|
|
165
|
+
classifier.plot_roc_curves(save_path="roc_curve.png")
|
|
166
|
+
classifier.plot_comparison(save_path="metrics_comparison.png")
|
|
168
167
|
|
|
169
168
|
# Or run everything in one line:
|
|
170
|
-
classifier.get_summary(
|
|
169
|
+
classifier.get_summary(save_prefix="clf_run")
|
|
171
170
|
```
|
|
172
171
|
|
|
173
172
|
---
|
|
@@ -194,17 +193,17 @@ regressor = MultiModelRegressor(
|
|
|
194
193
|
)
|
|
195
194
|
|
|
196
195
|
# 3. Train all regression models
|
|
197
|
-
results = regressor.run_all_models()
|
|
196
|
+
results = regressor.run_all_models(random_state=42)
|
|
198
197
|
|
|
199
|
-
# 4. Display tabular performance report
|
|
200
|
-
regressor.show_tabular_report(
|
|
198
|
+
# 4. Display tabular performance report (models argument is optional!)
|
|
199
|
+
regressor.show_tabular_report()
|
|
201
200
|
|
|
202
201
|
# 5. Render & save diagnostic figures
|
|
203
|
-
regressor.plot_true_vs_predicted(
|
|
204
|
-
regressor.plot_comparison(
|
|
202
|
+
regressor.plot_true_vs_predicted(save_path="true_vs_pred.png")
|
|
203
|
+
regressor.plot_comparison(save_path="r2_comparison.png")
|
|
205
204
|
|
|
206
205
|
# Or run everything and export outputs in one line:
|
|
207
|
-
regressor.get_summary(
|
|
206
|
+
regressor.get_summary(save_prefix="reg_run")
|
|
208
207
|
```
|
|
209
208
|
|
|
210
209
|
---
|
|
@@ -225,8 +224,8 @@ save_report(df, "report.html") # Saves as HTML Table
|
|
|
225
224
|
save_report(df, "report.json") # Saves as JSON File
|
|
226
225
|
```
|
|
227
226
|
|
|
228
|
-
* **`df`** (*pandas.DataFrame*): Report DataFrame returned by `show_tabular_report(
|
|
229
|
-
* **`filepath`** (*str*): Target file path with `.csv`, `.xlsx`, `.xls`, `.html`, `.htm`, or `.json` extension.
|
|
227
|
+
* **`df`** (*pandas.DataFrame, default=None*): Report DataFrame returned by `show_tabular_report(return_df=True)`.
|
|
228
|
+
* **`filepath`** (*str, default="report.csv"*): Target file path with `.csv`, `.xlsx`, `.xls`, `.html`, `.htm`, or `.json` extension.
|
|
230
229
|
|
|
231
230
|
---
|
|
232
231
|
|
|
@@ -250,32 +249,33 @@ multimodel_analysis.MultiModelClassifier(
|
|
|
250
249
|
- **`y`** (*pandas.Series, pandas.DataFrame, or numpy.ndarray*): Target labels (binary or multiclass, numerical or string).
|
|
251
250
|
- **`test_size`** (*float, default=0.3*): Proportion of dataset for test split (between `0.0` and `1.0`).
|
|
252
251
|
- **`scaled_data`** (*bool, default=False*): Fits and applies `StandardScaler` to features while preserving DataFrame columns and index metadata.
|
|
253
|
-
- **`random_state`** (*int, default=42*): Seed for train-test split and reproducible model initialization.
|
|
252
|
+
- **`random_state`** (*int or None, default=42*): Seed for train-test split and reproducible model initialization.
|
|
254
253
|
- **`stratify`** (*bool, default=True*): Performs stratified splitting when class sample counts allow (`min_count >= 2`).
|
|
255
254
|
- **`n_jobs`** (*int or None, default=-1*): Number of parallel CPU threads for estimators supporting `n_jobs`.
|
|
256
255
|
|
|
257
|
-
####
|
|
256
|
+
#### Method List
|
|
258
257
|
|
|
259
258
|
| Method | Parameters | Return Type | Description |
|
|
260
259
|
|---|---|---|---|
|
|
261
|
-
| **`run_all_models()`** | `custom_models: dict = None` | `list of tuple` | Fits all 8 built-in classifiers (plus optional custom estimators in `custom_models`). Returns a list of evaluation tuples. |
|
|
262
|
-
| **`show_tabular_report()`** | `models: list, return_df: bool = False` | `pandas.DataFrame` or `None` | Displays a formatted comparison table sorted by Accuracy and recommends the best model. Returns a DataFrame if `return_df=True`. |
|
|
263
|
-
| **`plot_confusion_matrices()`** | `models: list, save_path: str = None, show_plot: bool = True` | `None` | Plots confusion matrix heatmaps with original class labels for all models. Saves image if `save_path` is given. |
|
|
264
|
-
| **`plot_roc_curves()`** | `models: list, save_path: str = None, show_plot: bool = True` | `None` | Plots combined binary or macro-average ROC curves with AUC scores. Saves image if `save_path` is given. |
|
|
265
|
-
| **`plot_comparison()`** | `models: list, save_path: str = None, show_plot: bool = True` | `None` | Plots grouped bar charts comparing Accuracy, Precision, Recall, and F1 Score. Saves image if `save_path` is given. |
|
|
266
|
-
| **`get_summary()`** | `models: list, save_prefix: str = None, show_plot: bool = True` | `None` | Executes the full reporting and plotting suite in one call. Auto-exports report CSV and PNG charts if `save_prefix` is set. |
|
|
267
|
-
| **`save_report()`** | `df_or_filepath: Union[pd.DataFrame, str], filepath: str = None` | `None` | Instance method to save report to CSV/Excel/HTML/JSON. Can be called as `clf.save_report("report.csv")`. |
|
|
268
|
-
| **`evaluate_model()`** | `model: estimator, X_test: array, y_true: array` | `tuple` | Evaluates a single trained model instance and returns its evaluation tuple `(report, matrix, accuracy, precision, recall, f1, fpr_dict, tpr_dict, roc_auc)`. |
|
|
260
|
+
| **`run_all_models()`** | `custom_models: dict = None, random_state: int = None` | `list of tuple` | Fits all 8 built-in classifiers (plus optional custom estimators in `custom_models`). Returns a list of evaluation tuples. |
|
|
261
|
+
| **`show_tabular_report()`** | `models: list = None, return_df: bool = False` | `pandas.DataFrame` or `None` | Displays a formatted comparison table sorted by Accuracy and recommends the best model. Returns a DataFrame if `return_df=True`. |
|
|
262
|
+
| **`plot_confusion_matrices()`** | `models: list = None, save_path: str = None, show_plot: bool = True` | `None` | Plots confusion matrix heatmaps with original class labels for all models. Saves image if `save_path` is given. |
|
|
263
|
+
| **`plot_roc_curves()`** | `models: list = None, save_path: str = None, show_plot: bool = True` | `None` | Plots combined binary or macro-average ROC curves with AUC scores. Saves image if `save_path` is given. |
|
|
264
|
+
| **`plot_comparison()`** | `models: list = None, save_path: str = None, show_plot: bool = True` | `None` | Plots grouped bar charts comparing Accuracy, Precision, Recall, and F1 Score. Saves image if `save_path` is given. |
|
|
265
|
+
| **`get_summary()`** | `models: list = None, save_prefix: str = None, show_plot: bool = True` | `None` | Executes the full reporting and plotting suite in one call. Auto-exports report CSV and PNG charts if `save_prefix` is set. |
|
|
266
|
+
| **`save_report()`** | `df_or_filepath: Union[pd.DataFrame, str] = None, filepath: str = None` | `None` | Instance method to save report to CSV/Excel/HTML/JSON. Can be called as `clf.save_report("report.csv")` or `clf.save_report()`. |
|
|
267
|
+
| **`evaluate_model()`** | `model: estimator, X_test: array = None, y_true: array = None` | `tuple` | Evaluates a single trained model instance and returns its evaluation tuple `(report, matrix, accuracy, precision, recall, f1, fpr_dict, tpr_dict, roc_auc)`. |
|
|
269
268
|
|
|
270
269
|
#### Individual Model Methods
|
|
271
|
-
|
|
272
|
-
- `clf.
|
|
273
|
-
- `clf.
|
|
274
|
-
- `clf.
|
|
270
|
+
All model methods accept `random_state: int = None` and custom hyperparameters (`**kwargs`):
|
|
271
|
+
- `clf.Logistic_model(random_state=100, max_iter=2000)` : Trains and evaluates Logistic Regression.
|
|
272
|
+
- `clf.Support_vector_model(random_state=99, kernel='rbf')` : Trains and evaluates Support Vector Classifier.
|
|
273
|
+
- `clf.DecisionTree_model(random_state=42)` : Trains and evaluates Decision Tree Classifier.
|
|
274
|
+
- `clf.KNN_model(n_neighbors=5)` : Trains and evaluates K-Nearest Neighbors.
|
|
275
275
|
- `clf.Naive_Bayes_model()` : Trains and evaluates Gaussian Naive Bayes.
|
|
276
|
-
- `clf.RandomForest_model()` : Trains and evaluates Random Forest Classifier.
|
|
277
|
-
- `clf.GradientBoosting_model()` : Trains and evaluates Gradient Boosting Classifier.
|
|
278
|
-
- `clf.AdaBoost_model()` : Trains and evaluates AdaBoost Classifier.
|
|
276
|
+
- `clf.RandomForest_model(n_estimators=100, random_state=42)` : Trains and evaluates Random Forest Classifier.
|
|
277
|
+
- `clf.GradientBoosting_model(n_estimators=100, random_state=42)` : Trains and evaluates Gradient Boosting Classifier.
|
|
278
|
+
- `clf.AdaBoost_model(n_estimators=50, random_state=42)` : Trains and evaluates AdaBoost Classifier.
|
|
279
279
|
|
|
280
280
|
---
|
|
281
281
|
|
|
@@ -298,29 +298,31 @@ multimodel_analysis.MultiModelRegressor(
|
|
|
298
298
|
- **`y`** (*pandas.Series, pandas.DataFrame, or numpy.ndarray*): Continuous target values (automatically flattened if 2D single-column input).
|
|
299
299
|
- **`test_size`** (*float, default=0.3*): Proportion of dataset for test split.
|
|
300
300
|
- **`scaled_data`** (*bool, default=False*): Applies `StandardScaler` to features retaining DataFrame structure.
|
|
301
|
-
- **`random_state`** (*int, default=42*): Seed for reproducible train-test split.
|
|
301
|
+
- **`random_state`** (*int or None, default=42*): Seed for reproducible train-test split.
|
|
302
302
|
- **`n_jobs`** (*int or None, default=-1*): Number of CPU threads for parallel regressors.
|
|
303
303
|
|
|
304
|
-
####
|
|
304
|
+
#### Method List
|
|
305
305
|
|
|
306
306
|
| Method | Parameters | Return Type | Description |
|
|
307
307
|
|---|---|---|---|
|
|
308
|
-
| **`run_all_models()`** | `custom_models: dict = None` | `list of tuple` | Fits all
|
|
309
|
-
| **`show_tabular_report()`** | `models: list, return_df: bool = False` | `pandas.DataFrame` or `None` | Displays a formatted comparison table sorted by R² Score (MAE, MSE, RMSE, R²) and recommends the best model. |
|
|
310
|
-
| **`plot_true_vs_predicted()`** | `models: list, save_path: str = None, show_plot: bool = True` | `None` | Renders True vs Predicted scatter plots with identity line bounds. Saves image if `save_path` is given. |
|
|
311
|
-
| **`plot_comparison()`** | `models: list, save_path: str = None, show_plot: bool = True` | `None` | Renders a comparative bar chart of R² Scores across evaluated regressor models. Saves image if `save_path` is given. |
|
|
312
|
-
| **`get_summary()`** | `models: list, save_prefix: str = None, show_plot: bool = True` | `None` | Executes full tabular report and plotting pipeline. Auto-exports report CSV and PNG charts if `save_prefix` is set. |
|
|
313
|
-
| **`save_report()`** | `df_or_filepath: Union[pd.DataFrame, str], filepath: str = None` | `None` | Instance method to save report to CSV/Excel/HTML/JSON. Can be called as `reg.save_report("report.csv")`. |
|
|
314
|
-
| **`evaluate_model()`** | `model: estimator, X_test: array, y_true: array` | `tuple` | Evaluates a single trained regressor and returns `(mae, mse, rmse, r2, y_pred)`. |
|
|
308
|
+
| **`run_all_models()`** | `custom_models: dict = None, random_state: int = None` | `list of tuple` | Fits all 8 built-in regressors (plus optional custom regressors in `custom_models`). Returns a list of evaluation tuples. |
|
|
309
|
+
| **`show_tabular_report()`** | `models: list = None, return_df: bool = False` | `pandas.DataFrame` or `None` | Displays a formatted comparison table sorted by R² Score (MAE, MSE, RMSE, R²) and recommends the best model. |
|
|
310
|
+
| **`plot_true_vs_predicted()`** | `models: list = None, save_path: str = None, show_plot: bool = True` | `None` | Renders True vs Predicted scatter plots with identity line bounds. Saves image if `save_path` is given. |
|
|
311
|
+
| **`plot_comparison()`** | `models: list = None, save_path: str = None, show_plot: bool = True` | `None` | Renders a comparative bar chart of R² Scores across evaluated regressor models. Saves image if `save_path` is given. |
|
|
312
|
+
| **`get_summary()`** | `models: list = None, save_prefix: str = None, show_plot: bool = True` | `None` | Executes full tabular report and plotting pipeline. Auto-exports report CSV and PNG charts if `save_prefix` is set. |
|
|
313
|
+
| **`save_report()`** | `df_or_filepath: Union[pd.DataFrame, str] = None, filepath: str = None` | `None` | Instance method to save report to CSV/Excel/HTML/JSON. Can be called as `reg.save_report("report.csv")` or `reg.save_report()`. |
|
|
314
|
+
| **`evaluate_model()`** | `model: estimator, X_test: array = None, y_true: array = None` | `tuple` | Evaluates a single trained regressor and returns `(mae, mse, rmse, r2, y_pred)`. |
|
|
315
315
|
|
|
316
316
|
#### Individual Model Methods
|
|
317
|
+
All model methods accept `random_state: int = None` and custom hyperparameters (`**kwargs`):
|
|
317
318
|
- `reg.LinearRegression_model()` : Trains and evaluates Linear Regression.
|
|
318
|
-
- `reg.Lasso_model()` : Trains and evaluates Lasso Regression.
|
|
319
|
-
- `reg.Ridge_model()` : Trains and evaluates Ridge Regression.
|
|
320
|
-
- `reg.SVR_model()` : Trains and evaluates Support Vector Regressor.
|
|
321
|
-
- `reg.DecisionTree_model()` : Trains and evaluates Decision Tree Regressor.
|
|
322
|
-
- `reg.RandomForest_model()` : Trains and evaluates Random Forest Regressor.
|
|
323
|
-
- `reg.GradientBoosting_model()` : Trains and evaluates Gradient Boosting Regressor.
|
|
319
|
+
- `reg.Lasso_model(alpha=0.05, random_state=42)` : Trains and evaluates Lasso Regression.
|
|
320
|
+
- `reg.Ridge_model(alpha=1.0, random_state=42)` : Trains and evaluates Ridge Regression.
|
|
321
|
+
- `reg.SVR_model(kernel='rbf')` : Trains and evaluates Support Vector Regressor.
|
|
322
|
+
- `reg.DecisionTree_model(random_state=42)` : Trains and evaluates Decision Tree Regressor.
|
|
323
|
+
- `reg.RandomForest_model(n_estimators=100, random_state=42)` : Trains and evaluates Random Forest Regressor.
|
|
324
|
+
- `reg.GradientBoosting_model(n_estimators=100, random_state=42)` : Trains and evaluates Gradient Boosting Regressor.
|
|
325
|
+
- `reg.AdaBoost_model(n_estimators=50, random_state=42)` : Trains and evaluates AdaBoost Regressor.
|
|
324
326
|
|
|
325
327
|
---
|
|
326
328
|
|
|
@@ -330,6 +332,12 @@ multimodel_analysis.MultiModelRegressor(
|
|
|
330
332
|
|
|
331
333
|
---
|
|
332
334
|
|
|
335
|
+
## Function Code Reference Guide (`func_code.md`)
|
|
336
|
+
|
|
337
|
+
For complete code signatures, detailed parameter options, and copy-pasteable runnable code snippets for **every function and method**, refer to the [`func_code.md`](func_code.md) guide included in this repository.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
333
341
|
## Evaluation Metrics
|
|
334
342
|
|
|
335
343
|
### Classification Metrics
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# Entry level code and import for Multi-Model Analysis
|
|
2
2
|
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
3
|
+
from .core.persistence import TrainedModel, load_model
|
|
4
|
+
from .core.utils import save_report
|
|
5
5
|
from .multimodel import MultiModelRegressior
|
|
6
|
-
from .
|
|
6
|
+
from .supervised import MultiModelClassifier, MultiModelRegressor
|
|
7
7
|
|
|
8
|
-
__version__ = '0.
|
|
8
|
+
__version__ = '0.2.0'
|
|
9
9
|
__author__ = 'Uditya Narayan Tiwari'
|
|
10
10
|
|
|
11
11
|
__all__ = [
|
|
12
|
+
'TrainedModel',
|
|
13
|
+
'load_model',
|
|
12
14
|
'MultiModelClassifier',
|
|
13
15
|
'MultiModelRegressor',
|
|
14
16
|
'MultiModelRegressior',
|
|
15
17
|
'save_report',
|
|
16
|
-
]
|
|
18
|
+
]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""Shared building blocks (base class, registry, helpers)."""
|
|
2
|
+
from .persistence import TrainedModel, load_model
|
|
3
|
+
from .registry import BuildContext, ModelRegistry, ModelSpec
|
|
4
|
+
from .utils import save_report
|
|
5
|
+
|
|
6
|
+
__all__ = ["BuildContext", "ModelRegistry", "ModelSpec", "TrainedModel", "load_model", "save_report"]
|