diff options
author | tosch <tosch@linux-hs3m.site> | 2012-03-30 13:50:23 +0400 |
---|---|---|
committer | tosch <tosch@linux-hs3m.site> | 2012-03-30 13:50:23 +0400 |
commit | fab03f5a6e34e23f69063e0f6766c59cfbeebcd1 (patch) | |
tree | feb7f4ec185df8bb419a8b97d25cb16a58774174 /mert/Optimizer.h | |
parent | 292c75cb1ac8d92dcb56cf04821440e7974e6f09 (diff) |
added an (optional) positivity constraint to MERT
Diffstat (limited to 'mert/Optimizer.h')
-rw-r--r-- | mert/Optimizer.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/mert/Optimizer.h b/mert/Optimizer.h index 34dce01a7..e1c2195c5 100644 --- a/mert/Optimizer.h +++ b/mert/Optimizer.h @@ -22,8 +22,10 @@ protected: FeatureDataHandle m_feature_data; // no accessor for them only child can use them unsigned int m_num_random_directions; + const vector<bool>& positive; + public: - Optimizer(unsigned Pd, const vector<unsigned>& i2O, const vector<parameter_t>& start, unsigned int nrandom); + Optimizer(unsigned Pd, const vector<unsigned>& i2O, const vector<bool>& positive, const vector<parameter_t>& start, unsigned int nrandom); void SetScorer(Scorer *scorer) { m_scorer = scorer; } void SetFeatureData(FeatureDataHandle feature_data) { m_feature_data = feature_data; } @@ -75,8 +77,9 @@ class SimpleOptimizer : public Optimizer private: const float kEPS; public: - SimpleOptimizer(unsigned dim, const vector<unsigned>& i2O, const vector<parameter_t>& start, unsigned int nrandom) - : Optimizer(dim, i2O, start,nrandom), kEPS(0.0001) {} + SimpleOptimizer(unsigned dim, const vector<unsigned>& i2O, const vector<bool>& positive, + const vector<parameter_t>& start, unsigned int nrandom) + : Optimizer(dim, i2O, positive, start,nrandom), kEPS(0.0001) {} virtual statscore_t TrueRun(Point&) const; }; @@ -88,8 +91,9 @@ class RandomDirectionOptimizer : public Optimizer private: const float kEPS; public: - RandomDirectionOptimizer(unsigned dim, const vector<unsigned>& i2O, const vector<parameter_t>& start, unsigned int nrandom) - : Optimizer(dim, i2O, start, nrandom), kEPS(0.0001) {} + RandomDirectionOptimizer(unsigned dim, const vector<unsigned>& i2O, const vector<bool>& positive, + const vector<parameter_t>& start, unsigned int nrandom) + : Optimizer(dim, i2O, positive, start, nrandom), kEPS(0.0001) {} virtual statscore_t TrueRun(Point&) const; }; @@ -99,8 +103,9 @@ public: class RandomOptimizer : public Optimizer { public: - RandomOptimizer(unsigned dim, const vector<unsigned>& i2O, const vector<parameter_t>& start, unsigned int nrandom) - : Optimizer(dim, i2O, start, nrandom) {} + RandomOptimizer(unsigned dim, const vector<unsigned>& i2O, const vector<bool>& positive, + const vector<parameter_t>& start, unsigned int nrandom) + : Optimizer(dim, i2O, positive, start, nrandom) {} virtual statscore_t TrueRun(Point&) const; }; |