am 673bbc97: Merge "Stop dividing unigram probability by 2 for backoff."
* commit '673bbc97e228d3467799675e23b0a419e2ec31b5': Stop dividing unigram probability by 2 for backoff.main
commit
fa5feda893
|
@ -30,6 +30,7 @@ const int ForgettingCurveUtils::MAX_UNIGRAM_COUNT_AFTER_GC = 10000;
|
||||||
const int ForgettingCurveUtils::MAX_BIGRAM_COUNT = 12000;
|
const int ForgettingCurveUtils::MAX_BIGRAM_COUNT = 12000;
|
||||||
const int ForgettingCurveUtils::MAX_BIGRAM_COUNT_AFTER_GC = 10000;
|
const int ForgettingCurveUtils::MAX_BIGRAM_COUNT_AFTER_GC = 10000;
|
||||||
|
|
||||||
|
const int ForgettingCurveUtils::MULTIPLIER_TWO_IN_PROBABILITY_SCALE = 8;
|
||||||
const int ForgettingCurveUtils::MAX_COMPUTED_PROBABILITY = 127;
|
const int ForgettingCurveUtils::MAX_COMPUTED_PROBABILITY = 127;
|
||||||
const int ForgettingCurveUtils::DECAY_INTERVAL_SECONDS = 2 * 60 * 60;
|
const int ForgettingCurveUtils::DECAY_INTERVAL_SECONDS = 2 * 60 * 60;
|
||||||
|
|
||||||
|
@ -84,7 +85,9 @@ const ForgettingCurveUtils::ProbabilityTable ForgettingCurveUtils::sProbabilityT
|
||||||
} else if (bigramProbability == NOT_A_PROBABILITY) {
|
} else if (bigramProbability == NOT_A_PROBABILITY) {
|
||||||
return min(backoff(unigramProbability), MAX_COMPUTED_PROBABILITY);
|
return min(backoff(unigramProbability), MAX_COMPUTED_PROBABILITY);
|
||||||
} else {
|
} else {
|
||||||
return min(max(unigramProbability, bigramProbability), MAX_COMPUTED_PROBABILITY);
|
// TODO: Investigate better way to handle bigram probability.
|
||||||
|
return min(max(unigramProbability, bigramProbability + MULTIPLIER_TWO_IN_PROBABILITY_SCALE),
|
||||||
|
MAX_COMPUTED_PROBABILITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,11 +140,8 @@ const ForgettingCurveUtils::ProbabilityTable ForgettingCurveUtils::sProbabilityT
|
||||||
|
|
||||||
// See comments in ProbabilityUtils::backoff().
|
// See comments in ProbabilityUtils::backoff().
|
||||||
/* static */ int ForgettingCurveUtils::backoff(const int unigramProbability) {
|
/* static */ int ForgettingCurveUtils::backoff(const int unigramProbability) {
|
||||||
if (unigramProbability == NOT_A_PROBABILITY) {
|
// See TODO comments in ForgettingCurveUtils::getProbability().
|
||||||
return NOT_A_PROBABILITY;
|
return unigramProbability;
|
||||||
} else {
|
|
||||||
return max(unigramProbability - 8, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int ForgettingCurveUtils::getElapsedTimeStepCount(const int timestamp) {
|
/* static */ int ForgettingCurveUtils::getElapsedTimeStepCount(const int timestamp) {
|
||||||
|
|
|
@ -72,6 +72,7 @@ class ForgettingCurveUtils {
|
||||||
std::vector<std::vector<std::vector<int> > > mTables;
|
std::vector<std::vector<std::vector<int> > > mTables;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const int MULTIPLIER_TWO_IN_PROBABILITY_SCALE;
|
||||||
static const int MAX_COMPUTED_PROBABILITY;
|
static const int MAX_COMPUTED_PROBABILITY;
|
||||||
static const int DECAY_INTERVAL_SECONDS;
|
static const int DECAY_INTERVAL_SECONDS;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue