SciTech-BigDataAIML-Statistical Model-Topics Model主题模型-LDA(Latent Dirichilet Allocation, 潜在狄利克雷分布) Model
SciTech-BigDataAIML-Algorithm-Heuristic启发式-
Statistical Model(统计概率模型) 的一种
Topics Model(主题模型)
LDA(Latent Dirichilet Allocation) Topics Model主题模型。
LDA(Latent Dirichilet Allocation, 潜在狄利克雷分布)是一种 Topics Model(主题模型),
用于在Large Scale Docs(大量文档)自动发现Hidden Topics(隐藏主题)。
在NLP和Text Analysis上, LDA被广泛应用于文本分类、文档聚类、信息检索等场景。
LDA的核心思想
Doc(每篇文档) 看作由 Topics(多个主题)构成,
而 Topic(每个主题)又由 Terms(一组单词)按一定Distribution(概率分布)生成.
from gensim import corpora,models
#假设已经有文本数据
texts=[ ["human","interface","computer"],
["survey","user","computer","system","response"] ]
#创建词典和语料库
dictionary=corpora.Dictionary(texts)
corpus=[dictionary.doc2bow(text) for text in texts]
#使用LDA进行主题分析
lda_model=models.LdaModel(corpus, num_topics=2, id2word=dictionary, passes=10)
topics=lda_model.print_topics(num_words=3)
for topic in topics:
print(topic)
得到Output(输出)
[(0, '0.177*"computer" + 0.176*"user" + 0.176*"survey"'),
(1, '0.230*"computer" + 0.228*"interface" + 0.228*"human"')]
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
2023-11-11 USB.org + USB 3.0 Type-C + PD(Power Delivery)240W
2023-11-11 BAW(Bulk Acoustic Wave) resonator with high Q-factor.