-
Notifications
You must be signed in to change notification settings - Fork 0
/
LDA.h
50 lines (45 loc) · 1.09 KB
/
LDA.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _LDA_H
#define _LDA_H
#include "dataset.h"
class LDA
{
public:
int niter;
int K;
float alpha;//historical value
float beta;//historical value
int topkwordspertopic;
string inputfilename;
//string outputfilename;
map<Key,double> phi;// it's wrong to say the word id belong to topic is this prob.
//map<Key,double> phiinit;
map<Key,double> theta;
map<Key,int> part1;
map<Key,int> part2;
map<int,int> part3;
int ** num_k_j;
int ** num_v_k;
int * num_k;
int ** wordtotopic2;
int ** wordtoid2;
int phisum[1000];//assume we have more than 1000 topics.
Dataset* input;
LDA(int argc, char** argv);
//void init(int argc, char** argv);
void writephi();
void Gibbssampling();
void CalculateThetanPhi();
void Saveres();
void PhitoMat();
void initthreemap();
void printcurrentassn();
void updatethreemap(int j, int k, int flag, int ori, int recent);
double Statpart1(int j, int k,int t);
double Statpart2(int j, int k,int t);
double Statpart3(int j, int k,int t);
double ThreeinOneSampling(int j, int k,int t);
int GetMax(double temp[], int size);
~LDA();
/* data */
};
#endif