TRF Language Model
|
#include <trf-ml-train.h>
Public Member Functions | |
MLfunc () | |
MLfunc (Model *pModel, CorpusBase *pTrain, CorpusBase *pValid=NULL, CorpusBase *pTest=NULL) | |
void | Reset (Model *pModel, CorpusBase *pTrain, CorpusBase *pValid=NULL, CorpusBase *pTest=NULL) |
virtual void | SetParam (double *pdParams) |
set the parameter. More... | |
void | GetParam (double *pdParams) |
virtual double | GetLL (CorpusBase *pCorpus, int nCalNum=-1, Vec< double > *pLL=NULL) |
calculate the log-likelihood on corpus More... | |
void | GetEmpExp (CorpusBase *pCorpus, Vec< double > &vExp) |
get the empirical expectation More... | |
virtual double | GetValue () |
calculate the function value f(x) More... | |
virtual void | GetGradient (double *pdGradient) |
calculate the gradient g(x) More... | |
virtual int | GetExtraValues (int t, double *pdValues) |
calculate extra values which will be print at each iteration More... | |
Public Member Functions inherited from wb::Func | |
Func (int nParamNum=0) | |
void | SetParamNum (int n) |
setting the parameter number More... | |
int | GetParamNum () const |
get the paremeter number More... | |
Public Attributes | |
const char * | m_pathOutputModel |
Write to model during iteration. More... | |
Protected Attributes | |
Model * | m_pModel |
HRF model. More... | |
Vec< PValue > | m_value |
save the temp value of type PValue. More... | |
CorpusBase * | m_pCorpusTrain |
training corpus More... | |
CorpusBase * | m_pCorpusValid |
valid corpus More... | |
CorpusBase * | m_pCorpusTest |
test corpus More... | |
Vec< Prob > | m_trainPi |
the length distribution in training corpus More... | |
Vec< double > | m_vEmpiricalExp |
the empirical expectation More... | |
Protected Attributes inherited from wb::Func | |
Solve * | m_pSolve |
Save the solve pointor. More... | |
int | m_nParamNum |
the parameter number More... | |
Additional Inherited Members | |
Static Public Attributes inherited from wb::Func | |
static const int | cn_exvalue_max_num = 100 |
Definition at line 30 of file trf-ml-train.h.
|
inline |
Definition at line 47 of file trf-ml-train.h.
trf::MLfunc::MLfunc | ( | Model * | pModel, |
CorpusBase * | pTrain, | ||
CorpusBase * | pValid = NULL , |
||
CorpusBase * | pTest = NULL |
||
) |
Definition at line 23 of file trf-ml-train.cpp.
void trf::MLfunc::GetEmpExp | ( | CorpusBase * | pCorpus, |
Vec< double > & | vExp | ||
) |
get the empirical expectation
Definition at line 146 of file trf-ml-train.cpp.
|
virtual |
calculate extra values which will be print at each iteration
[in] | k | iteration number form 1 to ... |
[out] | pdValues | Return the values needed to be outputed. The memory is allocated outside and the maximum size = cn_exvalue_max_num |
Reimplemented from wb::Func.
Reimplemented in trf::SAfunc.
Definition at line 200 of file trf-ml-train.cpp.
|
virtual |
calculate the gradient g(x)
Implements wb::Func.
Reimplemented in trf::SAfunc.
Definition at line 183 of file trf-ml-train.cpp.
|
virtual |
calculate the log-likelihood on corpus
Definition at line 102 of file trf-ml-train.cpp.
void trf::MLfunc::GetParam | ( | double * | pdParams | ) |
Definition at line 91 of file trf-ml-train.cpp.
|
virtual |
calculate the function value f(x)
Implements wb::Func.
Reimplemented in trf::SAfunc.
Definition at line 175 of file trf-ml-train.cpp.
void trf::MLfunc::Reset | ( | Model * | pModel, |
CorpusBase * | pTrain, | ||
CorpusBase * | pValid = NULL , |
||
CorpusBase * | pTest = NULL |
||
) |
Check maximum length
calculate the length distribution in training corpus
get empirical expectation
Definition at line 29 of file trf-ml-train.cpp.
|
virtual |
set the parameter.
Implements wb::Func.
Reimplemented in trf::SAfunc.
Definition at line 79 of file trf-ml-train.cpp.
const char* trf::MLfunc::m_pathOutputModel |
Write to model during iteration.
Definition at line 44 of file trf-ml-train.h.
|
protected |
test corpus
Definition at line 38 of file trf-ml-train.h.
|
protected |
training corpus
Definition at line 36 of file trf-ml-train.h.
|
protected |
valid corpus
Definition at line 37 of file trf-ml-train.h.
|
protected |
HRF model.
Definition at line 33 of file trf-ml-train.h.
the length distribution in training corpus
Definition at line 40 of file trf-ml-train.h.
save the temp value of type PValue.
Definition at line 34 of file trf-ml-train.h.
|
protected |
the empirical expectation
Definition at line 42 of file trf-ml-train.h.