Skip to content

Commit c65b049

Browse files
committed
add ref to viewers in ridmi, fix names in py code in ridmi
1 parent 4ec72c1 commit c65b049

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Consider using TopicNet if:
3838
* you want to build a good topic model quickly (out-of-box, with default parameters).
3939
* you have an ARTM model at hand and you want to explore it's topics.
4040

41-
`TopicNet` provides an infrastructure for your prototyping with the help of `Experiment` class and helps to observe results of your actions via `viewers` module.
41+
`TopicNet` provides an infrastructure for your prototyping with the help of `Experiment` class and helps to observe results of your actions via [`viewers`](topicnet/viewers) module.
4242

4343
<p>
4444
<div align="center">
@@ -159,7 +159,7 @@ Here we can finally get on the main part: making your own, best of them all, man
159159
We need to load our data prepared previously with Dataset:
160160

161161
```python
162-
data = Dataset('/Wiki_raw_set/wiki_data.csv')
162+
dataset = Dataset('/Wiki_raw_set/wiki_data.csv')
163163
```
164164

165165
### Make initial model
@@ -169,8 +169,8 @@ In case you want to start from a fresh model we suggest you use this code:
169169
```python
170170
from topicnet.cooking_machine.model_constructor import init_simple_default_model
171171

172-
model_artm = init_simple_default_model(
173-
dataset=data,
172+
artm_model = init_simple_default_model(
173+
dataset=dataset,
174174
modalities_to_use={'@lemmatized': 1.0, '@bigram':0.5},
175175
main_modality='@lemmatized',
176176
specific_topics=14,
@@ -188,7 +188,8 @@ class CustomScore(BaseScore):
188188
def __init__(self):
189189
super().__init__()
190190

191-
def call(self, model,
191+
def call(self,
192+
model,
192193
eps=1e-5,
193194
n_specific_topics=14):
194195

@@ -204,7 +205,7 @@ Now, `TopicModel` with custom score can be defined:
204205
from topicnet.cooking_machine.models.topic_model import TopicModel
205206

206207
custom_scores = {'SpecificSparsity': CustomScore()}
207-
topic_model = TopicModel(model_artm, model_id='Groot', custom_scores=custom_scores)
208+
topic_model = TopicModel(artm_model, model_id='Groot', custom_scores=custom_scores)
208209
```
209210

210211
### Define experiment
@@ -234,7 +235,7 @@ my_first_cube = RegularizersModifierCube(
234235
verbose=True,
235236
)
236237

237-
my_first_cube(tm, demo_data)
238+
my_first_cube(topic_model, dataset)
238239
```
239240

240241
Selecting a model with best perplexity score:
@@ -245,14 +246,15 @@ best_model = experiment.select(perplexity_criterion)
245246
```
246247

247248
### View the results
249+
248250
Browsing the model is easy: create a viewer and call its `view()` method:
249251

250252
```python
251253
from IPython.display import HTML
252254

253255
threshold = 1e-5
254-
viewer = TopTokensViewer(best_model, num_top_tokens=10, method='phi')
255-
html_view = viewer.to_html(top_tok.view(), thresh=threshold)
256+
toptok_viewer = TopTokensViewer(best_model, num_top_tokens=10, method='phi')
257+
html_view = toptok_viewer.to_html(toptok_viewer.view(), thresh=threshold)
256258

257259
HTML(html_view)
258260
```
@@ -282,16 +284,16 @@ class_ids_cube = CubeCreator(
282284
)
283285
```
284286

285-
However for the case of modalities a couple of slightly more convenient methods are availiable:
287+
However, for the case of modalities a couple of slightly more convenient methods are availiable:
286288

287289
```python
288290
parameters : [
289291
{
290-
'name': 'class_ids@text',
292+
'name' : 'class_ids@text',
291293
'values': [1, 2, 3]
292294
},
293295
{
294-
'name': 'class_ids@ngrams',
296+
'name' : 'class_ids@ngrams',
295297
'values': [4, 5, 6]
296298
}
297299
]

0 commit comments

Comments
 (0)