Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Algorithms.Bandits/ActionInfos/MeanAndVariancePolicyActionInfo.cs @ 12290

Last change on this file since 12290 was 12290, checked in by gkronber, 10 years ago

#2283 created a new branch to separate development from aballeit

File size: 997 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Diagnostics;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
8namespace HeuristicLab.Algorithms.Bandits.BanditPolicies {
9  public class MeanAndVariancePolicyActionInfo : IBanditPolicyActionInfo {
10    private OnlineMeanAndVarianceEstimator estimator = new OnlineMeanAndVarianceEstimator();
11    public int Tries { get { return estimator.N; } }
12    public double SumReward { get { return estimator.Sum; } }
13    public double AvgReward { get { return estimator.Avg; } }
14    public double RewardVariance { get { return estimator.Variance; } }
15    public double Value {
16      get {
17        return AvgReward;
18      }
19    }
20
21    public void UpdateReward(double reward) {
22      estimator.UpdateReward(reward);
23    }
24
25    public void Reset() {
26      estimator.Reset();
27    }
28
29    public override string ToString() {
30      return string.Format("{0:N3} {1,3}", AvgReward, Tries);
31    }
32  }
33}
Note: See TracBrowser for help on using the repository browser.