From 27b987071d1f5d4dc180e7e044dfe79f4e00da06 Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 29 Apr 2020 20:21:27 +0300 Subject: [PATCH] add defaults for DecayInterval and DecayToZero --- score_params.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/score_params.go b/score_params.go index 64d39d5..813c167 100644 --- a/score_params.go +++ b/score_params.go @@ -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