autodatamining 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 (51) hide show
  1. autodatamining-0.1.0/.github/workflows/publish.yml +22 -0
  2. autodatamining-0.1.0/.github/workflows/tests.yml +25 -0
  3. autodatamining-0.1.0/CHANGELOG.md +7 -0
  4. autodatamining-0.1.0/CONTRIBUTING.md +9 -0
  5. autodatamining-0.1.0/LICENSE +21 -0
  6. autodatamining-0.1.0/MANIFEST.in +4 -0
  7. autodatamining-0.1.0/PKG-INFO +253 -0
  8. autodatamining-0.1.0/README.md +218 -0
  9. autodatamining-0.1.0/build.md +449 -0
  10. autodatamining-0.1.0/docs/anomaly_detection.md +5 -0
  11. autodatamining-0.1.0/docs/classification.md +11 -0
  12. autodatamining-0.1.0/docs/clustering.md +9 -0
  13. autodatamining-0.1.0/docs/custom_estimators.md +15 -0
  14. autodatamining-0.1.0/docs/explainability.md +5 -0
  15. autodatamining-0.1.0/docs/installation.md +15 -0
  16. autodatamining-0.1.0/docs/regression.md +9 -0
  17. autodatamining-0.1.0/examples/anomaly_detection.py +17 -0
  18. autodatamining-0.1.0/examples/classification.py +13 -0
  19. autodatamining-0.1.0/examples/clustering.py +12 -0
  20. autodatamining-0.1.0/examples/regression.py +13 -0
  21. autodatamining-0.1.0/pyproject.toml +49 -0
  22. autodatamining-0.1.0/setup.cfg +4 -0
  23. autodatamining-0.1.0/src/autodatamining/__init__.py +35 -0
  24. autodatamining-0.1.0/src/autodatamining/config.py +29 -0
  25. autodatamining-0.1.0/src/autodatamining/core.py +463 -0
  26. autodatamining-0.1.0/src/autodatamining/detection.py +124 -0
  27. autodatamining-0.1.0/src/autodatamining/evaluation.py +99 -0
  28. autodatamining-0.1.0/src/autodatamining/exceptions.py +21 -0
  29. autodatamining-0.1.0/src/autodatamining/explainability.py +79 -0
  30. autodatamining-0.1.0/src/autodatamining/persistence.py +45 -0
  31. autodatamining-0.1.0/src/autodatamining/preprocessing.py +85 -0
  32. autodatamining-0.1.0/src/autodatamining/registry.py +159 -0
  33. autodatamining-0.1.0/src/autodatamining/reporting.py +34 -0
  34. autodatamining-0.1.0/src/autodatamining/results.py +134 -0
  35. autodatamining-0.1.0/src/autodatamining/version.py +3 -0
  36. autodatamining-0.1.0/src/autodatamining/visualization.py +100 -0
  37. autodatamining-0.1.0/src/autodatamining.egg-info/PKG-INFO +253 -0
  38. autodatamining-0.1.0/src/autodatamining.egg-info/SOURCES.txt +49 -0
  39. autodatamining-0.1.0/src/autodatamining.egg-info/dependency_links.txt +1 -0
  40. autodatamining-0.1.0/src/autodatamining.egg-info/requires.txt +16 -0
  41. autodatamining-0.1.0/src/autodatamining.egg-info/top_level.txt +1 -0
  42. autodatamining-0.1.0/tests/test_anomaly_detection.py +36 -0
  43. autodatamining-0.1.0/tests/test_classification.py +56 -0
  44. autodatamining-0.1.0/tests/test_clustering.py +13 -0
  45. autodatamining-0.1.0/tests/test_evaluation.py +19 -0
  46. autodatamining-0.1.0/tests/test_persistence.py +17 -0
  47. autodatamining-0.1.0/tests/test_preprocessing.py +19 -0
  48. autodatamining-0.1.0/tests/test_registry.py +51 -0
  49. autodatamining-0.1.0/tests/test_regression.py +16 -0
  50. autodatamining-0.1.0/tests/test_reporting.py +19 -0
  51. autodatamining-0.1.0/tests/test_visualization.py +17 -0
