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 | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Diagnostics;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Text;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 |
|
---|
8 | namespace 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.