TRF Language Model
|
the base class of all the solve classes, and provide a gradient descent algorithm. More...
#include <wb-solve.h>
Public Member Functions | |
Solve (Func *pfunc=NULL, double dtol=1e-5) | |
virtual bool | Run (const double *pInitParams=NULL) |
Run iteration. input the init-parameters. More... | |
virtual void | IterInit () |
initial the iteration, for derivation. More... | |
virtual void | ComputeDir (int k, const double *pdParam, const double *pdGradient, double *pdDir) |
Calculate the update direction p_k. More... | |
virtual double | LineSearch (double *pdDir, double dValue, const double *pdParam, const double *pdGradient) |
linear search. More... | |
virtual void | Update (double *pdParam, const double *pdDir, double dStep) |
Update. More... | |
virtual bool | StopDecision (int k, double dValue, const double *pdGradient) |
Stop decision. More... | |
Static Public Member Functions | |
static double | VecProduct (const double *pdVec1, const double *pdVec2, int nSize) |
calculate the dot of two vectors More... | |
static double | VecNorm (const double *pdVec, int nSize) |
calculate the norm of a vector More... | |
static double | VecDist (const double *pdVec1, const double *pdVec2, int nSize) |
calculate the distance of two vectors More... | |
Public Attributes | |
Func * | m_pfunc |
pointer to the function More... | |
double * | m_pdRoot |
save the root of the function More... | |
int | m_nIterNum |
current iteration number, iter form m_nIterMin to m_nIterMax More... | |
int | m_nIterMin |
minium iteration number More... | |
int | m_nIterMax |
maximum iteration number More... | |
double | m_dSpendMinute |
record the iteration spend time��minute�� More... | |
double | m_dStop |
stop threshold More... | |
double | m_dGain |
itera step. ==0 means using the line search . More... | |
Protected Attributes | |
const char * | m_pAlgorithmName |
the algorithm name. More... | |
the base class of all the solve classes, and provide a gradient descent algorithm.
Definition at line 77 of file wb-solve.h.
|
inline |
Definition at line 96 of file wb-solve.h.
|
virtual |
Calculate the update direction p_k.
[in] | k | iteration number, from 1 to ... |
[in] | pdParam | parameter x_k |
[in] | pdGradient | the gradient at x_k |
[out] | pdDir | return the direction |
Reimplemented in wb::LBFGS.
Definition at line 137 of file wb-solve.cpp.
|
inlinevirtual |
initial the iteration, for derivation.
Reimplemented in wb::LBFGS.
Definition at line 114 of file wb-solve.h.
|
virtual |
linear search.
[in] | pdDir | update direction p_k |
[in] | dValue | the function value at x_k |
[in] | pdGradient | the gradient at x_k |
[in] | pdCurParam | parameter x_k |
Ëã·¨²Î¼ÓNumerical Optimization£¬P57£¬½éÉܵÄinterpolationËã·¨
Definition at line 143 of file wb-solve.cpp.
|
virtual |
Run iteration. input the init-parameters.
< ±£´æµü´ú²½³¤
init
Reimplemented in hrf::SAtrain, and trf::SAtrain.
Definition at line 22 of file wb-solve.cpp.
|
virtual |
Stop decision.
Definition at line 210 of file wb-solve.cpp.
|
virtual |
Update.
Reimplemented in hrf::SAtrain, and trf::SAtrain.
Definition at line 204 of file wb-solve.cpp.
|
static |
calculate the distance of two vectors
Definition at line 231 of file wb-solve.cpp.
|
static |
calculate the norm of a vector
Definition at line 227 of file wb-solve.cpp.
|
static |
calculate the dot of two vectors
Definition at line 220 of file wb-solve.cpp.
double wb::Solve::m_dGain |
itera step. ==0 means using the line search .
Definition at line 93 of file wb-solve.h.
double wb::Solve::m_dSpendMinute |
record the iteration spend time��minute��
Definition at line 90 of file wb-solve.h.
double wb::Solve::m_dStop |
stop threshold
Definition at line 92 of file wb-solve.h.
int wb::Solve::m_nIterMax |
maximum iteration number
Definition at line 88 of file wb-solve.h.
int wb::Solve::m_nIterMin |
minium iteration number
Definition at line 87 of file wb-solve.h.
int wb::Solve::m_nIterNum |
current iteration number, iter form m_nIterMin to m_nIterMax
Definition at line 86 of file wb-solve.h.
|
protected |
the algorithm name.
Definition at line 80 of file wb-solve.h.
double* wb::Solve::m_pdRoot |
save the root of the function
Definition at line 84 of file wb-solve.h.
Func* wb::Solve::m_pfunc |
pointer to the function
Definition at line 82 of file wb-solve.h.