Documentation ¶
Index ¶
- func Register(modelType string, m ModelCtor)
- type LDA
- func (this *LDA) Infer(dat *corpus.Corpus, iter int)
- func (this *LDA) Init()
- func (this *LDA) Likelihood() float64
- func (this *LDA) LoadWordTopic(fn string) error
- func (this *LDA) Phi() *sstable.Float32Matrix
- func (this *LDA) ResampleTopics(iter int)
- func (this *LDA) SavePhi(fn string) error
- func (this *LDA) SaveTheta(fn string) error
- func (this *LDA) SaveWordTopic(fn string) error
- func (this *LDA) Theta() *sstable.Float32Matrix
- func (this *LDA) Train(dat *corpus.Corpus, iter int)
- type Model
- type ModelCtor
- type SparseLDA
- func (this *SparseLDA) Infer(dat *corpus.Corpus, iter int)
- func (this *SparseLDA) Likelihood() float64
- func (this *SparseLDA) LoadWordTopic(fn string) error
- func (this *SparseLDA) Phi() *sstable.Float32Matrix
- func (this *SparseLDA) ResampleTopics(iter int)
- func (this *SparseLDA) SavePhi(fn string) error
- func (this *SparseLDA) SaveWordTopic(fn string) error
- func (this *SparseLDA) Train(dat *corpus.Corpus, iter int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LDA ¶
type LDA struct { Alpha float32 // document topic mixture hyperparameter Beta float32 // topic word mixture hyperparameter TopicNum uint32 Data *corpus.Corpus // for convenience Wt *sstable.Uint32Matrix // word-topic count table Dt *sstable.Uint32Matrix // doc-topic count table Wts *sstable.Uint32Matrix // word-topic-sum count table Dwt map[sstable.DocWord]uint32 // doc-word-topic map }
func (*LDA) Likelihood ¶
compute the joint likelihood of corpus
func (*LDA) LoadWordTopic ¶
deserialize word-topic matrix
func (*LDA) Phi ¶
func (this *LDA) Phi() *sstable.Float32Matrix
compute the posterior point estimation of word-topic mixture beta (Dirichlet prior) + data -> phi
func (*LDA) ResampleTopics ¶
func (*LDA) SaveWordTopic ¶
serialize word-topic matrix
func (*LDA) Theta ¶
func (this *LDA) Theta() *sstable.Float32Matrix
compute the posterior point estimation of document-topic mixture alpha (Dirichlet prior) + data -> theta
type Model ¶
type Model interface { // train model for iter iteration Train(dat *corpus.Corpus, iter int) // do inference for new doc for iter iteration Infer(dat *corpus.Corpus, iter int) // get doc-topic distribution Phi() *sstable.Float32Matrix // get word-topic distribution Theta() *sstable.Float32Matrix // serialize posterior document topic distribution SaveTheta(fn string) error // serialize posterior word topic distribution SavePhi(fn string) error // serialize word topic count table SaveWordTopic(fn string) error // deserialize word topic count table LoadWordTopic(fn string) error }
the common interface new LDA samplers should follow
type SparseLDA ¶
func (*SparseLDA) Likelihood ¶
compute the joint likelihood of corpus
func (*SparseLDA) LoadWordTopic ¶
deserialize word-topic matrix
func (*SparseLDA) Phi ¶
func (this *SparseLDA) Phi() *sstable.Float32Matrix
compute the posterior point estimation of word-topic mixture beta (Dirichlet prior) + data -> phi
func (*SparseLDA) ResampleTopics ¶
func (*SparseLDA) SaveWordTopic ¶
serialize word-topic matrix
Click to show internal directories.
Click to hide internal directories.