- Timestamp:
- 06/12/14 13:26:18 (10 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/DataPreprocessing/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Tests merged: 10578,10646,10652,10790,10895-10896,10983
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs
r10538 r11009 28 28 using HeuristicLab.Algorithms.GeneticAlgorithm; 29 29 using HeuristicLab.Algorithms.LocalSearch; 30 using HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm; 30 31 using HeuristicLab.Algorithms.ParticleSwarmOptimization; 31 32 using HeuristicLab.Algorithms.RAPGA; … … 36 37 using HeuristicLab.Data; 37 38 using HeuristicLab.Encodings.BinaryVectorEncoding; 39 using HeuristicLab.Encodings.IntegerVectorEncoding; 38 40 using HeuristicLab.Encodings.PermutationEncoding; 39 41 using HeuristicLab.Encodings.RealVectorEncoding; … … 62 64 using HeuristicLab.Selection; 63 65 using Microsoft.VisualStudio.TestTools.UnitTesting; 66 using StdDevStrategyVectorCreator = HeuristicLab.Encodings.RealVectorEncoding.StdDevStrategyVectorCreator; 67 using StdDevStrategyVectorCrossover = HeuristicLab.Encodings.RealVectorEncoding.StdDevStrategyVectorCrossover; 68 using StdDevStrategyVectorManipulator = HeuristicLab.Encodings.RealVectorEncoding.StdDevStrategyVectorManipulator; 64 69 65 70 … … 265 270 Assert.AreEqual(0, GetDoubleResult(ga, "CurrentWorstQuality"), 1E-8); 266 271 Assert.AreEqual(50950, GetIntResult(ga, "EvaluatedSolutions")); 272 var bestTrainingSolution = (IRegressionSolution)ga.Results["Best training solution"].Value; 273 Assert.AreEqual(0.85504801557844745, bestTrainingSolution.TrainingRSquared, 1E-8); 274 Assert.AreEqual(0.86259381948647817, bestTrainingSolution.TestRSquared, 1E-8); 275 var bestValidationSolution = (IRegressionSolution)ga.Results["Best validation solution"].Value; 276 Assert.AreEqual(0.84854338315539746, bestValidationSolution.TrainingRSquared, 1E-8); 277 Assert.AreEqual(0.8662813452656678, bestValidationSolution.TestRSquared, 1E-8); 267 278 } 268 279 … … 377 388 Assert.AreEqual(0.80875, bestTrainingSolution.TrainingAccuracy, 1E-8); 378 389 Assert.AreEqual(0.795031055900621, bestTrainingSolution.TestAccuracy, 1E-8); 390 var bestValidationSolution = (IClassificationSolution)ga.Results["Best validation solution"].Value; 391 Assert.AreEqual(0.81375, bestValidationSolution.TrainingAccuracy, 1E-8); 392 Assert.AreEqual(0.788819875776398, bestValidationSolution.TestAccuracy, 1E-8); 379 393 } 380 394 … … 1185 1199 #endregion 1186 1200 1201 #region grammatical evolution 1202 #region artificial ant 1203 [TestMethod] 1204 [TestCategory("Samples.Create")] 1205 [TestProperty("Time", "medium")] 1206 public void CreateGeArtificialAntSampleTest() { 1207 var geaa = CreateGeArtificialAntSample(); 1208 XmlGenerator.Serialize(geaa, @"Samples\GE_ArtificialAnt.hl"); 1209 } 1210 1211 [TestMethod] 1212 [TestCategory("Samples.Execute")] 1213 [TestProperty("Time", "long")] 1214 public void RunGeArtificalAntSampleTest() { 1215 var ga = CreateGeArtificialAntSample(); 1216 ga.SetSeedRandomly.Value = false; 1217 RunAlgorithm(ga); 1218 } 1219 1220 public OffspringSelectionGeneticAlgorithm CreateGeArtificialAntSample() { 1221 OffspringSelectionGeneticAlgorithm ga = new OffspringSelectionGeneticAlgorithm(); 1222 #region Problem Configuration 1223 var problem = new HeuristicLab.Problems.GrammaticalEvolution.GEArtificialAntProblem(); 1224 #endregion 1225 #region Algorithm Configuration 1226 ga.Name = "Grammatical Evolution - Artificial Ant (SantaFe)"; 1227 ga.Description = "Grammatical evolution algorithm for solving a artificial ant problem"; 1228 ga.Problem = problem; 1229 ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, Encodings.IntegerVectorEncoding.SinglePointCrossover, Encodings.IntegerVectorEncoding.UniformOnePositionManipulator>( 1230 ga, 200, 1, 50, 0.05, 200); 1231 #endregion 1232 return ga; 1233 } 1234 #endregion 1235 1236 #region symbolic regression 1237 #endregion 1238 [TestMethod] 1239 [TestCategory("Samples.Create")] 1240 [TestProperty("Time", "medium")] 1241 public void CreateGeSymbolicRegressionSampleTest() { 1242 var geSymbReg = CreateGeSymbolicRegressionSample(); 1243 XmlGenerator.Serialize(geSymbReg, @"Samples\GE_SymbReg.hl"); 1244 } 1245 1246 [TestMethod] 1247 [TestCategory("Samples.Execute")] 1248 [TestProperty("Time", "long")] 1249 public void RunGeSymbolicRegressionSampleTest() { 1250 var ga = CreateGeSymbolicRegressionSample(); 1251 ga.SetSeedRandomly.Value = false; 1252 RunAlgorithm(ga); 1253 } 1254 1255 [TestMethod] 1256 [TestCategory("Samples.Create")] 1257 [TestProperty("Time", "medium")] 1258 public OffspringSelectionGeneticAlgorithm CreateGeSymbolicRegressionSample() { 1259 var ga = new OffspringSelectionGeneticAlgorithm(); 1260 #region Problem Configuration 1261 var problem = new HeuristicLab.Problems.GrammaticalEvolution.GESymbolicRegressionSingleObjectiveProblem(); 1262 1263 #endregion 1264 #region Algorithm Configuration 1265 ga.Name = "Grammatical Evolution - Symbolic Regression (Poly-10)"; 1266 ga.Description = "Grammatical evolution algorithm for solving a symbolic regression problem problem"; 1267 ga.Problem = problem; 1268 problem.Load(new PolyTen().GenerateRegressionData()); 1269 1270 // must occur after loading problem data because the grammar creates symbols for random constants once the data is loaded 1271 var consts = problem.SymbolicExpressionTreeGrammar.AllowedSymbols.OfType<Constant>().ToList(); 1272 foreach (var c in consts) { 1273 problem.SymbolicExpressionTreeGrammar.RemoveSymbol(c); 1274 } 1275 1276 ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, Encodings.IntegerVectorEncoding.SinglePointCrossover, Encodings.IntegerVectorEncoding.UniformOnePositionManipulator>( 1277 ga, 1000, 1, 50, 0.05, 200); 1278 #endregion 1279 return ga; 1280 } 1281 #endregion 1282 1187 1283 #region Helpers 1188 1284 private void ConfigureEvolutionStrategyParameters<R, M, SC, SR, SM>(EvolutionStrategy es, int popSize, int children, int parentsPerChild, int maxGens, bool plusSelection) … … 1231 1327 ga.Seed.Value = 0; 1232 1328 ga.SetSeedRandomly.Value = true; 1329 ga.Selector = ga.SelectorParameter.ValidValues 1330 .OfType<S>() 1331 .First(); 1332 1333 ga.Crossover = ga.CrossoverParameter.ValidValues 1334 .OfType<C>() 1335 .First(); 1336 1337 ga.Mutator = ga.MutatorParameter.ValidValues 1338 .OfType<M>() 1339 .First(); 1340 1341 var tSelector = ga.Selector as TournamentSelector; 1342 if (tSelector != null) { 1343 tSelector.GroupSizeParameter.Value.Value = tournGroupSize; 1344 } 1345 ga.Engine = new ParallelEngine.ParallelEngine(); 1346 } 1347 1348 private void ConfigureOsGeneticAlgorithmParameters<S, C, M>(OffspringSelectionGeneticAlgorithm ga, int popSize, int elites, int maxGens, double mutationRate=0.05, double maxSelPres=100, int tournGroupSize = 0) 1349 where S : ISelector 1350 where C : ICrossover 1351 where M : IManipulator { 1352 ga.Elites.Value = elites; 1353 ga.MaximumGenerations.Value = maxGens; 1354 ga.MutationProbability.Value = mutationRate; 1355 ga.PopulationSize.Value = popSize; 1356 ga.MaximumSelectionPressure.Value = maxSelPres; 1357 ga.Seed.Value = 0; 1358 ga.SetSeedRandomly.Value = true; 1359 ga.ComparisonFactorLowerBound.Value = 1; 1360 ga.ComparisonFactorUpperBound.Value = 1; 1361 1233 1362 ga.Selector = ga.SelectorParameter.ValidValues 1234 1363 .OfType<S>()
Note: See TracChangeset
for help on using the changeset viewer.