best-model-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.
- best_model_toolkit-0.1.0/PKG-INFO +88 -0
- best_model_toolkit-0.1.0/README.md +70 -0
- best_model_toolkit-0.1.0/pyproject.toml +30 -0
- best_model_toolkit-0.1.0/setup.cfg +4 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit/__init__.py +75 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit/core.py +1016 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit.egg-info/PKG-INFO +88 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit.egg-info/SOURCES.txt +9 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit.egg-info/dependency_links.txt +1 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit.egg-info/requires.txt +7 -0
- best_model_toolkit-0.1.0/src/best_model_toolkit.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: best-model-toolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Train, tune, and compare sklearn/XGBoost models with built-in metric plots
|
|
5
|
+
Author: Your Name
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/YOUR_USERNAME/best-model-toolkit
|
|
8
|
+
Project-URL: Issues, https://github.com/YOUR_USERNAME/best-model-toolkit/issues
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: scipy
|
|
14
|
+
Requires-Dist: matplotlib
|
|
15
|
+
Requires-Dist: seaborn
|
|
16
|
+
Requires-Dist: scikit-learn>=1.2
|
|
17
|
+
Requires-Dist: xgboost
|
|
18
|
+
|
|
19
|
+
# best-model-toolkit
|
|
20
|
+
|
|
21
|
+
A collection of functions for quickly training, tuning (`GridSearchCV`) and
|
|
22
|
+
comparing several `scikit-learn` / `XGBoost` models for **regression** and
|
|
23
|
+
**classification** tasks, with automatic plots of metrics (R², MAE, RMSE,
|
|
24
|
+
F1, precision, recall, PR curves, etc).
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### Locally (before the package is on PyPI)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/YOUR_USERNAME/best-model-toolkit.git
|
|
32
|
+
cd best-model-toolkit
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Directly from GitHub
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install git+https://github.com/YOUR_USERNAME/best-model-toolkit.git
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### From PyPI (once published, see below)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install best-model-toolkit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from best_model_toolkit import best_model
|
|
52
|
+
import pandas as pd
|
|
53
|
+
|
|
54
|
+
df = pd.read_csv("your_data.csv")
|
|
55
|
+
X = df.drop(columns=["target"])
|
|
56
|
+
y = df["target"]
|
|
57
|
+
|
|
58
|
+
results = best_model(
|
|
59
|
+
features=X,
|
|
60
|
+
target=y,
|
|
61
|
+
mode="regression", # or "classification"
|
|
62
|
+
grid="Yes", # "Yes"/"No" — whether to run GridSearchCV
|
|
63
|
+
df=df,
|
|
64
|
+
hue=None, # column for pairplot hue (classification)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# results — dict {"model_name": {"model": ..., "param": ..., "metrics": {...}}}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Package structure
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
best_model_toolkit/
|
|
74
|
+
├── pyproject.toml
|
|
75
|
+
├── README.md
|
|
76
|
+
└── src/
|
|
77
|
+
└── best_model_toolkit/
|
|
78
|
+
├── __init__.py
|
|
79
|
+
└── core.py
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Publishing to PyPI
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install build twine
|
|
86
|
+
python -m build
|
|
87
|
+
twine upload dist/*
|
|
88
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# best-model-toolkit
|
|
2
|
+
|
|
3
|
+
A collection of functions for quickly training, tuning (`GridSearchCV`) and
|
|
4
|
+
comparing several `scikit-learn` / `XGBoost` models for **regression** and
|
|
5
|
+
**classification** tasks, with automatic plots of metrics (R², MAE, RMSE,
|
|
6
|
+
F1, precision, recall, PR curves, etc).
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### Locally (before the package is on PyPI)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/YOUR_USERNAME/best-model-toolkit.git
|
|
14
|
+
cd best-model-toolkit
|
|
15
|
+
pip install -e .
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Directly from GitHub
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install git+https://github.com/YOUR_USERNAME/best-model-toolkit.git
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### From PyPI (once published, see below)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install best-model-toolkit
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from best_model_toolkit import best_model
|
|
34
|
+
import pandas as pd
|
|
35
|
+
|
|
36
|
+
df = pd.read_csv("your_data.csv")
|
|
37
|
+
X = df.drop(columns=["target"])
|
|
38
|
+
y = df["target"]
|
|
39
|
+
|
|
40
|
+
results = best_model(
|
|
41
|
+
features=X,
|
|
42
|
+
target=y,
|
|
43
|
+
mode="regression", # or "classification"
|
|
44
|
+
grid="Yes", # "Yes"/"No" — whether to run GridSearchCV
|
|
45
|
+
df=df,
|
|
46
|
+
hue=None, # column for pairplot hue (classification)
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# results — dict {"model_name": {"model": ..., "param": ..., "metrics": {...}}}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Package structure
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
best_model_toolkit/
|
|
56
|
+
├── pyproject.toml
|
|
57
|
+
├── README.md
|
|
58
|
+
└── src/
|
|
59
|
+
└── best_model_toolkit/
|
|
60
|
+
├── __init__.py
|
|
61
|
+
└── core.py
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Publishing to PyPI
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install build twine
|
|
68
|
+
python -m build
|
|
69
|
+
twine upload dist/*
|
|
70
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "best-model-toolkit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Train, tune, and compare sklearn/XGBoost models with built-in metric plots"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Your Name" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy",
|
|
17
|
+
"pandas",
|
|
18
|
+
"scipy",
|
|
19
|
+
"matplotlib",
|
|
20
|
+
"seaborn",
|
|
21
|
+
"scikit-learn>=1.2",
|
|
22
|
+
"xgboost",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/YOUR_USERNAME/best-model-toolkit"
|
|
27
|
+
Issues = "https://github.com/YOUR_USERNAME/best-model-toolkit/issues"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
best_model_toolkit
|
|
3
|
+
===================
|
|
4
|
+
|
|
5
|
+
Utilities for training, tuning (GridSearchCV) and comparing scikit-learn /
|
|
6
|
+
XGBoost models for regression and classification tasks, together with
|
|
7
|
+
ready-made plots of performance metrics (R^2, MAE, RMSE, F1, precision,
|
|
8
|
+
recall, PR curves, etc).
|
|
9
|
+
|
|
10
|
+
Main function:
|
|
11
|
+
|
|
12
|
+
from best_model_toolkit import best_model
|
|
13
|
+
|
|
14
|
+
results = best_model(
|
|
15
|
+
features=X, target=y,
|
|
16
|
+
mode="regression", # or "classification"
|
|
17
|
+
grid="Yes", # whether to run GridSearchCV
|
|
18
|
+
df=df, hue=None,
|
|
19
|
+
pairplot_type="heatmap", # "heatmap" | "top_corr" | "full" | "none"
|
|
20
|
+
)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from .core import (
|
|
24
|
+
best_model,
|
|
25
|
+
test_model_reg,
|
|
26
|
+
test_model_class,
|
|
27
|
+
grid_reg,
|
|
28
|
+
grid_class,
|
|
29
|
+
plot_r2,
|
|
30
|
+
plot_score_reg,
|
|
31
|
+
plot_mae,
|
|
32
|
+
plot_rmse,
|
|
33
|
+
plot_score,
|
|
34
|
+
plot_f1_score,
|
|
35
|
+
plot_score_precision,
|
|
36
|
+
plot_score_recall,
|
|
37
|
+
plot_score_ap,
|
|
38
|
+
plot_score_generic,
|
|
39
|
+
plot_curve_generic,
|
|
40
|
+
plot_cv_r2,
|
|
41
|
+
plot_mae_mse,
|
|
42
|
+
plot_cv_metrics,
|
|
43
|
+
plot_pair_grid_ref,
|
|
44
|
+
plot_pair_grid_class,
|
|
45
|
+
plot_corr_heatmap,
|
|
46
|
+
plot_pair_grid_top_corr,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__version__ = "0.2.0"
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
"best_model",
|
|
53
|
+
"test_model_reg",
|
|
54
|
+
"test_model_class",
|
|
55
|
+
"grid_reg",
|
|
56
|
+
"grid_class",
|
|
57
|
+
"plot_r2",
|
|
58
|
+
"plot_score_reg",
|
|
59
|
+
"plot_mae",
|
|
60
|
+
"plot_rmse",
|
|
61
|
+
"plot_score",
|
|
62
|
+
"plot_f1_score",
|
|
63
|
+
"plot_score_precision",
|
|
64
|
+
"plot_score_recall",
|
|
65
|
+
"plot_score_ap",
|
|
66
|
+
"plot_score_generic",
|
|
67
|
+
"plot_curve_generic",
|
|
68
|
+
"plot_cv_r2",
|
|
69
|
+
"plot_mae_mse",
|
|
70
|
+
"plot_cv_metrics",
|
|
71
|
+
"plot_pair_grid_ref",
|
|
72
|
+
"plot_pair_grid_class",
|
|
73
|
+
"plot_corr_heatmap",
|
|
74
|
+
"plot_pair_grid_top_corr",
|
|
75
|
+
]
|