@@ -0,0 +1,22 @@
1
+ name: publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+ - run: python -m pip install build twine
20
+ - run: python -m build
21
+ - run: python -m twine check dist/*
22
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,25 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ cache: pip
20
+ - run: python -m pip install -e ".[dev,visualization]"
21
+ - run: python -m compileall -q src tests
22
+ - run: python -m ruff check src tests examples
23
+ - run: python -m pytest -q --cov=autodatamining --cov-report=term-missing
24
+ - run: python -m build
25
+ - run: python -m twine check dist/*
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — unreleased
4
+
5
+ - Initial modular library for classification, regression, clustering, and anomaly detection.
6
+ - Added registry, mixed tabular preprocessing, evaluation, reports, explainability, and persistence.
7
+ - Alpha API; package has not been published.
@@ -0,0 +1,9 @@
1
+ # Contributing
2
+
3
+ 1. Create a virtual environment and install `python -m pip install -e ".[dev,visualization]"`.
4
+ 2. Keep task-specific code modular and preserve train/test separation and fold-local preprocessing.
5
+ 3. Add or update tests for behavior and edge cases.
6
+ 4. Run `python -m compileall -q src tests`, `python -m ruff check src tests examples`, `python -m pytest -q`, `python -m build`, and `python -m twine check dist/*`.
7
+ 5. Update README/docs and CHANGELOG when public behavior changes.
8
+
9
+ Please check third-party dependency licenses and preserve attribution. Do not include user datasets, credentials, or generated model artifacts in pull requests. The current API is alpha and may change before a stable release.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AutoDataMining contributors
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 LICENSE CHANGELOG.md CONTRIBUTING.md build.md
2
+ recursive-include docs *.md
3
+ recursive-include examples *.py
4
+ recursive-include .github/workflows *.yml
@@ -0,0 +1,253 @@
1
+ Metadata-Version: 2.4
2
+ Name: autodatamining
3
+ Version: 0.1.0
4
+ Summary: A consistent, transparent scikit-learn based data mining workflow.
5
+ Author: AutoDataMining contributors
6
+ License-Expression: MIT
7
+ Keywords: machine-learning,data-mining,automl,scikit-learn
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Education
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
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.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy>=1.22
22
+ Requires-Dist: pandas>=1.4
23
+ Requires-Dist: scikit-learn>=1.2
24
+ Provides-Extra: visualization
25
+ Requires-Dist: matplotlib>=3.5; extra == "visualization"
26
+ Provides-Extra: explainability
27
+ Requires-Dist: shap>=0.42; extra == "explainability"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4; extra == "dev"
31
+ Requires-Dist: build>=1; extra == "dev"
32
+ Requires-Dist: twine>=4; extra == "dev"
33
+ Requires-Dist: ruff>=0.4; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # AutoDataMining
37
+
38
+ **AutoDataMining** is a Python library for running consistent, inspectable data mining experiments with scikit-learn. It brings preprocessing, model comparison, evaluation, simple explanations, reports, and model persistence behind one API. It integrates existing estimators; it does not introduce new machine learning algorithms.
39
+
40
+ > **Status: alpha (0.1.0).** The public API may change. Benchmark results depend on the dataset, split, metric, and estimator settings, and are not a guarantee of future performance. Review results before using a model in a consequential setting.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ python -m pip install autodatamining
46
+ ```
47
+
48
+ For plots and optional SHAP explanations:
49
+
50
+ ```bash
51
+ python -m pip install "autodatamining[visualization,explainability]"
52
+ ```
53
+
54
+ ## Quick start: classification
55
+
56
+ ```python
57
+ import pandas as pd
58
+ from autodatamining import AutoDataMining
59
+
60
+ data = pd.read_csv("dataset.csv")
61
+ results = AutoDataMining(
62
+ task="classification",
63
+ target="label",
64
+ test_size=0.2,
65
+ cv=5,
66
+ random_state=42,
67
+ scoring="f1_weighted",
68
+ models=["logistic_regression", "random_forest"],
69
+ ).fit(data)
70
+
71
+ print(results.leaderboard)
72
+ print(results.best_model)
73
+ print(results.metrics) # holdout metrics, plus CV score and fit time
74
+ results.plot()
75
+ results.report("classification-report.html")
76
+ results.save("best-model.joblib")
77
+ ```
78
+
79
+ `leaderboard.cv_score` is calculated only on training folds. Other task metrics such as `accuracy`, `f1_weighted`, and `roc_auc` are holdout test values. The holdout is not used for selection when valid cross-validation scores exist.
80
+
81
+ ## Other tasks
82
+
83
+ ### Regression
84
+
85
+ ```python
86
+ results = AutoDataMining(
87
+ task="regression", target="price", cv=5, random_state=42,
88
+ models=["ridge", "random_forest", "hist_gradient_boosting"],
89
+ ).fit(data)
90
+ print(results.leaderboard[["model", "cv_score", "mae", "rmse", "r2", "status"]])
91
+ ```
92
+
93
+ ### Clustering
94
+
95
+ ```python
96
+ results = AutoDataMining(
97
+ task="clustering", models=["kmeans", "dbscan", "agglomerative"], random_state=42,
98
+ ).fit(features)
99
+ print(results.leaderboard)
100
+ print(results.labels) # labels from the selected model
101
+ ```
102
+
103
+ The selected clustering model is ranked by silhouette score when that score is defined. Silhouette, Davies–Bouldin, and Calinski–Harabasz are internal measures, not accuracy against known classes. DBSCAN noise points have label `-1`.
104
+
105
+ ### Anomaly detection
106
+
107
+ ```python
108
+ results = AutoDataMining(
109
+ task="anomaly", models=["isolation_forest", "lof"], random_state=42,
110
+ ).fit(features)
111
+ print(results.leaderboard) # anomaly_rate and anomaly_count
112
+ print(results.labels) # -1 is an anomaly; +1 is an inlier
113
+ ```
114
+
115
+ Without ground-truth labels, anomaly rate describes how many rows were flagged; it cannot rank model quality. If labels are available, pass their column as `target` and encode anomalies as `1`/`True` and normal rows as `0`/`False`. The runner excludes that target from the features, selects using stratified training-fold F1, and reports holdout precision, recall, F1, and AUC where defined. In labeled mode, `results.labels` contains selected-model holdout predictions; without labels, it contains fit-set detections.
116
+
117
+ ## Algorithms and metrics
118
+
119
+ | Task | Built-in estimators | Default comparison score |
120
+ | --- | --- | --- |
121
+ | Classification | Logistic Regression, Decision Tree, Random Forest, Extra Trees, Gradient Boosting, HistGradientBoosting, KNN, Gaussian Naive Bayes, SVM | Accuracy (training CV) |
122
+ | Regression | Linear Regression, Ridge, Lasso, Decision Tree, Random Forest, Extra Trees, Gradient Boosting, HistGradientBoosting, KNN, SVR | R² (training CV) |
123
+ | Clustering | K-Means, MiniBatch K-Means, DBSCAN, Agglomerative, Gaussian Mixture | Silhouette |
124
+ | Anomaly | Isolation Forest, Local Outlier Factor, One-Class SVM | Labeled F1 when labels are supplied; otherwise no quality ranking |
125
+
126
+ Classification holdout metrics include accuracy, balanced accuracy, weighted precision/recall/F1, and ROC-AUC / PR-AUC when the estimator and test labels support them. Regression reports MAE, MSE, RMSE, and R². Clustering reports silhouette, Davies–Bouldin, and Calinski–Harabasz when defined. Individual estimator failures are recorded in the leaderboard; successful models remain usable.
127
+
128
+ ## Automatic task detection and data profile
129
+
130
+ `task="auto"` requires a target column. Text-like targets are treated as classification; small-cardinality integer targets are treated as classification; other numeric targets are treated as regression. Ambiguous low-cardinality numeric targets emit a warning. Pass `task` explicitly when the heuristic is not appropriate. Auto mode never silently launches clustering.
131
+
132
+ ```python
133
+ from autodatamining import AutoDataMining
134
+
135
+ profile = AutoDataMining.profile(data, target="label")
136
+ print(profile["potential_issues"])
137
+ ```
138
+
139
+ The profile includes row and column counts, per-column type, missing count and cardinality, duplicate rows, and a target distribution. It does not diagnose leakage or establish that a metric is suitable for a research question.
140
+
141
+ ## Advanced usage
142
+
143
+ ### Custom estimators
144
+
145
+ ```python
146
+ from sklearn.linear_model import SGDClassifier
147
+ from autodatamining import AutoDataMining, EstimatorRegistry
148
+
149
+ registry = EstimatorRegistry()
150
+ registry.register("fast_sgd", SGDClassifier, tasks="classification",
151
+ params={"max_iter": 2000, "tol": 1e-3})
152
+ results = AutoDataMining(
153
+ task="classification", target="label", registry=registry,
154
+ models=["fast_sgd"], cv=3,
155
+ ).fit(data)
156
+ ```
157
+
158
+ Use unique names and register only estimators compatible with the declared task. Estimators are cloned before fitting. Model-specific parameters can be supplied with `model_params={"fast_sgd": {"alpha": 0.001}}`.
159
+
160
+ The module-level `register_estimator(name, estimator, tasks, params=None)` adds an estimator to the shared default registry for later runs.
161
+
162
+ ### Feature selection and dimensionality reduction
163
+
164
+ ```python
165
+ from autodatamining import select_features, reduce_dimensions
166
+
167
+ selected, selector = select_features(numeric_features, y, method="mutual_information",
168
+ task="classification", k=5)
169
+ embedding, pca = reduce_dimensions(numeric_features, method="pca", n_components=2)
170
+ ```
171
+
172
+ These convenience helpers fit directly to the data passed to them. For scientific evaluation, put selection or reduction inside a cross-validation `Pipeline` so each fold learns its transform from training data only.
173
+
174
+ ### Explainability
175
+
176
+ ```python
177
+ importance = results.explain(method="auto")
178
+ ```
179
+
180
+ Auto mode uses native tree importance or absolute coefficient magnitude where available, then falls back to holdout permutation importance for supervised tasks. `method="shap"` requires the optional extra. Importance describes model behavior and is not causal evidence. Unsupervised feature importance is not inferred.
181
+
182
+ ### Plots, reports, and CSV
183
+
184
+ ```python
185
+ results.plot(kind="leaderboard")
186
+ results.plot(kind="confusion_matrix") # classification
187
+ results.plot(kind="roc_curve") # binary classification
188
+ results.plot(kind="precision_recall_curve") # binary classification
189
+ results.plot(kind="residuals") # regression
190
+ results.plot(kind="clusters") # clustering
191
+ print(results.classification_report())
192
+ results.to_csv("leaderboard.csv")
193
+ results.report("experiment.html")
194
+ ```
195
+
196
+ Plots need `autodatamining[visualization]`. HTML reports include experiment metadata, metrics, leaderboard, and evaluation limitations; dataset rows are not included.
197
+
198
+ ### Save and load
199
+
200
+ ```python
201
+ from autodatamining import load_model
202
+
203
+ results.save("model.joblib")
204
+ model = load_model("model.joblib")
205
+ predictions = model.predict(new_data)
206
+ ```
207
+
208
+ Prediction validates feature names and permits incoming DataFrame columns in a different order. Missing or unexpected columns raise an error. A joblib/pickle artifact can execute code when loaded: only load files from a trusted source. Artifacts record the scikit-learn version; cross-version compatibility is not guaranteed.
209
+
210
+ ## Evaluation notes
211
+
212
+ - Supervised evaluation uses a train/test split and cross-validation on the training partition. Preprocessing is in the estimator pipeline and is fitted independently inside each fold.
213
+ - Classification uses stratification where class counts allow. Very small classes can prevent stratification or CV; the runner warns and reports what it could evaluate.
214
+ - CV score selects the supervised model when available. Holdout metrics are reported separately and should not be used repeatedly to tune the experiment.
215
+ - Clustering and unlabeled anomaly detection do not have ground-truth accuracy. Internal scores and anomaly rates have narrower meanings.
216
+ - Compare models using a metric tied to the intended use, and assess class imbalance, data leakage, temporal or grouped splits, calibration, latency, and deployment data drift separately.
217
+ - A top score in one experiment is not necessarily the best model for all datasets or real-world use.
218
+
219
+ ## Troubleshooting
220
+
221
+ - **`task='auto' requires a target column`**: pass a target or explicitly choose clustering/anomaly.
222
+ - **A requested estimator failed**: inspect its `status` and `error` in `results.leaderboard`; try fewer parameters or another model.
223
+ - **Feature columns do not match**: supply the same feature names as training; DataFrame column order may differ.
224
+ - **A score is missing/NaN**: some metrics need multiple target classes or at least two non-noise clusters.
225
+ - **Plotting or SHAP import error**: install the corresponding optional extra.
226
+
227
+ ## Development
228
+
229
+ ```bash
230
+ python -m pip install -e ".[dev,visualization]"
231
+ python -m compileall -q src tests
232
+ python -m ruff check src tests examples
233
+ python -m pytest -q
234
+ python -m build
235
+ python -m twine check dist/*
236
+ ```
237
+
238
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [CHANGELOG.md](CHANGELOG.md). Contributions should include tests for changed behavior and preserve the distinction between training CV and holdout evaluation.
239
+
240
+ ## PyPI release checklist
241
+
242
+ 1. Review source, dependency licenses, project ownership, name availability, and version.
243
+ 2. Run the test suite and build checks above.
244
+ 3. Inspect wheel and source distribution contents.
245
+ 4. Upload to TestPyPI and install into a clean virtual environment.
246
+ 5. Publish to PyPI using an API token held outside the source tree or trusted publishing.
247
+ 6. Verify the published install and create a version tag.
248
+
249
+ The project has not been published by this repository setup. Name availability and legal attribution must be checked again at release time. No credentials belong in the repository.
250
+
251
+ ## License
252
+
253
+ MIT; see [LICENSE](LICENSE). Review ownership and attribution before the first release.
@@ -0,0 +1,218 @@
1
+ # AutoDataMining
2
+
3
+ **AutoDataMining** is a Python library for running consistent, inspectable data mining experiments with scikit-learn. It brings preprocessing, model comparison, evaluation, simple explanations, reports, and model persistence behind one API. It integrates existing estimators; it does not introduce new machine learning algorithms.
4
+
5
+ > **Status: alpha (0.1.0).** The public API may change. Benchmark results depend on the dataset, split, metric, and estimator settings, and are not a guarantee of future performance. Review results before using a model in a consequential setting.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ python -m pip install autodatamining
11
+ ```
12
+
13
+ For plots and optional SHAP explanations:
14
+
15
+ ```bash
16
+ python -m pip install "autodatamining[visualization,explainability]"
17
+ ```
18
+
19
+ ## Quick start: classification
20
+
21
+ ```python
22
+ import pandas as pd
23
+ from autodatamining import AutoDataMining
24
+
25
+ data = pd.read_csv("dataset.csv")
26
+ results = AutoDataMining(
27
+ task="classification",
28
+ target="label",
29
+ test_size=0.2,
30
+ cv=5,
31
+ random_state=42,
32
+ scoring="f1_weighted",
33
+ models=["logistic_regression", "random_forest"],
34
+ ).fit(data)
35
+
36
+ print(results.leaderboard)
37
+ print(results.best_model)
38
+ print(results.metrics) # holdout metrics, plus CV score and fit time
39
+ results.plot()
40
+ results.report("classification-report.html")
41
+ results.save("best-model.joblib")
42
+ ```
43
+
44
+ `leaderboard.cv_score` is calculated only on training folds. Other task metrics such as `accuracy`, `f1_weighted`, and `roc_auc` are holdout test values. The holdout is not used for selection when valid cross-validation scores exist.
45
+
46
+ ## Other tasks
47
+
48
+ ### Regression
49
+
50
+ ```python
51
+ results = AutoDataMining(
52
+ task="regression", target="price", cv=5, random_state=42,
53
+ models=["ridge", "random_forest", "hist_gradient_boosting"],
54
+ ).fit(data)
55
+ print(results.leaderboard[["model", "cv_score", "mae", "rmse", "r2", "status"]])
56
+ ```
57
+
58
+ ### Clustering
59
+
60
+ ```python
61
+ results = AutoDataMining(
62
+ task="clustering", models=["kmeans", "dbscan", "agglomerative"], random_state=42,
63
+ ).fit(features)
64
+ print(results.leaderboard)
65
+ print(results.labels) # labels from the selected model
66
+ ```
67
+
68
+ The selected clustering model is ranked by silhouette score when that score is defined. Silhouette, Davies–Bouldin, and Calinski–Harabasz are internal measures, not accuracy against known classes. DBSCAN noise points have label `-1`.
69
+
70
+ ### Anomaly detection
71
+
72
+ ```python
73
+ results = AutoDataMining(
74
+ task="anomaly", models=["isolation_forest", "lof"], random_state=42,
75
+ ).fit(features)
76
+ print(results.leaderboard) # anomaly_rate and anomaly_count
77
+ print(results.labels) # -1 is an anomaly; +1 is an inlier
78
+ ```
79
+
80
+ Without ground-truth labels, anomaly rate describes how many rows were flagged; it cannot rank model quality. If labels are available, pass their column as `target` and encode anomalies as `1`/`True` and normal rows as `0`/`False`. The runner excludes that target from the features, selects using stratified training-fold F1, and reports holdout precision, recall, F1, and AUC where defined. In labeled mode, `results.labels` contains selected-model holdout predictions; without labels, it contains fit-set detections.
81
+
82
+ ## Algorithms and metrics
83
+
84
+ | Task | Built-in estimators | Default comparison score |
85
+ | --- | --- | --- |
86
+ | Classification | Logistic Regression, Decision Tree, Random Forest, Extra Trees, Gradient Boosting, HistGradientBoosting, KNN, Gaussian Naive Bayes, SVM | Accuracy (training CV) |
87
+ | Regression | Linear Regression, Ridge, Lasso, Decision Tree, Random Forest, Extra Trees, Gradient Boosting, HistGradientBoosting, KNN, SVR | R² (training CV) |
88
+ | Clustering | K-Means, MiniBatch K-Means, DBSCAN, Agglomerative, Gaussian Mixture | Silhouette |
89
+ | Anomaly | Isolation Forest, Local Outlier Factor, One-Class SVM | Labeled F1 when labels are supplied; otherwise no quality ranking |
90
+
91
+ Classification holdout metrics include accuracy, balanced accuracy, weighted precision/recall/F1, and ROC-AUC / PR-AUC when the estimator and test labels support them. Regression reports MAE, MSE, RMSE, and R². Clustering reports silhouette, Davies–Bouldin, and Calinski–Harabasz when defined. Individual estimator failures are recorded in the leaderboard; successful models remain usable.
92
+
93
+ ## Automatic task detection and data profile
94
+
95
+ `task="auto"` requires a target column. Text-like targets are treated as classification; small-cardinality integer targets are treated as classification; other numeric targets are treated as regression. Ambiguous low-cardinality numeric targets emit a warning. Pass `task` explicitly when the heuristic is not appropriate. Auto mode never silently launches clustering.
96
+
97
+ ```python
98
+ from autodatamining import AutoDataMining
99
+
100
+ profile = AutoDataMining.profile(data, target="label")
101
+ print(profile["potential_issues"])
102
+ ```
103
+
104
+ The profile includes row and column counts, per-column type, missing count and cardinality, duplicate rows, and a target distribution. It does not diagnose leakage or establish that a metric is suitable for a research question.
105
+
106
+ ## Advanced usage
107
+
108
+ ### Custom estimators
109
+
110
+ ```python
111
+ from sklearn.linear_model import SGDClassifier
112
+ from autodatamining import AutoDataMining, EstimatorRegistry
113
+
114
+ registry = EstimatorRegistry()
115
+ registry.register("fast_sgd", SGDClassifier, tasks="classification",
116
+ params={"max_iter": 2000, "tol": 1e-3})
117
+ results = AutoDataMining(
118
+ task="classification", target="label", registry=registry,
119
+ models=["fast_sgd"], cv=3,
120
+ ).fit(data)
121
+ ```
122
+
123
+ Use unique names and register only estimators compatible with the declared task. Estimators are cloned before fitting. Model-specific parameters can be supplied with `model_params={"fast_sgd": {"alpha": 0.001}}`.
124
+
125
+ The module-level `register_estimator(name, estimator, tasks, params=None)` adds an estimator to the shared default registry for later runs.
126
+
127
+ ### Feature selection and dimensionality reduction
128
+
129
+ ```python
130
+ from autodatamining import select_features, reduce_dimensions
131
+
132
+ selected, selector = select_features(numeric_features, y, method="mutual_information",
133
+ task="classification", k=5)
134
+ embedding, pca = reduce_dimensions(numeric_features, method="pca", n_components=2)
135
+ ```
136
+
137
+ These convenience helpers fit directly to the data passed to them. For scientific evaluation, put selection or reduction inside a cross-validation `Pipeline` so each fold learns its transform from training data only.
138
+
139
+ ### Explainability
140
+
141
+ ```python
142
+ importance = results.explain(method="auto")
143
+ ```
144
+
145
+ Auto mode uses native tree importance or absolute coefficient magnitude where available, then falls back to holdout permutation importance for supervised tasks. `method="shap"` requires the optional extra. Importance describes model behavior and is not causal evidence. Unsupervised feature importance is not inferred.
146
+
147
+ ### Plots, reports, and CSV
148
+
149
+ ```python
150
+ results.plot(kind="leaderboard")
151
+ results.plot(kind="confusion_matrix") # classification
152
+ results.plot(kind="roc_curve") # binary classification
153
+ results.plot(kind="precision_recall_curve") # binary classification
154
+ results.plot(kind="residuals") # regression
155
+ results.plot(kind="clusters") # clustering
156
+ print(results.classification_report())
157
+ results.to_csv("leaderboard.csv")
158
+ results.report("experiment.html")
159
+ ```
160
+
161
+ Plots need `autodatamining[visualization]`. HTML reports include experiment metadata, metrics, leaderboard, and evaluation limitations; dataset rows are not included.
162
+
163
+ ### Save and load
164
+
165
+ ```python
166
+ from autodatamining import load_model
167
+
168
+ results.save("model.joblib")
169
+ model = load_model("model.joblib")
170
+ predictions = model.predict(new_data)
171
+ ```
172
+
173
+ Prediction validates feature names and permits incoming DataFrame columns in a different order. Missing or unexpected columns raise an error. A joblib/pickle artifact can execute code when loaded: only load files from a trusted source. Artifacts record the scikit-learn version; cross-version compatibility is not guaranteed.
174
+
175
+ ## Evaluation notes
176
+
177
+ - Supervised evaluation uses a train/test split and cross-validation on the training partition. Preprocessing is in the estimator pipeline and is fitted independently inside each fold.
178
+ - Classification uses stratification where class counts allow. Very small classes can prevent stratification or CV; the runner warns and reports what it could evaluate.
179
+ - CV score selects the supervised model when available. Holdout metrics are reported separately and should not be used repeatedly to tune the experiment.
180
+ - Clustering and unlabeled anomaly detection do not have ground-truth accuracy. Internal scores and anomaly rates have narrower meanings.
181
+ - Compare models using a metric tied to the intended use, and assess class imbalance, data leakage, temporal or grouped splits, calibration, latency, and deployment data drift separately.
182
+ - A top score in one experiment is not necessarily the best model for all datasets or real-world use.
183
+
184
+ ## Troubleshooting
185
+
186
+ - **`task='auto' requires a target column`**: pass a target or explicitly choose clustering/anomaly.
187
+ - **A requested estimator failed**: inspect its `status` and `error` in `results.leaderboard`; try fewer parameters or another model.
188
+ - **Feature columns do not match**: supply the same feature names as training; DataFrame column order may differ.
189
+ - **A score is missing/NaN**: some metrics need multiple target classes or at least two non-noise clusters.
190
+ - **Plotting or SHAP import error**: install the corresponding optional extra.
191
+
192
+ ## Development
193
+
194
+ ```bash
195
+ python -m pip install -e ".[dev,visualization]"
196
+ python -m compileall -q src tests
197
+ python -m ruff check src tests examples
198
+ python -m pytest -q
199
+ python -m build
200
+ python -m twine check dist/*
201
+ ```
202
+
203
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [CHANGELOG.md](CHANGELOG.md). Contributions should include tests for changed behavior and preserve the distinction between training CV and holdout evaluation.
204
+
205
+ ## PyPI release checklist
206
+
207
+ 1. Review source, dependency licenses, project ownership, name availability, and version.
208
+ 2. Run the test suite and build checks above.
209
+ 3. Inspect wheel and source distribution contents.
210
+ 4. Upload to TestPyPI and install into a clean virtual environment.
211
+ 5. Publish to PyPI using an API token held outside the source tree or trusted publishing.
212
+ 6. Verify the published install and create a version tag.
213
+
214
+ The project has not been published by this repository setup. Name availability and legal attribution must be checked again at release time. No credentials belong in the repository.
215
+
216
+ ## License
217
+
218
+ MIT; see [LICENSE](LICENSE). Review ownership and attribution before the first release.