Telegram Group & Telegram Channel
ХОЛОДНЫЙ РАСЧЕТ ∅
💀 NLP-индексы: Зачем? Когда мы пытаемся понять последствия некоторого события для рынков, то стандартный инструмент - это событийный анализ/event study: например, мы собираем базу дат класса событий (встреч представителей стран, санкций и т.п.) и смотрим…
💀 NLP-индексы: Рецепт

Сделаем чистый env под наш расчет:

conda create -n top2vec python=3.10
pip install top2vec[sentence-transformers]


Предположим, что у нас уже собран весь нужный массив текстов в чем-то вроде

df_txt = pd.DataFrame(columns=['ds','Para'])


Берем вектор текстов

li_doc = df_txt.Para.to_list()


Находим кластеры тем:

top2vec_model = Top2Vec(documents=li_doc
, ngram_vocab=True
, embedding_model='all-MiniLM-L6-v2'
, use_embedding_model_tokenizer=True
, contextual_top2vec=True
)

Обычно находится слишком много - можем сократить / огрубить кластеры до каких-то человеческих величин:

top2vec_model.hierarchical_topic_reduction(20)


Далее смотрим на ключевые слова по темам и выбираем те, которые отражают интересный для нас феномен:

topic_words, word_scores, topic_nums = top2vec_model.get_topics(reduced=True)
[', '.join(x[:10]) + "\n\n\m" for x in topic_words.tolist()]


Посмотрев на ключевые слова выбираем нужные нам кластеры, которые относятся к целевой теме:

li_top = [1,13,...]

Наконец, строим индекс
df_ix = df_txt\
.assign(
ix_all = 1
, top = top2vec_model.doc_top_reduced
, ix_top = lambda df: df.top.map(lambda x: 1 if x in li_top else 0)
)\
.set_index('ds')\
[['ix','ix_top']]\
.resample('M').sum()\
.assign(ix_top_pct = lambda df: df.ix_top.div(ix_all).mul(100)
)


Готово - можем смотреть на любые статистические свойства индекса (как быстро он угасает после пиков), сравнивать текущую интенсивность с историческими эпизодами, смотреть как его значение соотносятся с рыночными показателями

@c0ldness
Please open Telegram to view this post
VIEW IN TELEGRAM



group-telegram.com/c0ldness/5934
Create:
Last Update:

💀 NLP-индексы: Рецепт

Сделаем чистый env под наш расчет:

conda create -n top2vec python=3.10
pip install top2vec[sentence-transformers]


Предположим, что у нас уже собран весь нужный массив текстов в чем-то вроде

df_txt = pd.DataFrame(columns=['ds','Para'])


Берем вектор текстов

li_doc = df_txt.Para.to_list()


Находим кластеры тем:

top2vec_model = Top2Vec(documents=li_doc
, ngram_vocab=True
, embedding_model='all-MiniLM-L6-v2'
, use_embedding_model_tokenizer=True
, contextual_top2vec=True
)

Обычно находится слишком много - можем сократить / огрубить кластеры до каких-то человеческих величин:

top2vec_model.hierarchical_topic_reduction(20)


Далее смотрим на ключевые слова по темам и выбираем те, которые отражают интересный для нас феномен:

topic_words, word_scores, topic_nums = top2vec_model.get_topics(reduced=True)
[', '.join(x[:10]) + "\n\n\m" for x in topic_words.tolist()]


Посмотрев на ключевые слова выбираем нужные нам кластеры, которые относятся к целевой теме:

li_top = [1,13,...]

Наконец, строим индекс
df_ix = df_txt\
.assign(
ix_all = 1
, top = top2vec_model.doc_top_reduced
, ix_top = lambda df: df.top.map(lambda x: 1 if x in li_top else 0)
)\
.set_index('ds')\
[['ix','ix_top']]\
.resample('M').sum()\
.assign(ix_top_pct = lambda df: df.ix_top.div(ix_all).mul(100)
)


Готово - можем смотреть на любые статистические свойства индекса (как быстро он угасает после пиков), сравнивать текущую интенсивность с историческими эпизодами, смотреть как его значение соотносятся с рыночными показателями

@c0ldness

BY ХОЛОДНЫЙ РАСЧЕТ ∅




Share with your friend now:
group-telegram.com/c0ldness/5934

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

"Russians are really disconnected from the reality of what happening to their country," Andrey said. "So Telegram has become essential for understanding what's going on to the Russian-speaking world." The fake Zelenskiy account reached 20,000 followers on Telegram before it was shut down, a remedial action that experts say is all too rare. There was another possible development: Reuters also reported that Ukraine said that Belarus could soon join the invasion of Ukraine. However, the AFP, citing a Pentagon official, said the U.S. hasn’t yet seen evidence that Belarusian troops are in Ukraine. DFR Lab sent the image through Microsoft Azure's Face Verification program and found that it was "highly unlikely" that the person in the second photo was the same as the first woman. The fact-checker Logically AI also found the claim to be false. The woman, Olena Kurilo, was also captured in a video after the airstrike and shown to have the injuries. Again, in contrast to Facebook, Google and Twitter, Telegram's founder Pavel Durov runs his company in relative secrecy from Dubai.
from us


Telegram ХОЛОДНЫЙ РАСЧЕТ ∅
FROM American