From 1903cdb1edaf05d82d8782d446f1d2c39eb05f0c Mon Sep 17 00:00:00 2001 From: redpony Date: Sun, 29 Aug 2010 00:36:09 +0000 Subject: online optimizer git-svn-id: https://ws10smt.googlecode.com/svn/trunk@631 ec762483-ff6d-05da-a07a-a48fb63a330f --- training/optimize.h | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'training/optimize.h') 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& g, - std::vector* 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; -- cgit v1.2.3