diff options
author | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2012-06-01 04:49:42 +0400 |
---|---|---|
committer | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2012-06-01 04:49:42 +0400 |
commit | 6a6a35c65eaeb42b3f1aa44237332dd6f1bc652c (patch) | |
tree | 8a02d798832fe36e9efb60f8a2e30d9368728a13 /mira/Optimiser.h | |
parent | 62d10a2af3f9509bf7680b8549ff1ffd9774dd83 (diff) |
fix start weights in experiment.perl, add hypothesis queue for picking hope and fear translations, add variations to 1slack formulation
Diffstat (limited to 'mira/Optimiser.h')
-rw-r--r--[-rwxr-xr-x] | mira/Optimiser.h | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/mira/Optimiser.h b/mira/Optimiser.h index 8ad38bd5a..b91ad2c4f 100755..100644 --- a/mira/Optimiser.h +++ b/mira/Optimiser.h @@ -31,7 +31,6 @@ namespace Mira { Optimiser() {} virtual size_t updateWeightsHopeFear( - Moses::ScoreComponentCollection& currWeights, Moses::ScoreComponentCollection& weightUpdate, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesHope, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesFear, @@ -48,7 +47,6 @@ namespace Mira { class Perceptron : public Optimiser { public: virtual size_t updateWeightsHopeFear( - Moses::ScoreComponentCollection& currWeights, Moses::ScoreComponentCollection& weightUpdate, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesHope, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesFear, @@ -80,8 +78,7 @@ namespace Mira { m_normaliseMargin(normaliseMargin), m_sigmoidParam(sigmoidParam) { } - size_t updateWeights(Moses::ScoreComponentCollection& currWeights, - Moses::ScoreComponentCollection& weightUpdate, + size_t updateWeights(Moses::ScoreComponentCollection& weightUpdate, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValues, const std::vector<std::vector<float> >& losses, const std::vector<std::vector<float> >& bleuScores, @@ -92,8 +89,7 @@ namespace Mira { float learning_rate, size_t rank, size_t epoch); - virtual size_t updateWeightsHopeFear(Moses::ScoreComponentCollection& currWeights, - Moses::ScoreComponentCollection& weightUpdate, + virtual size_t updateWeightsHopeFear(Moses::ScoreComponentCollection& weightUpdate, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesHope, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesFear, const std::vector<std::vector<float> >& bleuScoresHope, @@ -104,8 +100,31 @@ namespace Mira { size_t rank, size_t epoch, int updatePosition = -1); - size_t updateWeightsAnalytically(Moses::ScoreComponentCollection& currWeights, - Moses::ScoreComponentCollection& weightUpdate, + size_t updateWeightsHopeFearSelective(Moses::ScoreComponentCollection& weightUpdate, + const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesHope, + const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesFear, + const std::vector<std::vector<float> >& bleuScoresHope, + const std::vector<std::vector<float> >& bleuScoresFear, + const std::vector<std::vector<float> >& modelScoresHope, + const std::vector<std::vector<float> >& modelScoresFear, + float learning_rate, + size_t rank, + size_t epoch, + int updatePosition = -1); + size_t updateWeightsHopeFearSummed(Moses::ScoreComponentCollection& weightUpdate, + const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesHope, + const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValuesFear, + const std::vector<std::vector<float> >& bleuScoresHope, + const std::vector<std::vector<float> >& bleuScoresFear, + const std::vector<std::vector<float> >& modelScoresHope, + const std::vector<std::vector<float> >& modelScoresFear, + float learning_rate, + size_t rank, + size_t epoch, + bool rescaleSlack, + bool rewardHope, + bool makePairs); + size_t updateWeightsAnalytically(Moses::ScoreComponentCollection& weightUpdate, Moses::ScoreComponentCollection& featureValuesHope, Moses::ScoreComponentCollection& featureValuesFear, float bleuScoreHope, @@ -115,15 +134,21 @@ namespace Mira { float learning_rate, size_t rank, size_t epoch); - size_t updateWeightsRankModel(Moses::ScoreComponentCollection& currWeights, - Moses::ScoreComponentCollection& weightUpdate, + size_t updateWeightsRankModel(Moses::ScoreComponentCollection& weightUpdate, const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValues, const std::vector<std::vector<float> >& bleuScores, const std::vector<std::vector<float> >& modelScores, float learning_rate, size_t rank, size_t epoch); - + size_t updateWeightsRankModelSummed(Moses::ScoreComponentCollection& weightUpdate, + const std::vector<std::vector<Moses::ScoreComponentCollection> >& featureValues, + const std::vector<std::vector<float> >& bleuScores, + const std::vector<std::vector<float> >& modelScores, + float learning_rate, + size_t rank, + size_t epoch); + void setSlack(float slack) { m_slack = slack; } |