algorithm-genome 0.3.0__py3-none-any.whl

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.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: algorithm-genome
3
+ Version: 0.3.0
4
+ Summary: Scriptable Python framework for learned classification algorithm recommendations
5
+ Project-URL: Source, https://github.com/mayank1232w/Algorithm-Genome
6
+ Project-URL: Issues, https://github.com/mayank1232w/Algorithm-Genome/issues
7
+ Keywords: machine-learning,meta-learning,classification,algorithm-selection
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: scikit-learn==1.9.1
21
+ Requires-Dist: pandas<4,>=2.2
22
+ Requires-Dist: numpy<3,>=2
23
+ Requires-Dist: joblib<2,>=1.4
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest>=8; extra == "test"
26
+ Provides-Extra: release
27
+ Requires-Dist: build>=1.2; extra == "release"
28
+ Requires-Dist: twine>=6; extra == "release"
29
+
30
+ # Algorithm Genome
31
+
32
+ A Python library that recommends classification algorithms for labeled tabular
33
+ data. A pretrained recommender is included: import the library and pass a pandas
34
+ DataFrame. No repository checkout, downloaded training corpus, separate model
35
+ file, or runtime network connection is needed.
36
+
37
+ Python 3.11 or newer is required. The package pins scikit-learn to the bundled
38
+ model's training version, 1.9.1, so pip installs a compatible version automatically.
39
+
40
+ Install the wheel from this project's `dist/` folder, or share that file with
41
+ another user:
42
+
43
+ ```bash
44
+ python -m pip install ./dist/algorithm_genome-0.3.0-py3-none-any.whl
45
+ ```
46
+
47
+ After the package owner publishes version 0.3.0 to PyPI, the public command will be:
48
+
49
+ ```bash
50
+ python -m pip install algorithm-genome
51
+ ```
52
+
53
+ The release artifacts are prepared locally; this repository change does not
54
+ upload them to PyPI. For local development, use `python -m pip install -e '.[test]'`.
55
+
56
+ Use the library from any working directory:
57
+
58
+ ```python
59
+ import pandas as pd
60
+ from algorithm_genome import Recommender, TrainedClassifier
61
+
62
+ # Load the pretrained model installed with the library.
63
+ model = Recommender()
64
+ data = pd.read_csv("my_dataset.csv")
65
+
66
+ # Rank algorithms without training candidate classifiers.
67
+ report = model.recommend(data, target="outcome")
68
+ print(pd.DataFrame(report["ranking"]))
69
+ print(report["meta_model_training_warnings"])
70
+
71
+ # Cross-validate candidates, evaluate a reserved holdout, and refit the winner.
72
+ result = model.verify(data, target="outcome", budget_seconds=60)
73
+ print(result.selected_algorithm)
74
+ print(result.report["holdout_metrics"])
75
+
76
+ # Predict now, or save the selected classifier for later scripts.
77
+ new_rows = pd.read_csv("new_rows.csv")
78
+ predictions = result.predict(new_rows)
79
+ result.save("my_output")
80
+ classifier = TrainedClassifier.load("my_output/selected_classifier.joblib")
81
+ predictions = classifier.predict(new_rows)
82
+ ```
83
+
84
+ The pretrained neural model was trained on 51 dataset versions from 43 source
85
+ groups. It remains **experimental**: its optimizer reported a convergence warning,
86
+ which is retained in reports. On seven previously reserved source groups it lost
87
+ 2.086 macro-F1 points on average at the first choice, compared with 1.204 for a
88
+ simple fixed portfolio trained on the same corpus. Lower loss is better. These
89
+ small-cohort results do not establish general recommendation reliability.
90
+ Package resources include `assets/model_info.json` with provenance, checksum,
91
+ training warnings, and the evaluation summary. No raw training tables are shipped.
92
+
93
+ Simple commented scripts are in `examples/` in the source distribution. Copy them
94
+ into your own working folder and run:
95
+
96
+ ```bash
97
+ python recommend.py # Uses the installed pretrained model immediately
98
+ python verify_and_save.py # Saves the best measured classifier to algorithm_genome_output/
99
+ python predict.py # Loads that classifier and predicts two new rows
100
+ ```
101
+
102
+ They use generated data and explain each framework call. Training is optional:
103
+ `train_recommender.py` illustrates fitting your own model with four small bundled
104
+ scikit-learn datasets. Its output, `my_recommender.joblib`, can be opened using
105
+ `Recommender.load("my_recommender.joblib")`. Four sources demonstrate execution;
106
+ they do not establish recommendation quality. The combined `use_framework.py`
107
+ example accepts your CSVs and an optional custom `--model`:
108
+
109
+ ```bash
110
+ python use_framework.py my_dataset.csv --target outcome \
111
+ --predict-csv new_rows.csv --output my_output
112
+ ```
113
+
114
+ To train from your own historical DataFrames:
115
+
116
+ ```python
117
+ from algorithm_genome import Dataset, Recommender, benchmark_datasets
118
+
119
+ # historical_tables maps source names to labeled DataFrames.
120
+ datasets = [
121
+ Dataset(id=name, data=frame, target="outcome", group=name)
122
+ for name, frame in historical_tables.items()
123
+ ]
124
+ benchmark = benchmark_datasets(datasets)
125
+ model = Recommender.fit(benchmark)
126
+ print(model.artifact["evaluation"])
127
+ model.save("my_recommender.joblib")
128
+ ```
129
+
130
+ At least four independent source groups with all ten successful candidate results
131
+ are required. Related dataset variants must share a `group`. Benchmarking also
132
+ accepts a CSV manifest and optional resumable checkpoint:
133
+
134
+ ```python
135
+ benchmark = benchmark_datasets(
136
+ "dataset_manifest.json", output_path="benchmark.json", resume=True,
137
+ )
138
+ model = Recommender.fit(benchmark)
139
+ ```
140
+
141
+ Manifest entries contain `id`, `path`, `target`, and optional `group`/`source`.
142
+ CSV paths are relative to the manifest. Duplicate content is rejected. Inputs are
143
+ validated before fitting; resume reuses only complete compatible results.
144
+
145
+ Public API:
146
+
147
+ | Interface | Result |
148
+ | --- | --- |
149
+ | `Recommender()` | Included pretrained recommender; no paths or downloads |
150
+ | `Dataset(id, data, target, group=None)` | Historical table and source identity |
151
+ | `benchmark_datasets(datasets_or_manifest, output_path=None, progress=False, resume=False)` | Dictionary of measured candidate scores/times and genomes |
152
+ | `Recommender.fit(benchmark_or_path)` | Custom recommender with group-separated evaluation |
153
+ | `Recommender.load(path)` / `model.save(path)` | Read/write a custom trusted joblib artifact |
154
+ | `model.recommend(data, target)` | Predicted ranking, genome, summaries, and warnings |
155
+ | `model.verify(data, target, *, top_k=3, budget_seconds=300, progress=None)` | `VerificationResult` with `report` and `classifier` |
156
+ | `result.predict(data)` / `classifier.predict(data)` | NumPy array of string labels |
157
+ | `result.save(directory)` | Report JSON, predicted ranking CSV, classifier joblib |
158
+ | `TrainedClassifier.load(path)` / `classifier.save(path)` | Read/write a selected classifier |
159
+ | `extract_dataset_genome(X, y)` | Seventeen properties from aligned training rows |
160
+
161
+ Library calls are quiet by default. `verify(progress=callback)` emits event
162
+ dictionaries such as `candidate_start` and `candidate_complete`. Existing
163
+ lower-level `train_meta_model`, `recommend_algorithms`, and
164
+ `verify_recommendations` functions remain exported.
165
+
166
+ The installed CLI uses the pretrained model by default too:
167
+
168
+ ```bash
169
+ algorithm-genome recommend my_dataset.csv --target outcome --verify --output my_output
170
+ algorithm-genome predict my_output/selected_classifier.joblib \
171
+ new_rows.csv --output predictions.csv
172
+ ```
173
+
174
+ Supply `--meta-model custom.joblib` to use your own recommender, `--json` for
175
+ machine output, or `--verbose` for detailed terminal metrics. Research utilities
176
+ are available through `python -m algorithm_genome.download_public_datasets`,
177
+ `prepare_additional_datasets`, `improve_meta_model`, and
178
+ `train_neural_recommender`; use their `--help` options.
179
+
180
+ Scope and interpretation:
181
+
182
+ - Independent-row labeled tabular **classification**, with an explicit target.
183
+ Regression, forecasting, image models, and text models are not implemented.
184
+ - At least 30 distinct labeled rows, two classes, and three rows per class.
185
+ Missing-target rows and duplicate records are removed. Features can be numeric
186
+ or categorical. Outputs are strings; use `pd.read_csv(..., dtype={"outcome": str})`
187
+ to preserve labels such as `01`.
188
+ - Ten fixed candidate configurations, with no automatic hyperparameter tuning.
189
+ Ranking scores predict relative macro-F1, not accuracy or confidence.
190
+ - Verification reserves a holdout before extracting its recommendation genome.
191
+ Preprocessing is fitted inside each CV training fold. The final classifier is
192
+ refitted on all usable rows after holdout evaluation.
193
+ - `top_k` prioritizes the shortlist, followed by a challenger and remaining
194
+ candidates. Runtime budgets are soft and checked between fits; active fits finish.
195
+ - Prediction inputs need the training feature names. Column order may differ,
196
+ extra columns are ignored, and missing or duplicate columns raise `ValueError`.
197
+ - Custom joblib files must be trusted and use matching dependency versions.
198
+ The default model is loaded from verified package resources.
199
+
200
+ To build a release from the source tree:
201
+
202
+ ```bash
203
+ python -m pip install -e '.[test,release]'
204
+ make release
205
+ ```
206
+
207
+ `make release` runs the test suite, builds both archives, checks their metadata,
208
+ and tests installed copies of the wheel and a wheel rebuilt from the source
209
+ archive. The installation checks run from temporary working directories with
210
+ network access blocked and editable-install hooks disabled. They exercise the
211
+ default recommender, verification, saving/reloading, predictions, and the installed
212
+ CLI. Build tooling and declared dependencies must already be installed; the
213
+ release checks do not download anything. Use a `dist/` folder containing only the
214
+ current version. To check existing archives alone, run
215
+ `python scripts/check_release.py dist/` (also `make check-release` in a checkout).
216
+ Without Make, run `python -m pytest -q`, `python -m build --no-isolation`,
217
+ `python -m twine check dist/*`, and the check script in that order.
218
+
219
+ The resulting wheel and source archive both include the pretrained model. Only
220
+ the package owner should upload the reviewed release using an authenticated PyPI
221
+ account with `python -m twine upload dist/*`, following the
222
+ [Python packaging guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/).
223
+ Uploading is separate from building and local installation.
@@ -0,0 +1,24 @@
1
+ algorithm_genome/__init__.py,sha256=5co4WOjuR875CB2yp_fGntU0vNs5u7ZhHKCAmXCN5WA,600
2
+ algorithm_genome/__main__.py,sha256=W1kmq38mrVgvXY3isS7QmXJgEqqQg_tS1pjewWzGu88,39
3
+ algorithm_genome/algorithm_library.py,sha256=ERME-qNprCSYze88H6cd2LVJJDQSTa_pnP5Y09xIYP0,3482
4
+ algorithm_genome/benchmark_datasets.py,sha256=yKSGp_HiPh-j4IHBv11WKgTATQRFz4WmOU5r_7jItWg,6102
5
+ algorithm_genome/bundled_model.py,sha256=QJSDG0vzOh7eBUAxO7HaclnU4VOtUrOttXMHCRlXno0,1187
6
+ algorithm_genome/command_line.py,sha256=GPC6zQESCnWWTCmbPyAgY2o57FewmbPUDLK-vpHdLLQ,7008
7
+ algorithm_genome/create_example_datasets.py,sha256=7oK05CamiePfmoI8wmq4lgKCDykyqPiFfR7dckXZAGI,1671
8
+ algorithm_genome/dataset_genome.py,sha256=dSlioJ8SNoFFBUdMd_wJx4LuJHcxK0AbhI9DpEaMKXI,5705
9
+ algorithm_genome/download_public_datasets.py,sha256=x1cU0M51nmYuGOXd0N4B4-VJsOoFV98UbEpqMinqlFI,13401
10
+ algorithm_genome/framework.py,sha256=QGfo7tSZintu0rGICSwkNr8uDE91408N9kOY5NW8YdA,4210
11
+ algorithm_genome/improve_meta_model.py,sha256=I5TPwnM0mGo08h0wkWO-ZsW1hzIHv9hczt0O1aRdsJs,10209
12
+ algorithm_genome/model_pipeline.py,sha256=iqczlscgI_DGFvqC_kOcElF1fsqtiQmK61G83K4Ilvk,2967
13
+ algorithm_genome/prepare_additional_datasets.py,sha256=wUbytQKQVsfwD_XIkglA3dANxjQdBHsnubjSxPQ4C5Q,5402
14
+ algorithm_genome/recommend_algorithms.py,sha256=GU0sMjQ49-I_fXTQzp45vjccDltTf-bhBQ6lT6dTtqQ,9968
15
+ algorithm_genome/terminal_output.py,sha256=8LlwnCD1zMpcubJr_Qk8QHz9z5u4UbGR67BdfwZJqn4,16571
16
+ algorithm_genome/train_meta_model.py,sha256=k0q6DHx2s0rMdXpglZwy3Kbat_WjXw1l60bw9l9ctVo,8292
17
+ algorithm_genome/train_neural_recommender.py,sha256=Hhq8mX3ATj6fysJq7N7hrsDMBlnZGT2gZ78-hlCk2yU,23247
18
+ algorithm_genome/assets/default_recommender.joblib,sha256=x-oXvc04lBtrULNwjVSfBiRIezLi23MwPMMZ0ppRPfc,1019680
19
+ algorithm_genome/assets/model_info.json,sha256=yLcQzgOHmBn6eH19a-_4JF8_cr2kGMQVpmCjhQI58hE,1505
20
+ algorithm_genome-0.3.0.dist-info/METADATA,sha256=FrPLHQqPFWHPsAdXuouZ-scusqutHizybiK6VYTYlFc,10454
21
+ algorithm_genome-0.3.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
22
+ algorithm_genome-0.3.0.dist-info/entry_points.txt,sha256=xouhuHgzT2TFv72dbqYrkHI16AGft8VWp1LLA2ImQW0,72
23
+ algorithm_genome-0.3.0.dist-info/top_level.txt,sha256=STYGZuY8YUhHEoWiUY7R10T6putJ0lxEVTjY5wF4xnc,17
24
+ algorithm_genome-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ algorithm-genome = algorithm_genome.command_line:main
@@ -0,0 +1 @@
1
+ algorithm_genome