TRF Language Model
|
#include <hrf-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) |
Model * | GetModel () const |
virtual void | SetParam (double *pdParams) |
set the parameter. More... | |
void | GetParam (double *pdParams) |
virtual double | GetLL (CorpusBase *pCorpus, int nCalNum=-1) |
calculate the log-likelihood on corpus 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... | |
CorpusBase * | m_pCorpusTrain |
training corpus More... | |
CorpusBase * | m_pCorpusValid |
valid corpus More... | |
CorpusBase * | m_pCorpusTest |
test corpus More... | |
Vec< PValue > | m_values |
Vec< Prob > | m_trainPi |
the length distribution in training corpus 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 15 of file hrf-ml-train.h.
|
inline |
Definition at line 31 of file hrf-ml-train.h.
hrf::MLfunc::MLfunc | ( | Model * | pModel, |
CorpusBase * | pTrain, | ||
CorpusBase * | pValid = NULL , |
||
CorpusBase * | pTest = NULL |
||
) |
Definition at line 6 of file hrf-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 hrf::SAfunc.
Definition at line 193 of file hrf-ml-train.cpp.
|
virtual |
calculate the gradient g(x)
Implements wb::Func.
Reimplemented in hrf::SAfunc.
Definition at line 149 of file hrf-ml-train.cpp.
|
virtual |
calculate the log-likelihood on corpus
Definition at line 78 of file hrf-ml-train.cpp.
|
inline |
Definition at line 36 of file hrf-ml-train.h.
void hrf::MLfunc::GetParam | ( | double * | pdParams | ) |
Definition at line 68 of file hrf-ml-train.cpp.
|
virtual |
calculate the function value f(x)
Implements wb::Func.
Reimplemented in hrf::SAfunc.
Definition at line 141 of file hrf-ml-train.cpp.
void hrf::MLfunc::Reset | ( | Model * | pModel, |
CorpusBase * | pTrain, | ||
CorpusBase * | pValid = NULL , |
||
CorpusBase * | pTest = NULL |
||
) |
Check maximum length
calculate the length distribution in training corpus
Definition at line 12 of file hrf-ml-train.cpp.
|
virtual |
set the parameter.
Implements wb::Func.
Reimplemented in hrf::SAfunc.
Definition at line 57 of file hrf-ml-train.cpp.
const char* hrf::MLfunc::m_pathOutputModel |
Write to model during iteration.
Definition at line 28 of file hrf-ml-train.h.
|
protected |
test corpus
Definition at line 22 of file hrf-ml-train.h.
|
protected |
training corpus
Definition at line 20 of file hrf-ml-train.h.
|
protected |
valid corpus
Definition at line 21 of file hrf-ml-train.h.
|
protected |
HRF model.
Definition at line 18 of file hrf-ml-train.h.
the length distribution in training corpus
Definition at line 25 of file hrf-ml-train.h.
Definition at line 24 of file hrf-ml-train.h.