|
15 | 15 | # %% |
16 | 16 | from autointent import Dataset, Pipeline |
17 | 17 |
|
| 18 | +search_space = [ |
| 19 | + { |
| 20 | + "node_type": "scoring", |
| 21 | + "metric": "scoring_roc_auc", |
| 22 | + "search_space": [ |
| 23 | + { |
| 24 | + "module_name": "knn", |
| 25 | + "k": [1], |
| 26 | + "weights": ["uniform"], |
| 27 | + "embedder_name": ["avsolatorio/GIST-small-Embedding-v0"] |
| 28 | + }, |
| 29 | + ], |
| 30 | + }, |
| 31 | + { |
| 32 | + "node_type": "decision", |
| 33 | + "metric": "decision_accuracy", |
| 34 | + "search_space": [ |
| 35 | + {"module_name": "threshold", "thresh": [0.5]}, |
| 36 | + {"module_name": "argmax"}, |
| 37 | + ], |
| 38 | + }, |
| 39 | +] |
| 40 | + |
18 | 41 | dataset = Dataset.from_hub("AutoIntent/clinc150_subset") |
19 | | -pipeline = Pipeline.default_optimizer(multilabel=False) |
| 42 | +pipeline = Pipeline.from_search_space(search_space) |
20 | 43 | context = pipeline.fit(dataset) |
21 | 44 | pipeline.predict(["hello, world!"]) |
22 | 45 |
|
|
54 | 77 | """ |
55 | 78 |
|
56 | 79 | # %% |
57 | | -from pathlib import Path |
58 | | - |
59 | 80 | from autointent import Dataset, Pipeline |
60 | 81 | from autointent.configs import LoggingConfig, VectorIndexConfig |
61 | 82 |
|
62 | 83 | dataset = Dataset.from_hub("AutoIntent/clinc150_subset") |
63 | | -pipeline = Pipeline.default_optimizer(multilabel=False) |
64 | | -dump_dir = Path("my_dumps") |
65 | | -pipeline.set_config(LoggingConfig(dump_dir=dump_dir, dump_modules=True, clear_ram=True)) |
| 84 | +pipeline = Pipeline.from_search_space(search_space) |
| 85 | +pipeline.set_config(LoggingConfig(dump_modules=True, clear_ram=True)) |
66 | 86 | pipeline.set_config(VectorIndexConfig(save_db=True)) |
67 | 87 |
|
68 | 88 | # %% [markdown] |
|
96 | 116 | """ |
97 | 117 | ## That's all! |
98 | 118 | """ |
99 | | - |
100 | | -# %% |
101 | | -# [you didn't see it] |
102 | | -import shutil |
103 | | - |
104 | | -shutil.rmtree(dump_dir) |
105 | | - |
106 | | -for file in Path.cwd().glob("vector_db*"): |
107 | | - shutil.rmtree(file) |
|
0 commit comments