ml-experiment-framework 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 (59) hide show
  1. ml_experiment_framework-0.1.0/LICENSE +21 -0
  2. ml_experiment_framework-0.1.0/MANIFEST.in +4 -0
  3. ml_experiment_framework-0.1.0/PKG-INFO +273 -0
  4. ml_experiment_framework-0.1.0/README.md +235 -0
  5. ml_experiment_framework-0.1.0/configs/default.yaml +72 -0
  6. ml_experiment_framework-0.1.0/pyproject.toml +48 -0
  7. ml_experiment_framework-0.1.0/setup.cfg +4 -0
  8. ml_experiment_framework-0.1.0/src/__init__.py +3 -0
  9. ml_experiment_framework-0.1.0/src/data/__init__.py +6 -0
  10. ml_experiment_framework-0.1.0/src/data/loader.py +84 -0
  11. ml_experiment_framework-0.1.0/src/data/profiler.py +182 -0
  12. ml_experiment_framework-0.1.0/src/data/splitter.py +70 -0
  13. ml_experiment_framework-0.1.0/src/data/validator.py +106 -0
  14. ml_experiment_framework-0.1.0/src/detection/__init__.py +5 -0
  15. ml_experiment_framework-0.1.0/src/detection/decision_engine.py +355 -0
  16. ml_experiment_framework-0.1.0/src/detection/feature_types.py +284 -0
  17. ml_experiment_framework-0.1.0/src/detection/problem_type.py +125 -0
  18. ml_experiment_framework-0.1.0/src/detection/target.py +113 -0
  19. ml_experiment_framework-0.1.0/src/evaluation/__init__.py +5 -0
  20. ml_experiment_framework-0.1.0/src/evaluation/error_analysis.py +101 -0
  21. ml_experiment_framework-0.1.0/src/evaluation/evaluator.py +43 -0
  22. ml_experiment_framework-0.1.0/src/evaluation/metrics.py +121 -0
  23. ml_experiment_framework-0.1.0/src/evaluation/plots.py +73 -0
  24. ml_experiment_framework-0.1.0/src/experiments/__init__.py +5 -0
  25. ml_experiment_framework-0.1.0/src/experiments/reporter.py +131 -0
  26. ml_experiment_framework-0.1.0/src/experiments/runner.py +393 -0
  27. ml_experiment_framework-0.1.0/src/experiments/tracker.py +72 -0
  28. ml_experiment_framework-0.1.0/src/explainability/__init__.py +3 -0
  29. ml_experiment_framework-0.1.0/src/explainability/explainer.py +81 -0
  30. ml_experiment_framework-0.1.0/src/features/__init__.py +12 -0
  31. ml_experiment_framework-0.1.0/src/features/engineering.py +135 -0
  32. ml_experiment_framework-0.1.0/src/features/importance.py +45 -0
  33. ml_experiment_framework-0.1.0/src/features/selection.py +60 -0
  34. ml_experiment_framework-0.1.0/src/ml_experiment_framework.egg-info/PKG-INFO +273 -0
  35. ml_experiment_framework-0.1.0/src/ml_experiment_framework.egg-info/SOURCES.txt +57 -0
  36. ml_experiment_framework-0.1.0/src/ml_experiment_framework.egg-info/dependency_links.txt +1 -0
  37. ml_experiment_framework-0.1.0/src/ml_experiment_framework.egg-info/entry_points.txt +2 -0
  38. ml_experiment_framework-0.1.0/src/ml_experiment_framework.egg-info/requires.txt +19 -0
  39. ml_experiment_framework-0.1.0/src/ml_experiment_framework.egg-info/top_level.txt +12 -0
  40. ml_experiment_framework-0.1.0/src/models/__init__.py +3 -0
  41. ml_experiment_framework-0.1.0/src/models/registry.py +311 -0
  42. ml_experiment_framework-0.1.0/src/persistence/__init__.py +3 -0
  43. ml_experiment_framework-0.1.0/src/persistence/model_store.py +31 -0
  44. ml_experiment_framework-0.1.0/src/preprocessing/__init__.py +3 -0
  45. ml_experiment_framework-0.1.0/src/preprocessing/builder.py +158 -0
  46. ml_experiment_framework-0.1.0/src/preprocessing/categorical.py +39 -0
  47. ml_experiment_framework-0.1.0/src/preprocessing/numerical.py +33 -0
  48. ml_experiment_framework-0.1.0/src/preprocessing/target.py +80 -0
  49. ml_experiment_framework-0.1.0/src/preprocessing/transformers.py +61 -0
  50. ml_experiment_framework-0.1.0/src/training/__init__.py +13 -0
  51. ml_experiment_framework-0.1.0/src/training/baseline.py +54 -0
  52. ml_experiment_framework-0.1.0/src/training/cross_validation.py +141 -0
  53. ml_experiment_framework-0.1.0/src/training/trainer.py +72 -0
  54. ml_experiment_framework-0.1.0/src/training/tuning.py +129 -0
  55. ml_experiment_framework-0.1.0/src/utils/__init__.py +12 -0
  56. ml_experiment_framework-0.1.0/src/utils/config.py +60 -0
  57. ml_experiment_framework-0.1.0/src/utils/logging.py +34 -0
  58. ml_experiment_framework-0.1.0/src/utils/reproducibility.py +39 -0
  59. ml_experiment_framework-0.1.0/tests/test_core.py +150 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 [اسمك]
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,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include configs *.yaml
4
+ recursive-include src *.py
@@ -0,0 +1,273 @@
1
+ Metadata-Version: 2.4
2
+ Name: ml-experiment-framework
3
+ Version: 0.1.0
4
+ Summary: Dynamic, leakage-safe classic Machine Learning experimentation framework
5
+ Author-email: Taha Hussein <taha.hussein.two@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/اسمك/ml-experiment-framework
8
+ Project-URL: Repository, https://github.com/اسمك/ml-experiment-framework
9
+ Keywords: machine-learning,automl,tabular,scikit-learn,data-science
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: scikit-learn>=1.3.0
22
+ Requires-Dist: pandas>=2.0.0
23
+ Requires-Dist: numpy>=1.24.0
24
+ Requires-Dist: joblib>=1.3.0
25
+ Requires-Dist: PyYAML>=6.0
26
+ Requires-Dist: matplotlib>=3.7.0
27
+ Requires-Dist: seaborn>=0.12.0
28
+ Requires-Dist: scipy>=1.10.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0; extra == "dev"
31
+ Requires-Dist: build; extra == "dev"
32
+ Requires-Dist: twine; extra == "dev"
33
+ Provides-Extra: bayesian
34
+ Requires-Dist: optuna>=3.0; extra == "bayesian"
35
+ Provides-Extra: shap
36
+ Requires-Dist: shap>=0.42; extra == "shap"
37
+ Dynamic: license-file
38
+
39
+ # Classic Machine Learning Framework
40
+
41
+ A **dynamic, leakage-safe, production-oriented** classic ML experimentation framework built primarily on scikit-learn.
42
+
43
+ It behaves like a lightweight AutoML / ML experiment runner for **tabular** data:
44
+
45
+ - Automatically inspects data
46
+ - Detects problem type (binary / multiclass classification, regression)
47
+ - Detects feature types (numeric, categorical, boolean, datetime, ID-like, text-like, constant, high-missingness)
48
+ - Builds reasoned preprocessing pipelines
49
+ - Runs staged model selection (baseline → candidates → shortlist → tune)
50
+ - Evaluates on a held-out test set **once**
51
+ - Produces error analysis, feature importance, and a full experiment report
52
+
53
+ **Design priorities:** correctness, no data leakage, reproducibility, strong baselines, explainable decisions, maintainability, extensibility.
54
+
55
+ ---
56
+
57
+ ## Architecture
58
+
59
+ ```
60
+ ml_framework/
61
+ ├── main.py # CLI orchestration
62
+ ├── configs/default.yaml
63
+ ├── src/
64
+ │ ├── data/ # load, validate, profile, split
65
+ │ ├── detection/ # problem type, feature types, target, decision engine
66
+ │ ├── preprocessing/ # ColumnTransformer pipelines
67
+ │ ├── features/ # engineering / selection hooks
68
+ │ ├── models/ # extensible registry
69
+ │ ├── training/ # baseline, CV, tuning, final train
70
+ │ ├── evaluation/ # metrics, test eval, error analysis
71
+ │ ├── explainability/ # permutation (+ optional SHAP)
72
+ │ ├── experiments/ # runner + reporter
73
+ │ ├── persistence/ # joblib full-pipeline save/load
74
+ │ └── utils/ # logging, config, seeds
75
+ ├── artifacts/ # models, reports, plots
76
+ └── tests/
77
+ ```
78
+
79
+ Every major automatic choice is logged as:
80
+
81
+ | Field | Meaning |
82
+ |-------|---------|
83
+ | Decision | What was chosen |
84
+ | Reason | Why |
85
+ | Action | Concrete effect |
86
+ | Confidence | high / medium / low |
87
+
88
+ ---
89
+
90
+ ## Installation
91
+
92
+ ```bash
93
+ cd ml_framework
94
+ python -m venv .venv
95
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
96
+ pip install -r requirements.txt
97
+ ```
98
+
99
+ Python 3.11+ recommended.
100
+
101
+ ---
102
+
103
+ ## Quick start
104
+
105
+ ```bash
106
+ # Classification or regression — framework detects automatically
107
+ python main.py --data path/to/train.csv --target my_target
108
+
109
+ # Explicit problem type
110
+ python main.py --data train.csv --target SalePrice --problem-type regression
111
+
112
+ # External test set (Kaggle-style)
113
+ python main.py --train train.csv --test test.csv --target SalePrice
114
+
115
+ # Config file
116
+ python main.py --config configs/default.yaml --data train.csv --target y
117
+
118
+ # Disable tuning for a fast run
119
+ python main.py --data train.csv --target y --no-tuning
120
+ ```
121
+
122
+ ### Predict
123
+
124
+ ```bash
125
+ python main.py predict \
126
+ --model artifacts/models/best_model.joblib \
127
+ --data new_data.csv \
128
+ --output predictions.csv
129
+ ```
130
+
131
+ ### Profile only
132
+
133
+ ```bash
134
+ python main.py profile --data train.csv --target y
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Configuration
140
+
141
+ See `configs/default.yaml`. Important knobs:
142
+
143
+ - `problem.type`: `auto` | `binary_classification` | `multiclass_classification` | `regression`
144
+ - `split.test_size`, `random_state`
145
+ - `preprocessing.high_cardinality_threshold`, `missing_threshold`
146
+ - `models.include` / `exclude`
147
+ - `tuning.enabled`, `method` (`randomized_search` | `grid_search`), `n_iter`, `shortlist_size`
148
+ - `evaluation.primary_metric`: `auto` or sklearn scorer name / friendly alias (`rmse`, `f1`, `roc_auc`, …)
149
+ - `explainability.enabled`
150
+
151
+ CLI flags override YAML.
152
+
153
+ ---
154
+
155
+ ## Supported problems & models
156
+
157
+ **Problems:** binary classification, multiclass classification, regression.
158
+
159
+ **Models (registry):** LogisticRegression, RidgeClassifier, DecisionTree, RandomForest, ExtraTrees, HistGradientBoosting, GradientBoosting, SVC, KNeighbors (classification); LinearRegression, Ridge, Lasso, ElasticNet, DecisionTree, RandomForest, ExtraTrees, HistGradientBoosting, GradientBoosting, SVR, KNeighbors (regression).
160
+
161
+ The **Decision Engine** selects a small candidate set based on dataset size and feature mix — it does **not** brute-force every model.
162
+
163
+ ---
164
+
165
+ ## How leakage is prevented
166
+
167
+ 1. Train/test **split happens before any fit**.
168
+ 2. All imputation, scaling, encoding live inside an sklearn `Pipeline` + `ColumnTransformer`.
169
+ 3. CV and tuning operate on the full pipeline (preprocess + model).
170
+ 4. Final metrics are computed **once** on the untouched test set.
171
+ 5. Model selection uses CV scores, never test scores.
172
+ 6. External test sets are never used during training or tuning.
173
+
174
+ ---
175
+
176
+ ## Extensibility
177
+
178
+ ### Add a model
179
+
180
+ ```python
181
+ from src.models.registry import register_model
182
+ from sklearn.ensemble import AdaBoostClassifier
183
+
184
+ register_model(
185
+ "AdaBoostClassifier",
186
+ AdaBoostClassifier,
187
+ problem_types=["binary_classification", "multiclass_classification"],
188
+ default_params={"random_state": 42},
189
+ search_space={"n_estimators": [50, 100, 200]},
190
+ )
191
+ ```
192
+
193
+ ### Add a data loader
194
+
195
+ ```python
196
+ from src.data.loader import register_loader
197
+
198
+ @register_loader("feather")
199
+ def load_feather(path):
200
+ import pandas as pd
201
+ return pd.read_feather(path)
202
+ ```
203
+
204
+ ### Custom metric
205
+
206
+ Pass `--metric my_scorer` if registered with sklearn, or set `evaluation.primary_metric` in YAML.
207
+
208
+ ---
209
+
210
+ ## Output structure
211
+
212
+ ```
213
+ artifacts/
214
+ ├── models/best_model.joblib # full pipeline
215
+ ├── reports/
216
+ │ ├── final_report.json
217
+ │ └── final_report.html
218
+ └── plots/
219
+ ├── target_distribution.png
220
+ ├── missing_heatmap.png
221
+ ├── correlation_heatmap.png
222
+ └── residuals.png # regression
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Example summary output
228
+
229
+ ```
230
+ ============================================================
231
+ ML EXPERIMENT COMPLETE
232
+ ============================================================
233
+
234
+ Problem: Regression
235
+ Dataset: 1460 rows × 81 columns
236
+ Train: 1168 rows
237
+ Test: 292 rows
238
+ Primary Metric: RMSE
239
+ Baseline: -0.42
240
+ Best Model: HistGradientBoostingRegressor
241
+ CV: -0.251 ± 0.009
242
+ Test rmse: 0.237
243
+ Test mae: 0.164
244
+ Test r2: 0.891
245
+ Model saved: artifacts/models/best_model.joblib
246
+ Report: artifacts/reports/final_report.html
247
+ ============================================================
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Limitations
253
+
254
+ - Classic tabular ML only (no deep learning, no raw text/image models).
255
+ - Text-like columns are detected and dropped with a clear message.
256
+ - Very high-cardinality categoricals use OrdinalEncoder (not target encoding) to avoid leakage.
257
+ - Bayesian optimization / SHAP are optional extras.
258
+ - Not a guarantee of the globally optimal model — it aims for strong, reproducible baselines with transparent decisions.
259
+
260
+ ---
261
+
262
+ ## Tests
263
+
264
+ ```bash
265
+ cd ml_framework
266
+ pytest tests/ -q
267
+ ```
268
+
269
+ ---
270
+
271
+ ## License
272
+
273
+ MIT-style — use freely in research and production prototypes.
@@ -0,0 +1,235 @@
1
+ # Classic Machine Learning Framework
2
+
3
+ A **dynamic, leakage-safe, production-oriented** classic ML experimentation framework built primarily on scikit-learn.
4
+
5
+ It behaves like a lightweight AutoML / ML experiment runner for **tabular** data:
6
+
7
+ - Automatically inspects data
8
+ - Detects problem type (binary / multiclass classification, regression)
9
+ - Detects feature types (numeric, categorical, boolean, datetime, ID-like, text-like, constant, high-missingness)
10
+ - Builds reasoned preprocessing pipelines
11
+ - Runs staged model selection (baseline → candidates → shortlist → tune)
12
+ - Evaluates on a held-out test set **once**
13
+ - Produces error analysis, feature importance, and a full experiment report
14
+
15
+ **Design priorities:** correctness, no data leakage, reproducibility, strong baselines, explainable decisions, maintainability, extensibility.
16
+
17
+ ---
18
+
19
+ ## Architecture
20
+
21
+ ```
22
+ ml_framework/
23
+ ├── main.py # CLI orchestration
24
+ ├── configs/default.yaml
25
+ ├── src/
26
+ │ ├── data/ # load, validate, profile, split
27
+ │ ├── detection/ # problem type, feature types, target, decision engine
28
+ │ ├── preprocessing/ # ColumnTransformer pipelines
29
+ │ ├── features/ # engineering / selection hooks
30
+ │ ├── models/ # extensible registry
31
+ │ ├── training/ # baseline, CV, tuning, final train
32
+ │ ├── evaluation/ # metrics, test eval, error analysis
33
+ │ ├── explainability/ # permutation (+ optional SHAP)
34
+ │ ├── experiments/ # runner + reporter
35
+ │ ├── persistence/ # joblib full-pipeline save/load
36
+ │ └── utils/ # logging, config, seeds
37
+ ├── artifacts/ # models, reports, plots
38
+ └── tests/
39
+ ```
40
+
41
+ Every major automatic choice is logged as:
42
+
43
+ | Field | Meaning |
44
+ |-------|---------|
45
+ | Decision | What was chosen |
46
+ | Reason | Why |
47
+ | Action | Concrete effect |
48
+ | Confidence | high / medium / low |
49
+
50
+ ---
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ cd ml_framework
56
+ python -m venv .venv
57
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
58
+ pip install -r requirements.txt
59
+ ```
60
+
61
+ Python 3.11+ recommended.
62
+
63
+ ---
64
+
65
+ ## Quick start
66
+
67
+ ```bash
68
+ # Classification or regression — framework detects automatically
69
+ python main.py --data path/to/train.csv --target my_target
70
+
71
+ # Explicit problem type
72
+ python main.py --data train.csv --target SalePrice --problem-type regression
73
+
74
+ # External test set (Kaggle-style)
75
+ python main.py --train train.csv --test test.csv --target SalePrice
76
+
77
+ # Config file
78
+ python main.py --config configs/default.yaml --data train.csv --target y
79
+
80
+ # Disable tuning for a fast run
81
+ python main.py --data train.csv --target y --no-tuning
82
+ ```
83
+
84
+ ### Predict
85
+
86
+ ```bash
87
+ python main.py predict \
88
+ --model artifacts/models/best_model.joblib \
89
+ --data new_data.csv \
90
+ --output predictions.csv
91
+ ```
92
+
93
+ ### Profile only
94
+
95
+ ```bash
96
+ python main.py profile --data train.csv --target y
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Configuration
102
+
103
+ See `configs/default.yaml`. Important knobs:
104
+
105
+ - `problem.type`: `auto` | `binary_classification` | `multiclass_classification` | `regression`
106
+ - `split.test_size`, `random_state`
107
+ - `preprocessing.high_cardinality_threshold`, `missing_threshold`
108
+ - `models.include` / `exclude`
109
+ - `tuning.enabled`, `method` (`randomized_search` | `grid_search`), `n_iter`, `shortlist_size`
110
+ - `evaluation.primary_metric`: `auto` or sklearn scorer name / friendly alias (`rmse`, `f1`, `roc_auc`, …)
111
+ - `explainability.enabled`
112
+
113
+ CLI flags override YAML.
114
+
115
+ ---
116
+
117
+ ## Supported problems & models
118
+
119
+ **Problems:** binary classification, multiclass classification, regression.
120
+
121
+ **Models (registry):** LogisticRegression, RidgeClassifier, DecisionTree, RandomForest, ExtraTrees, HistGradientBoosting, GradientBoosting, SVC, KNeighbors (classification); LinearRegression, Ridge, Lasso, ElasticNet, DecisionTree, RandomForest, ExtraTrees, HistGradientBoosting, GradientBoosting, SVR, KNeighbors (regression).
122
+
123
+ The **Decision Engine** selects a small candidate set based on dataset size and feature mix — it does **not** brute-force every model.
124
+
125
+ ---
126
+
127
+ ## How leakage is prevented
128
+
129
+ 1. Train/test **split happens before any fit**.
130
+ 2. All imputation, scaling, encoding live inside an sklearn `Pipeline` + `ColumnTransformer`.
131
+ 3. CV and tuning operate on the full pipeline (preprocess + model).
132
+ 4. Final metrics are computed **once** on the untouched test set.
133
+ 5. Model selection uses CV scores, never test scores.
134
+ 6. External test sets are never used during training or tuning.
135
+
136
+ ---
137
+
138
+ ## Extensibility
139
+
140
+ ### Add a model
141
+
142
+ ```python
143
+ from src.models.registry import register_model
144
+ from sklearn.ensemble import AdaBoostClassifier
145
+
146
+ register_model(
147
+ "AdaBoostClassifier",
148
+ AdaBoostClassifier,
149
+ problem_types=["binary_classification", "multiclass_classification"],
150
+ default_params={"random_state": 42},
151
+ search_space={"n_estimators": [50, 100, 200]},
152
+ )
153
+ ```
154
+
155
+ ### Add a data loader
156
+
157
+ ```python
158
+ from src.data.loader import register_loader
159
+
160
+ @register_loader("feather")
161
+ def load_feather(path):
162
+ import pandas as pd
163
+ return pd.read_feather(path)
164
+ ```
165
+
166
+ ### Custom metric
167
+
168
+ Pass `--metric my_scorer` if registered with sklearn, or set `evaluation.primary_metric` in YAML.
169
+
170
+ ---
171
+
172
+ ## Output structure
173
+
174
+ ```
175
+ artifacts/
176
+ ├── models/best_model.joblib # full pipeline
177
+ ├── reports/
178
+ │ ├── final_report.json
179
+ │ └── final_report.html
180
+ └── plots/
181
+ ├── target_distribution.png
182
+ ├── missing_heatmap.png
183
+ ├── correlation_heatmap.png
184
+ └── residuals.png # regression
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Example summary output
190
+
191
+ ```
192
+ ============================================================
193
+ ML EXPERIMENT COMPLETE
194
+ ============================================================
195
+
196
+ Problem: Regression
197
+ Dataset: 1460 rows × 81 columns
198
+ Train: 1168 rows
199
+ Test: 292 rows
200
+ Primary Metric: RMSE
201
+ Baseline: -0.42
202
+ Best Model: HistGradientBoostingRegressor
203
+ CV: -0.251 ± 0.009
204
+ Test rmse: 0.237
205
+ Test mae: 0.164
206
+ Test r2: 0.891
207
+ Model saved: artifacts/models/best_model.joblib
208
+ Report: artifacts/reports/final_report.html
209
+ ============================================================
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Limitations
215
+
216
+ - Classic tabular ML only (no deep learning, no raw text/image models).
217
+ - Text-like columns are detected and dropped with a clear message.
218
+ - Very high-cardinality categoricals use OrdinalEncoder (not target encoding) to avoid leakage.
219
+ - Bayesian optimization / SHAP are optional extras.
220
+ - Not a guarantee of the globally optimal model — it aims for strong, reproducible baselines with transparent decisions.
221
+
222
+ ---
223
+
224
+ ## Tests
225
+
226
+ ```bash
227
+ cd ml_framework
228
+ pytest tests/ -q
229
+ ```
230
+
231
+ ---
232
+
233
+ ## License
234
+
235
+ MIT-style — use freely in research and production prototypes.
@@ -0,0 +1,72 @@
1
+ data:
2
+ path: null
3
+ train_path: null
4
+ test_path: null
5
+ target: null
6
+ id_columns: []
7
+
8
+ problem:
9
+ type: auto # auto | binary_classification | multiclass_classification | regression
10
+
11
+ split:
12
+ test_size: 0.2
13
+ random_state: 42
14
+ stratify: auto
15
+
16
+ preprocessing:
17
+ automatic: true
18
+ scaling: auto # auto | always | never
19
+ encoding: auto # auto | onehot | ordinal
20
+ imputation: auto
21
+ high_cardinality_threshold: 50
22
+ missing_threshold: 0.95
23
+ near_constant_threshold: 0.99
24
+
25
+ feature_engineering:
26
+ enabled: true
27
+ automatic: true
28
+ max_interactions: 0
29
+ max_ratio_pairs: 0 # set >0 to add limited numeric ratios (kept small on purpose)
30
+ date_components: true
31
+ log_skew_threshold: 1.5
32
+
33
+ models:
34
+ automatic_selection: true
35
+ include: null # list of model names or null for auto
36
+ exclude: []
37
+
38
+ cross_validation:
39
+ enabled: true
40
+ folds: 5
41
+ shuffle: true
42
+ random_state: 42
43
+
44
+ tuning:
45
+ enabled: true
46
+ method: randomized_search # grid_search | randomized_search | bayesian
47
+ n_iter: 20
48
+ cv_folds: 3
49
+ n_jobs: -1
50
+ shortlist_size: 2
51
+
52
+ target_transform:
53
+ mode: auto # auto | log1p | log | none
54
+ skew_threshold: 1.0 # used when mode=auto (regression only)
55
+
56
+ evaluation:
57
+ primary_metric: auto
58
+ secondary_metrics: auto
59
+
60
+ explainability:
61
+ enabled: true
62
+ permutation_importance: true
63
+ shap: false
64
+
65
+ artifacts:
66
+ directory: artifacts/
67
+
68
+ logging:
69
+ level: INFO
70
+
71
+ reproducibility:
72
+ random_state: 42
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ml-experiment-framework"
7
+ version = "0.1.0"
8
+ description = "Dynamic, leakage-safe classic Machine Learning experimentation framework"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Taha Hussein", email = "taha.hussein.two@example.com"}
14
+ ]
15
+ keywords = ["machine-learning", "automl", "tabular", "scikit-learn", "data-science"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
25
+ ]
26
+
27
+ dependencies = [
28
+ "scikit-learn>=1.3.0",
29
+ "pandas>=2.0.0",
30
+ "numpy>=1.24.0",
31
+ "joblib>=1.3.0",
32
+ "PyYAML>=6.0",
33
+ "matplotlib>=3.7.0",
34
+ "seaborn>=0.12.0",
35
+ "scipy>=1.10.0",
36
+ ]
37
+
38
+ [project.optional-dependencies]
39
+ dev = ["pytest>=7.0", "build", "twine"]
40
+ bayesian = ["optuna>=3.0"]
41
+ shap = ["shap>=0.42"]
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/اسمك/ml-experiment-framework"
45
+ Repository = "https://github.com/اسمك/ml-experiment-framework"
46
+
47
+ [project.scripts]
48
+ ml-experiment = "main:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Classic Machine Learning Framework - dynamic, leakage-safe AutoML-style experimentation."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ from .loader import load_dataset
2
+ from .validator import validate_dataset
3
+ from .profiler import profile_dataset
4
+ from .splitter import split_data
5
+
6
+ __all__ = ["load_dataset", "validate_dataset", "profile_dataset", "split_data"]