diff options
author | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-29 00:36:09 +0000 |
---|---|---|
committer | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-29 00:36:09 +0000 |
commit | 594cc714737708bb7c90c24a1ab1537b052f45ee (patch) | |
tree | c3dca78e6c28379736f4b663e5c94b9dc40975cf /training/optimize.h | |
parent | 016b376714976bbf19510e07797c9787f29daf60 (diff) |
online optimizer
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@631 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'training/optimize.h')
-rw-r--r-- | training/optimize.h | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/training/optimize.h b/training/optimize.h index eddceaad..e2620f93 100644 --- a/training/optimize.h +++ b/training/optimize.h @@ -10,10 +10,10 @@ // abstract base class for first order optimizers // order of invocation: new, Load(), Optimize(), Save(), delete -class Optimizer { +class BatchOptimizer { public: - Optimizer() : eval_(1), has_converged_(false) {} - virtual ~Optimizer(); + BatchOptimizer() : eval_(1), has_converged_(false) {} + virtual ~BatchOptimizer(); virtual std::string Name() const = 0; int EvaluationCount() const { return eval_; } bool HasConverged() const { return has_converged_; } @@ -41,7 +41,7 @@ class Optimizer { bool has_converged_; }; -class RPropOptimizer : public Optimizer { +class RPropOptimizer : public BatchOptimizer { public: explicit RPropOptimizer(int num_vars, double eta_plus = 1.2, @@ -75,20 +75,7 @@ class RPropOptimizer : public Optimizer { const double delta_min_; }; -class SGDOptimizer : public Optimizer { - public: - explicit SGDOptimizer(int num_vars, double eta = 0.1) : eta_(eta) { - (void) num_vars; - } - std::string Name() const; - void OptimizeImpl(const double& obj, - const std::vector<double>& g, - std::vector<double>* x); - private: - const double eta_; -}; - -class LBFGSOptimizer : public Optimizer { +class LBFGSOptimizer : public BatchOptimizer { public: explicit LBFGSOptimizer(int num_vars, int memory_buffers = 10); std::string Name() const; |