1.LDA主题模型原理
intro:
来看下面几句话:
“
I like to eat broccoli and bananas.
I ate a banana and spinach smoothie for breakfast.
Chinchillas and kittens are cute.
My sister adopted a kitten yesterday.
Look at this cute hamster munching on a piece of broccoli.
”
问:什么是latent Dirichlet allocation?
答:就是自动发现句子属于那种话题。
譬如,上面几句话分属于2种话题A&B,LDA就会这么显示:
第1、2句: 100% Topic A
第3、4句: 100% Topic B
第5句: 60% Topic A, 40% Topic B
Topic A: 30% broccoli, 15% bananas, 10% breakfast, 10% munching, … (也可以理解为A是关于食物的)
Topic B: 20% chinchillas, 20% kittens, 20% cute, 15% hamster, … (也可以理解为B是关于可爱动物的)
步骤:
假设你有一组documents,有K种话题,希望用LDA学习每个document的topic和每种topic有哪些words:
- Go through each document, and randomly assign each word in the document to one of the K to