Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/LogitNormalModel.cs @ 11849

Last change on this file since 11849 was 11849, checked in by gkronber, 8 years ago

#2283: solution reorganization

File size: 885 bytes
Line 
1using System;
2using System.Runtime.InteropServices;
3using HeuristicLab.Common;
4
5namespace 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.