10 Optimizer(
const config::Optimizer& optimizer_config);
14 virtual void AllocateMemory(
const int rows,
const int cols);
15 virtual bool IsAllocated() {
return false; }
18 virtual void Optimize(
Matrix& gradient,
Matrix& parameter) = 0;
19 virtual void ReduceLearningRate(
float factor);
23 virtual void LoadParameters(hid_t file,
const string& prefix);
24 virtual void SaveParameters(hid_t file,
const string& prefix);
26 static Optimizer* ChooseOptimizer(
const config::Optimizer& config);
29 float GetDecayedEpsilon()
const;
30 void ApplyConstraints(
Matrix& parameter);
32 const config::Optimizer::Decay epsilon_decay_type_;
33 float epsilon_, minimum_epsilon_;
34 const int epsilon_decay_timescale_, start_optimization_after_;
35 const float l2_decay_, weight_norm_limit_, weight_norm_constraint_;
45 virtual void AllocateMemory(
const int rows,
const int cols);
46 virtual void Optimize(
Matrix& gradient,
Matrix& parameter);
47 virtual void LoadParameters(hid_t file,
const string& prefix);
48 virtual void SaveParameters(hid_t file,
const string& prefix);
49 virtual bool IsAllocated() {
return gradient_history_.GetNumEls() > 0; }
52 float GetMomentum()
const;
55 const float gradient_clip_;
58 const float initial_momentum_, final_momentum_;
59 const int momentum_transition_timescale_;
68 virtual void AllocateMemory(
const int rows,
const int cols);
69 virtual void Optimize(
Matrix& gradient,
Matrix& parameter);
70 virtual void LoadParameters(hid_t file,
const string& prefix);
71 virtual void SaveParameters(hid_t file,
const string& prefix);
72 virtual bool IsAllocated() {
return q_.GetNumEls() > 0; }
75 Matrix q_, last_q_, last_w_;
77 vector<float> rho_, alpha_, beta_;
78 vector<Matrix> s_, y_;
Base class for all optimizers.
Definition: optimizer.h:8
A GPU matrix class.
Definition: matrix.h:11
Stochastic gradient descent.
Definition: optimizer.h:42
Implmenets LBFGS optimization.
Definition: optimizer.h:65