Skip to content

Commit d6cd285

Browse files
committed
add sample experiment code on top of ridmi
1 parent 53ecc43 commit d6cd285

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,40 @@ Consider using TopicNet if:
5353
</em>
5454
</p>
5555

56+
And here is sample code of the TopicNet baseline experiment:
57+
58+
```python
59+
from topicnet.cooking_machine.config_parser import (
60+
build_experiment_environment_from_yaml_config
61+
)
62+
63+
from topicnet.cooking_machine.recipes import (
64+
ARTM_baseline as config_string
65+
)
66+
67+
dataset_path = '/data/datasets/NIPS/dataset.csv'
68+
69+
specific_topics = [f'spc_topic_{i}' for i in range(19)]
70+
background_topics = [f'bcg_topic_{i}' for i in range( 1)]
71+
72+
config_string = config_string.format(
73+
dataset_path=dataset_path,
74+
modality_list=['@word'],
75+
main_modality='@word',
76+
specific_topics=specific_topics,
77+
background_topics=background_topics,
78+
)
79+
experiment, dataset = (
80+
build_experiment_environment_from_yaml_config(
81+
yaml_string=config_string,
82+
experiment_id='sample_config',
83+
save_path='sample_save_path',
84+
)
85+
)
86+
experiment.run(dataset)
87+
best_model = experiment.select('PerplexityScore@all -> min')[0]
88+
```
89+
5690

5791
## How to start
5892

@@ -235,11 +269,11 @@ HTML(html_view)
235269

236270
# FAQ
237271

238-
#### In the example we used to write vw modality like **@modality**, is it a VowpallWabbit format?
272+
### In the example we used to write vw modality like **@modality**, is it a VowpallWabbit format?
239273

240274
It is a convention to write data designating modalities with @ sign taken by TopicNet from BigARTM.
241275

242-
#### CubeCreator helps to perform a grid search over initial model parameters. How can I do it with modalities?
276+
### CubeCreator helps to perform a grid search over initial model parameters. How can I do it with modalities?
243277

244278
Modality search space can be defined using standart library logic like:
245279

0 commit comments

Comments
 (0)