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 | 1903cdb1edaf05d82d8782d446f1d2c39eb05f0c (patch) | |
tree | 0873c3ce979b6ef5476ce0ae735f434763ce97d1 /training/optimize.h | |
parent | fabdc7bc3cd5a83c2c74768bfc46146b4f3221b4 (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; |