Skip to content

Commit

Permalink
add decay to hit-rate estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Corduan committed Oct 23, 2020
1 parent ceb5d0e commit d721a9d
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ import Shelley.Spec.Ledger.PParams
emptyPParams,
)
import Shelley.Spec.Ledger.Rewards
( Likelihood,
( Likelihood (..),
LogWeight (..),
NonMyopic (..),
emptyNonMyopic,
reward,
Expand Down Expand Up @@ -1047,9 +1048,18 @@ updateNonMypopic nm rPot newLikelihoods =
}
where
history = likelihoodsNM nm
performance kh newPerf = fromMaybe mempty (Map.lookup kh history) <> newPerf
performance kh newPerf =
fromMaybe
mempty
(applyDecay 0.9 <$> Map.lookup kh history)
<> newPerf
updatedLikelihoods = Map.mapWithKey performance newLikelihoods

applyDecay :: Float -> Likelihood -> Likelihood
applyDecay decay (Likelihood logWeights) = Likelihood $ mul decay <$> logWeights
where
mul x (LogWeight f) = LogWeight (x * f)

-- | Create a reward update
createRUpd ::
EpochSize ->
Expand Down

0 comments on commit d721a9d

Please sign in to comment.