machine-intelligence-laboratory / optimalnumberoftopics Goto Github PK
View Code? Open in Web Editor NEWA set of methods for finding an appropriate number of topics in a text collection
License: MIT License
A set of methods for finding an appropriate number of topics in a text collection
License: MIT License
Почитал про brunet_metric
https://github.com/AdrienGuille/TOM/blob/388c71ef0da7190740f19e5e8a838df95521a06e/tom_lib/nlp/topic_model.py#L90
Я вроде понял, что там происходит. Кажется, мы можем это реализовать, если захардкодить, что iterations == 3
Неплохо бы было сделать тест, когда в модель добавляются все скоры, она тренируется, сохраняется, загружается, снова тренируется, и все скоры успешно обновляются (то есть они не FrozenScore)
Some tiny piece of stuff about holdout may be found here Making-Decorrelation-and-Topic-Selection-Friends.ipynb
загрузка датасета — в несколько раз замедляет загрузку моделей с диска (при том что от скора нам нужна только значения сейчас). Кажется, для SO это разница между "три часа" и "меньше пяти минут"
...
лучше мб какой-то глобальный флаг включить?
ещё вариант делать загрузку датасета "лениво" (т.е. просто кэшировать его по сути)
по-хорошему вообще это должен быть референс на один и тот же объект, а не куча клоновПро один инстанс – это в точку! Чё-то этот момент пропустили при оформлении загрузки скоров (что "сколько скоров – столько раз и датасет поднимется"). В идеале должно быть так. При обучении они ведь один датасет используют
Возможно это вообще на стороне топикнета надо чинить? Как в джаве строки интернируются
Да, возможно... То есть при Dataset.load(path) можно не тупо загружать, а проверять, не загружен ли уже датасет с таким path. И если да, то возвращать его. Единственное, не совсем ясно, что делать, когда например, датасет загрузили и, скажем, словарь отфильтровали. Отдавать при Dataset.load изменённый датасет (с фильтрованным словарём), или загружать с нуля с диска?
Current workaround: https://github.com/machine-intelligence-laboratory/OptimalNumberOfTopics/blob/fix/load_models_hack/topnum/scores/base_custom_score.py#L13
It can be fixed. See issue in the TopicNet repository: machine-intelligence-laboratory/TopicNet#92.
Now there are examples of using the module via command line (python run_search.py ...
).
Seems good to show more ways of using: Python code + bash script
About script:
https://askubuntu.com/questions/1097197/running-python-script-from-shell-script-with-newline
а можешь сделать RPC? это по формуле
(perplexity(t2) - perplexity(t1))/(t2-t1)
где t_i — это число тем на графике, в соседних точках
dataset._data
from codekeep_in_memory=False
keep_in_memory
param in some dataset-related places (if needed)Some few quick tests for general check
with open(subsample_dataset_file_path, 'w') as f:
writer = csv.writer(f)
writer.writerow(dataset._data.columns)
document_df_rows = dataset._data.iloc[current_document_indices, :]
# TODO: check this!
if not dataset._small_data:
document_df_rows = document_df_row.compute().iloc[current_document_indices]
writer.writerows([r.to_list() for _, r in document_df_rows.iterrows()])
Запускаю питоновский код из примера на своих данных и получаю следующую ошибку:
194 document_words = self._get_words(document)
195 top_words = self._get_top_words(topic, word_topic_relatednesses)
--> 196 top_words_cooccurrences = self._get_top_words_cooccurrences(top_words, document_words)
197
198 return self._compute_newman_coherence(
~/Data Science/Notebooks/topnum/topnum/scores/sophisticated_toptok_coherence_score.py in _get_top_words_cooccurrences(self, top_words, document_words)
264 self._update_cooccurrences(cooccurrences, top_words, words_num_appearances_in_window)
265
--> 266 last_word_in_window = start_window[0]
267
268 for w in document_words[self._window:]:
IndexError: list index out of range
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.