- Timestamp:
- 03/06/09 14:41:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/DispatcherBase.cs
r1266 r1275 49 49 }; 50 50 51 private static int MaxGenerations { 52 get { return 3; } 53 } 54 55 private static int MaxEvaluatedSolutions { 56 get { return 3000; } 57 } 58 51 59 public DispatcherBase(IStore store) { 52 60 this.store = store; … … 70 78 DataSet dataSet = new DataSet(store, dataSetEntity); 71 79 72 int targetVariable = SelectTargetVariable(dataSet, dataSet.Problem.Allowed InputVariables.ToArray());80 int targetVariable = SelectTargetVariable(dataSet, dataSet.Problem.AllowedTargetVariables.ToArray()); 73 81 Algorithm selectedAlgorithm = SelectAlgorithm(dataSet, targetVariable, possibleAlgorithms[dataSet.Problem.LearningTask]); 74 82 string targetVariableName = dataSet.Problem.GetVariableName(targetVariable); … … 92 100 case Algorithm.StandardGpRegression: { 93 101 var algo = new HeuristicLab.GP.StructureIdentification.StandardGP(); 94 SetGpParameters(algo, complexity); 95 SetProblemParameters(algo, problem, targetVariable); 96 algo.MaxGenerations = 2; 102 SetComplexityParameters(algo, complexity); 103 SetProblemParameters(algo, problem, targetVariable); 104 algo.PopulationSize = 10000; 105 algo.MaxGenerations = MaxGenerations; 97 106 Execution exec = new Execution(algo.Engine); 98 107 exec.Description = "StandardGP - Complexity: " + complexity; … … 101 110 case Algorithm.OffspringGpRegression: { 102 111 var algo = new HeuristicLab.GP.StructureIdentification.OffspringSelectionGP(); 103 Set GpParameters(algo, complexity);104 SetProblemParameters(algo, problem, targetVariable); 105 algo.MaxEvaluatedSolutions = 10000;112 SetComplexityParameters(algo, complexity); 113 SetProblemParameters(algo, problem, targetVariable); 114 algo.MaxEvaluatedSolutions = MaxEvaluatedSolutions; 106 115 Execution exec = new Execution(algo.Engine); 107 116 exec.Description = "OffspringGP - Complexity: " + complexity; … … 110 119 case Algorithm.StandardGpClassification: { 111 120 var algo = new HeuristicLab.GP.StructureIdentification.Classification.StandardGP(); 112 SetGpParameters(algo, complexity); 113 SetProblemParameters(algo, problem, targetVariable); 114 algo.MaxGenerations = 2; 121 SetComplexityParameters(algo, complexity); 122 SetProblemParameters(algo, problem, targetVariable); 123 algo.PopulationSize = 10000; 124 algo.MaxGenerations = MaxGenerations; 115 125 Execution exec = new Execution(algo.Engine); 116 126 exec.Description = "StandardGP - Complexity: " + complexity; … … 119 129 case Algorithm.OffspringGpClassification: { 120 130 var algo = new HeuristicLab.GP.StructureIdentification.Classification.OffspringSelectionGP(); 121 Set GpParameters(algo, complexity);122 SetProblemParameters(algo, problem, targetVariable); 123 algo.MaxEvaluatedSolutions = 10000;131 SetComplexityParameters(algo, complexity); 132 SetProblemParameters(algo, problem, targetVariable); 133 algo.MaxEvaluatedSolutions = MaxEvaluatedSolutions; 124 134 Execution exec = new Execution(algo.Engine); 125 135 exec.Description = "OffspringGP - Complexity: " + complexity; … … 128 138 case Algorithm.StandardGpForecasting: { 129 139 var algo = new HeuristicLab.GP.StructureIdentification.TimeSeries.StandardGP(); 130 SetGpParameters(algo, complexity); 131 SetProblemParameters(algo, problem, targetVariable); 132 algo.MaxGenerations = 2; 140 SetComplexityParameters(algo, complexity); 141 SetProblemParameters(algo, problem, targetVariable); 142 algo.PopulationSize = 10000; 143 algo.MaxGenerations = MaxGenerations; 133 144 Execution exec = new Execution(algo.Engine); 134 145 exec.Description = "StandardGP - Complexity: " + complexity; … … 137 148 case Algorithm.OffspringGpForecasting: { 138 149 var algo = new HeuristicLab.GP.StructureIdentification.TimeSeries.OffspringSelectionGP(); 139 Set GpParameters(algo, complexity);140 SetProblemParameters(algo, problem, targetVariable); 141 algo.MaxEvaluatedSolutions = 10000;150 SetComplexityParameters(algo, complexity); 151 SetProblemParameters(algo, problem, targetVariable); 152 algo.MaxEvaluatedSolutions = MaxEvaluatedSolutions; 142 153 Execution exec = new Execution(algo.Engine); 143 154 exec.Description = "OffspringGP - Complexity: " + complexity; … … 150 161 } 151 162 152 private void SetGpParameters(AlgorithmBase algo, ModelComplexity complexity) { 153 algo.SetSeedRandomly = true; 154 algo.PopulationSize = 1000; 155 algo.Elites = 1; 163 private void SetComplexityParameters(AlgorithmBase algo, ModelComplexity complexity) { 156 164 switch (complexity) { 157 165 case ModelComplexity.Low: { … … 196 204 197 205 private IEnumerable<double> GetDifferentClassValues(HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable) { 198 throw new NotImplementedException();206 return Enumerable.Range(0, dataset.Rows).Select(x => dataset.GetValue(x, targetVariable)).Distinct(); 199 207 } 200 208 }
Note: See TracChangeset
for help on using the changeset viewer.