Changeset 11727 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.Test/TestBanditPolicies.cs
- Timestamp:
- 12/29/14 11:02:36 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.Test/TestBanditPolicies.cs
r11710 r11727 15 15 var seedForPolicy = globalRand.Next(); 16 16 var nArms = 10; 17 //Console.WriteLine("Exp3 (gamma=0.01)"); 18 //TestPolicyBernoulli(globalRand, nArms, new Exp3Policy(new Random(seedForPolicy), nArms, 1)); 19 //Console.WriteLine("Exp3 (gamma=0.05)"); 20 //estPolicyBernoulli(globalRand, nArms, new Exp3Policy(new Random(seedForPolicy), nArms, 1)); 21 Console.WriteLine("Thompson (Bernoulli)"); 22 TestPolicyBernoulli(globalRand, nArms, new BernoulliThompsonSamplingPolicy(new Random(seedForPolicy), nArms)); 17 23 Console.WriteLine("Random"); 18 TestPolicyBernoulli(globalRand, nArms, new RandomPolicy(new Random(seedForPolicy), 10));24 TestPolicyBernoulli(globalRand, nArms, new RandomPolicy(new Random(seedForPolicy), nArms)); 19 25 Console.WriteLine("UCB1"); 20 TestPolicyBernoulli(globalRand, nArms, new UCB1Policy( 10));26 TestPolicyBernoulli(globalRand, nArms, new UCB1Policy(nArms)); 21 27 Console.WriteLine("UCB1Tuned"); 22 TestPolicyBernoulli(globalRand, nArms, new UCB1TunedPolicy( 10));28 TestPolicyBernoulli(globalRand, nArms, new UCB1TunedPolicy(nArms)); 23 29 Console.WriteLine("UCB1Normal"); 24 TestPolicyBernoulli(globalRand, nArms, new UCBNormalPolicy( 10));30 TestPolicyBernoulli(globalRand, nArms, new UCBNormalPolicy(nArms)); 25 31 Console.WriteLine("Eps(0.01)"); 26 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.01));32 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.01)); 27 33 Console.WriteLine("Eps(0.05)"); 28 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.05));29 Console.WriteLine("Eps(0.1)");30 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.1));31 Console.WriteLine("Eps(0.2)");32 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.2));33 Console.WriteLine("Eps(0.5)");34 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.5));34 TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.05)); 35 //Console.WriteLine("Eps(0.1)"); 36 //TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.1)); 37 //Console.WriteLine("Eps(0.2)"); 38 //TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.2)); 39 //Console.WriteLine("Eps(0.5)"); 40 //TestPolicyBernoulli(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.5)); 35 41 } 36 42 [TestMethod] … … 40 46 var seedForPolicy = globalRand.Next(); 41 47 var nArms = 10; 48 Console.WriteLine("Thompson (Gaussian)"); 49 TestPolicyNormal(globalRand, nArms, new GaussianThompsonSamplingPolicy(new Random(seedForPolicy), nArms)); 42 50 Console.WriteLine("Random"); 43 TestPolicyNormal(globalRand, nArms, new RandomPolicy(new Random(seedForPolicy), 10));51 TestPolicyNormal(globalRand, nArms, new RandomPolicy(new Random(seedForPolicy), nArms)); 44 52 Console.WriteLine("UCB1"); 45 TestPolicyNormal(globalRand, nArms, new UCB1Policy( 10));53 TestPolicyNormal(globalRand, nArms, new UCB1Policy(nArms)); 46 54 Console.WriteLine("UCB1Tuned"); 47 TestPolicyNormal(globalRand, nArms, new UCB1TunedPolicy( 10));55 TestPolicyNormal(globalRand, nArms, new UCB1TunedPolicy(nArms)); 48 56 Console.WriteLine("UCB1Normal"); 49 TestPolicyNormal(globalRand, nArms, new UCBNormalPolicy(10)); 57 TestPolicyNormal(globalRand, nArms, new UCBNormalPolicy(nArms)); 58 //Console.WriteLine("Exp3 (gamma=0.01)"); 59 //TestPolicyNormal(globalRand, nArms, new Exp3Policy(new Random(seedForPolicy), nArms, 0.01)); 60 //Console.WriteLine("Exp3 (gamma=0.05)"); 61 //TestPolicyNormal(globalRand, nArms, new Exp3Policy(new Random(seedForPolicy), nArms, 0.05)); 50 62 Console.WriteLine("Eps(0.01)"); 51 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.01));63 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.01)); 52 64 Console.WriteLine("Eps(0.05)"); 53 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.05));54 Console.WriteLine("Eps(0.1)");55 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.1));56 Console.WriteLine("Eps(0.2)");57 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.2));58 Console.WriteLine("Eps(0.5)");59 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), 10, 0.5));65 TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.05)); 66 //Console.WriteLine("Eps(0.1)"); 67 //TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.1)); 68 //Console.WriteLine("Eps(0.2)"); 69 //TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.2)); 70 //Console.WriteLine("Eps(0.5)"); 71 //TestPolicyNormal(globalRand, nArms, new EpsGreedyPolicy(new Random(seedForPolicy), nArms, 0.5)); 60 72 } 61 73
Note: See TracChangeset
for help on using the changeset viewer.