Beispiel #1
0
func main() {
	util.SeedNow()

	corpus := load.Newsgroups.Import()
	lda := topic.NewLDA(corpus, 20, .1, .01)
	graphical.RunGibbs(lda, 100)

	labels := eval.NewLabelCorpusWordFeature(corpus, lda.Z)
	fmt.Println("Accuracty:", eval.Naive(labels.SplitRand(.8)))
	for z := 0; z < lda.T; z++ {
		fmt.Printf("%d: %s\n", z, lda.TopicSummary(z, 10))
	}
}
Beispiel #2
0
func MMGibbs(c *pipeline.Corpus) []int {
	mom := MOM(c)
	graphical.RunGibbs(mom, 30)
	return mom.Z
}
Beispiel #3
0
func DPGibbs(c *pipeline.Corpus) []int {
	dpmom := DPMOM(c)
	graphical.RunGibbs(dpmom, 30)
	return dpmom.Z
}