Changeset 11851 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions
- Timestamp:
- 02/01/15 20:30:44 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions
-
Property
svn:ignore
set to
bin
*.user
obj
-
Property
svn:ignore
set to
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/BernoulliModel.cs
r11849 r11851 22 22 } 23 23 24 public double Sample ExpectedReward(Random random) {24 public double Sample(Random random) { 25 25 // sample bernoulli mean from beta prior 26 26 return Rand.BetaRand(random, success + alpha, failure + beta); … … 41 41 } 42 42 43 public void PrintStats() {44 Console.Write("{0:F2} ", success / (double)failure);45 }46 47 43 public object Clone() { 48 44 return new BernoulliModel() { failure = this.failure, success = this.success }; -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/GaussianMixtureModel.cs
r11849 r11851 23 23 24 24 25 public double Sample ExpectedReward(Random random) {25 public double Sample(Random random) { 26 26 var k = Enumerable.Range(0, numComponents).SampleProportional(random, componentProbs); 27 27 return alglib.invnormaldistribution(random.NextDouble()) * Math.Sqrt(componentVars[k]) + componentMeans[k]; … … 96 96 this.componentVars = Enumerable.Range(0, numComponents).Select((_) => 0.01).ToArray(); 97 97 } 98 99 public void PrintStats() {100 throw new NotImplementedException();101 }102 98 } 103 99 } -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/GaussianModel.cs
r11849 r11851 45 45 46 46 47 public double Sample ExpectedReward(Random random) {47 public double Sample(Random random) { 48 48 if (knownVariance) { 49 49 return SampleExpectedRewardKnownVariance(random); … … 113 113 } 114 114 115 public void PrintStats() {116 Console.Write("{0:F2} ", estimator.Avg);117 }118 119 115 public object Clone() { 120 116 if (knownVariance) -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/HeuristicLab.Distributions.csproj
r11849 r11851 36 36 <Reference Include="System" /> 37 37 <Reference Include="System.Core" /> 38 <Reference Include="System.Xml.Linq" />39 <Reference Include="System.Data.DataSetExtensions" />40 <Reference Include="Microsoft.CSharp" />41 <Reference Include="System.Data" />42 <Reference Include="System.Xml" />43 38 </ItemGroup> 44 39 <ItemGroup> -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/IModel.cs
r11849 r11851 8 8 // represents a model for the reward distribution (of an action given a state) 9 9 public interface IModel : ICloneable { 10 double Sample ExpectedReward(Random random);10 double Sample(Random random); 11 11 void Update(double reward); 12 12 void Reset(); 13 void PrintStats();14 13 } 15 14 } -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Distributions/LogitNormalModel.cs
r11849 r11851 13 13 14 14 15 public double Sample ExpectedReward(Random random) {16 return 1.0 / (1 + Math.Exp(-gaussian.Sample ExpectedReward(random)));15 public double Sample(Random random) { 16 return 1.0 / (1 + Math.Exp(-gaussian.Sample(random))); 17 17 } 18 18 … … 23 23 public void Reset() { 24 24 gaussian.Reset(); 25 }26 27 public void PrintStats() {28 25 } 29 26
Note: See TracChangeset
for help on using the changeset viewer.