add defaults for DecayInterval and DecayToZero

This commit is contained in:
vyzo 2020-04-29 20:21:27 +03:00
parent d9788290f3
commit 27b987071d
1 changed files with 6 additions and 1 deletions

View File

@ -243,10 +243,15 @@ func (p *TopicScoreParams) validate() error {
return nil
}
const (
DefaultDecayInterval = time.Second
DefaultDecayToZero = 0.01
)
// ScoreParameterDecay computes the decay factor for a parameter, assuming the DecayInterval is 1s
// and that the value decays to zero if it drops below 0.01
func ScoreParameterDecay(decay time.Duration) float64 {
return ScoreParameterDecayWithBase(decay, time.Second, 0.01)
return ScoreParameterDecayWithBase(decay, DefaultDecayInterval, DefaultDecayToZero)
}
// ScoreParameterDecay computes the decay factor for a parameter using base as the DecayInterval