TRF Language Model
trf Namespace Reference

Classes

class  AISConfig
 
class  Algfb
 
class  AlgNode
 the forward-backward algorithms for TRF model More...
 
class  CorpusBase
 
class  CorpusRandSelect
 
class  CorpusTxt
 
class  Feat
 include all the feature table More...
 
class  FeatStyle
 Analyse a determinate feat style (without ":") More...
 
class  FeatTable
 define the feature style. such as "w3"(word-3gram); "c2"(class-2gram); More...
 
class  LearningRate
 
class  MLfunc
 
class  Model
 TRF model. More...
 
class  Model_FastSample
 TRF model, revise the sample method to speedup the MCMC. More...
 
class  Msg
 
class  RandSeq
 
class  SAfunc
 
class  SAtrain
 
class  Seq
 define a sequence including the word sequence and class sequence More...
 
class  ThreadData
 
class  VecIter
 
class  Vocab
 

Typedefs

typedef double PValue
 
typedef double LogP
 
typedef double Prob
 
typedef int VocabID
 

Functions

int omp_rand (int thread_num)
 
LogP LogLineNormalize (LogP *pdProbs, int nNum)
 
int LogLineSampling (const LogP *pdProbs, int nNum)
 
void LineNormalize (Prob *pdProbs, int nNum)
 
int LineSampling (const Prob *pdProbs, int nNum)
 
bool Acceptable (Prob prob)
 
void RandomPos (int *a, int len, int n)
 
double dRand (double dmin, double dmax)
 get a random float between dmin and dmax More...
 
int omp_nrand (int nMin, int nMax)
 get a random integer int [nMin, nMax-1] More...
 
void EasySmooth (Prob *p, int num, Prob threshold=1e-5)
 smooth a distribution More...
 
double GetAISFactor (int t, int T)
 Get the AIS intermediate factor beta_t. More...
 
double SigmFunc (double x)
 calculate the sigmoid function f(x) = 1/(1+exp(-x)) More...
 
Prob LogP2Prob (LogP x)
 
LogP Prob2LogP (Prob x)
 
LogP Log_Sum (LogP x, LogP y)
 
LogP Log_Sub (LogP x, LogP y)
 log[exp(x)-exp(y)] More...
 
LogP Log_Sum (LogP *p, int num)
 log summate all the values in array More...
 
int qsort_compare_double (const void *a, const void *b)
 

Variables

const float INF = 1e20
 
const float LogP_zero = -INF
 
const int c_nMaxOrder = 100
 
const int VocabID_none = -1
 
const int VocabID_seqbeg = -3
 
const int VocabID_seqend = -2
 

Typedef Documentation

§ LogP

typedef double trf::LogP

Definition at line 27 of file trf-def.h.

§ Prob

typedef double trf::Prob

Definition at line 28 of file trf-def.h.

§ PValue

typedef double trf::PValue

Definition at line 26 of file trf-def.h.

§ VocabID

typedef int trf::VocabID

Definition at line 23 of file trf-vocab.h.

Function Documentation

§ Acceptable()

bool trf::Acceptable ( Prob  prob)

Definition at line 127 of file trf-def.cpp.

§ dRand()

double trf::dRand ( double  dmin,
double  dmax 
)

get a random float between dmin and dmax

Definition at line 147 of file trf-def.cpp.

§ EasySmooth()

void trf::EasySmooth ( Prob p,
int  num,
Prob  threshold 
)

smooth a distribution

Definition at line 157 of file trf-def.cpp.

§ GetAISFactor()

double trf::GetAISFactor ( int  t,
int  T 
)

Get the AIS intermediate factor beta_t.

Definition at line 165 of file trf-def.cpp.

§ LineNormalize()

void trf::LineNormalize ( Prob pdProbs,
int  nNum 
)

Definition at line 87 of file trf-def.cpp.

§ LineSampling()

int trf::LineSampling ( const Prob pdProbs,
int  nNum 
)

Definition at line 103 of file trf-def.cpp.

§ Log_Sub()

LogP trf::Log_Sub ( LogP  x,
LogP  y 
)
inline

log[exp(x)-exp(y)]

Definition at line 44 of file trf-def.h.

§ Log_Sum() [1/2]

LogP trf::Log_Sum ( LogP  x,
LogP  y 
)
inline

Definition at line 40 of file trf-def.h.

§ Log_Sum() [2/2]

LogP trf::Log_Sum ( LogP p,
int  num 
)
inline

log summate all the values in array

Definition at line 48 of file trf-def.h.

§ LogLineNormalize()

LogP trf::LogLineNormalize ( LogP pdProbs,
int  nNum 
)

Definition at line 53 of file trf-def.cpp.

§ LogLineSampling()

int trf::LogLineSampling ( const LogP pdProbs,
int  nNum 
)

Definition at line 62 of file trf-def.cpp.

§ LogP2Prob()

Prob trf::LogP2Prob ( LogP  x)
inline

Definition at line 33 of file trf-def.h.

§ omp_nrand()

int trf::omp_nrand ( int  nMin,
int  nMax 
)

get a random integer int [nMin, nMax-1]

Definition at line 152 of file trf-def.cpp.

§ omp_rand()

int trf::omp_rand ( int  thread_num = -1)

a thread-safe version of rand() if thread_num != -1, then init the thread state if thread_num = -1, then get a random values.

Definition at line 23 of file trf-def.cpp.

§ Prob2LogP()

LogP trf::Prob2LogP ( Prob  x)
inline

Definition at line 36 of file trf-def.h.

§ qsort_compare_double()

int trf::qsort_compare_double ( const void *  a,
const void *  b 
)

Definition at line 137 of file trf-sa-train.cpp.

§ RandomPos()

void trf::RandomPos ( int *  a,
int  len,
int  n 
)

Definition at line 132 of file trf-def.cpp.

§ SigmFunc()

double trf::SigmFunc ( double  x)

calculate the sigmoid function f(x) = 1/(1+exp(-x))

Definition at line 177 of file trf-def.cpp.

Variable Documentation

§ c_nMaxOrder

const int trf::c_nMaxOrder = 100

Definition at line 24 of file trf-feature.h.

§ INF

const float trf::INF = 1e20

Definition at line 29 of file trf-def.h.

§ LogP_zero

const float trf::LogP_zero = -INF

Definition at line 30 of file trf-def.h.

§ VocabID_none

const int trf::VocabID_none = -1

Definition at line 24 of file trf-vocab.h.

§ VocabID_seqbeg

const int trf::VocabID_seqbeg = -3

Definition at line 25 of file trf-vocab.h.

§ VocabID_seqend

const int trf::VocabID_seqend = -2

Definition at line 26 of file trf-vocab.h.