知识卡片
主题词伪计数归一后才是概率
主题分配的components_在scikit-learn中表示主题×词项的伪计数,要按主题行归一才得到相应词概率。本章若以词名作行、主题作列就必须转置原矩阵;不能把未归一的大数直接读成某词属于主题的概率。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 从词数到语义分析
原书出处 · 1 处
- · 查看原书依据
>>> term_topic_matrix = pd.DataFrame(ldia.components_, index=terms,\ ... columns=columns) #1 >>> term_topic_matrix.round(2).head(3) topic0 topic1 ... topic14 topic15 a 21.853 0.063 ... 0.063 922.515 aaaaaaaaaahhhhhhhhhhhhhh 0.063 0.063 ... 0.063 0.063 aalst 0.063 0.063 ... 0.063 0.063 aap 0.063 0.063 ... 2.062 0.062 #1 This is the same matrix we built for our LSA topic model, just transposed! It looks like the values in LDiA topic vectors have much
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第04章《从词数到语义分析》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-4.html)
- 结论依据:摘录中关于主题词伪计数归一后才是概率的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:>>> term_topic_matrix = pd.DataFrame(ldia.components_, index=terms,\ ... columns=columns) #1 >>> term_topic_matrix.round(2).head(3) topic0 topic1 ... topic14 topic15 a 21.853 0.063 ... 0.063 922.515 aaaaaaaaaahhhhhhhhhhhhhh 0.063 0.063 ... 0.063 0.063 aalst 0.063 0.063 ... 0.063 0.063 aap 0.063 0.063 ... 2.062 0.062 #1 This is the same matrix we built for our LSA topic model, just transposed! It looks like the values in LDiA topic vectors have much