Line | |
---|
1 | using System;
|
---|
2 | using System.Runtime.InteropServices;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Algorithms.Bandits.Models {
|
---|
6 | public class LogitNormalModel : IModel {
|
---|
7 |
|
---|
8 | private readonly GaussianModel gaussian;
|
---|
9 |
|
---|
10 | // this constructor assumes the variance is known
|
---|
11 | public LogitNormalModel() { gaussian = new GaussianModel(0, 1000, 1, 1); }
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 | public double SampleExpectedReward(Random random) {
|
---|
16 | return 1.0 / (1 + Math.Exp(-gaussian.SampleExpectedReward(random)));
|
---|
17 | }
|
---|
18 |
|
---|
19 | public void Update(double reward) {
|
---|
20 | gaussian.Update(Math.Log(reward / (1 - reward)));
|
---|
21 | }
|
---|
22 |
|
---|
23 | public void Reset() {
|
---|
24 | gaussian.Reset();
|
---|
25 | }
|
---|
26 |
|
---|
27 | public void PrintStats() {
|
---|
28 | }
|
---|
29 |
|
---|
30 | public object Clone() {
|
---|
31 | return new LogitNormalModel();
|
---|
32 | }
|
---|
33 |
|
---|
34 | public override string ToString() {
|
---|
35 | return string.Empty;
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.