TRF Language Model
|
#include <wb-solve.h>
Public Member Functions | |
LBFGS (Func *pfunc=NULL, double dtol=1e-5) | |
constructor More... | |
~LBFGS () | |
destructor More... | |
virtual void | IterInit () |
iter init More... | |
virtual void | ComputeDir (int k, const double *pdParam, const double *pdGradient, double *pdDir) |
Calculate the update direction p_k, referring to "Numerical Optimization"��P178��Algorithm 7.4. More... | |
void | CirQueueBuf_Init () |
Init the circular queue. More... | |
void | CirQueueBuf_Release () |
release the circular queue More... | |
void | CirQueueBuf_Prev (int i, double *&pd_s, double *&pd_y) |
find the previoud ith datas, i<=m_nLimitiedNum More... | |
void | CirQueueBuf_In (double *&pd_s, double *&pd_y) |
in queue. return the pointer. More... | |
Public Member Functions inherited from wb::Solve | |
Solve (Func *pfunc=NULL, double dtol=1e-5) | |
virtual bool | Run (const double *pInitParams=NULL) |
Run iteration. input the init-parameters. 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... | |
Protected Attributes | |
int | m_nLimitiedNum |
limited number, i.e. m More... | |
sy * | m_pCirQueueBuf |
the buffer of circular queue to store s_k = x_k - x_(k-1) and y_k = g_k - g_{k-1} More... | |
int | m_nCirQueueBufTail |
queue tail More... | |
double * | m_pd_s |
double * | m_pd_y |
current s_k = x_k - x_{k-1} and y_k More... | |
double * | m_pdPrevGradient |
gradient on previous iteration More... | |
double * | m_pdPrevParam |
parameter on previous iteration More... | |
double * | m_pdAlpha |
auxillary factor in ComputeDir More... | |
Protected Attributes inherited from wb::Solve | |
const char * | m_pAlgorithmName |
the algorithm name. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from wb::Solve | |
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 inherited from wb::Solve | |
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... | |
Definition at line 150 of file wb-solve.h.
|
inline |
constructor
Definition at line 169 of file wb-solve.h.
|
inline |
destructor
Definition at line 182 of file wb-solve.h.
void wb::LBFGS::CirQueueBuf_In | ( | double *& | pd_s, |
double *& | pd_y | ||
) |
in queue. return the pointer.
Definition at line 360 of file wb-solve.cpp.
void wb::LBFGS::CirQueueBuf_Init | ( | ) |
Init the circular queue.
Definition at line 334 of file wb-solve.cpp.
void wb::LBFGS::CirQueueBuf_Prev | ( | int | i, |
double *& | pd_s, | ||
double *& | pd_y | ||
) |
find the previoud ith datas, i<=m_nLimitiedNum
Definition at line 354 of file wb-solve.cpp.
void wb::LBFGS::CirQueueBuf_Release | ( | ) |
release the circular queue
Definition at line 343 of file wb-solve.cpp.
|
virtual |
Calculate the update direction p_k, referring to "Numerical Optimization"��P178��Algorithm 7.4.
Reimplemented from wb::Solve.
Definition at line 254 of file wb-solve.cpp.
|
virtual |
|
protected |
queue tail
Definition at line 160 of file wb-solve.h.
|
protected |
limited number, i.e. m
Definition at line 158 of file wb-solve.h.
|
protected |
the buffer of circular queue to store s_k = x_k - x_(k-1) and y_k = g_k - g_{k-1}
Definition at line 159 of file wb-solve.h.
|
protected |
Definition at line 161 of file wb-solve.h.
|
protected |
current s_k = x_k - x_{k-1} and y_k
Definition at line 161 of file wb-solve.h.
|
protected |
auxillary factor in ComputeDir
Definition at line 165 of file wb-solve.h.
|
protected |
gradient on previous iteration
Definition at line 163 of file wb-solve.h.
|
protected |
parameter on previous iteration
Definition at line 164 of file wb-solve.h.