Changeset 2161
- Timestamp:
- 07/15/09 16:23:29 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/OffspringSelectionGP.cs
r1857 r2161 34 34 namespace HeuristicLab.GP.StructureIdentification.Classification { 35 35 public class OffspringSelectionGP : HeuristicLab.GP.StructureIdentification.OffspringSelectionGP, IClassificationAlgorithm { 36 protected override IOperator CreateProblemInjector() {37 return new ProblemInjector();38 }39 36 40 37 protected override IOperator CreateBestSolutionProcessor() { -
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/StandardGP.cs
r1857 r2161 35 35 namespace HeuristicLab.GP.StructureIdentification.Classification { 36 36 public class StandardGP : HeuristicLab.GP.StructureIdentification.StandardGP, IClassificationAlgorithm { 37 protected override IOperator CreateProblemInjector() {38 return new ProblemInjector();39 }40 41 37 protected override IOperator CreateBestSolutionProcessor() { 42 38 IOperator seq = base.CreateBestSolutionProcessor(); … … 50 46 AccuracyEvaluator trainingAccuracy = new AccuracyEvaluator(); 51 47 trainingAccuracy.GetVariableInfo("Accuracy").ActualName = "TrainingAccuracy"; 52 trainingAccuracy.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";53 trainingAccuracy.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";48 trainingAccuracy.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 49 trainingAccuracy.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 54 50 55 51 AccuracyEvaluator validationAccuracy = new AccuracyEvaluator(); … … 65 61 ConfusionMatrixEvaluator trainingConfusionMatrix = new ConfusionMatrixEvaluator(); 66 62 trainingConfusionMatrix.GetVariableInfo("ConfusionMatrix").ActualName = "TrainingConfusionMatrix"; 67 trainingConfusionMatrix.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";68 trainingConfusionMatrix.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";63 trainingConfusionMatrix.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 64 trainingConfusionMatrix.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 69 65 70 66 ConfusionMatrixEvaluator validationConfusionMatrix = new ConfusionMatrixEvaluator(); -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/OffspringSelectionGP.cs
r2130 r2161 35 35 namespace HeuristicLab.GP.StructureIdentification.TimeSeries { 36 36 public class OffspringSelectionGP : HeuristicLab.GP.StructureIdentification.OffspringSelectionGP, ITimeSeriesAlgorithm { 37 public override IOperator ProblemInjector { 38 get { 39 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 40 return algo.OperatorGraph.InitialOperator.SubOperators[1]; 41 } 42 set { 43 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 44 algo.OperatorGraph.InitialOperator.RemoveSubOperator(1); 45 value.Name = "ProblemInjector"; 46 algo.OperatorGraph.InitialOperator.AddSubOperator(value, 1); 47 } 48 } 49 37 50 protected override IOperator CreateFunctionLibraryInjector() { 38 51 return new FunctionLibraryInjector(); -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/StandardGP.cs
r2130 r2161 35 35 namespace HeuristicLab.GP.StructureIdentification.TimeSeries { 36 36 public class StandardGP : HeuristicLab.GP.StructureIdentification.StandardGP, ITimeSeriesAlgorithm { 37 public override IOperator ProblemInjector { 38 get { 39 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 40 return algo.OperatorGraph.InitialOperator.SubOperators[1]; 41 } 42 set { 43 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 44 algo.OperatorGraph.InitialOperator.RemoveSubOperator(1); 45 value.Name = "ProblemInjector"; 46 algo.OperatorGraph.InitialOperator.AddSubOperator(value, 1); 47 } 48 } 49 37 50 protected override IOperator CreateFunctionLibraryInjector() { 38 51 return new FunctionLibraryInjector(); … … 61 74 SequentialProcessor seq = new SequentialProcessor(); 62 75 TheilInequalityCoefficientEvaluator trainingTheil = new TheilInequalityCoefficientEvaluator(); 63 trainingTheil.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";64 trainingTheil.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";76 trainingTheil.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 77 trainingTheil.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 65 78 trainingTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "TrainingTheilInequalityCoefficient"; 66 79 trainingTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "TrainingTheilInequalityCoefficientBias"; … … 69 82 70 83 TheilInequalityCoefficientEvaluator validationTheil = new TheilInequalityCoefficientEvaluator(); 71 validationTheil.GetVariableInfo("SamplesStart").ActualName = " ValidationSamplesStart";72 validationTheil.GetVariableInfo("SamplesEnd").ActualName = " ValidationSamplesEnd";84 validationTheil.GetVariableInfo("SamplesStart").ActualName = "ActualValidationSamplesStart"; 85 validationTheil.GetVariableInfo("SamplesEnd").ActualName = "ActualValidationSamplesEnd"; 73 86 validationTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "ValidationTheilInequalityCoefficient"; 74 87 validationTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "ValidationTheilInequalityCoefficientBias"; … … 77 90 78 91 TheilInequalityCoefficientEvaluator testTheil = new TheilInequalityCoefficientEvaluator(); 79 testTheil.GetVariableInfo("SamplesStart").ActualName = " TestSamplesStart";80 testTheil.GetVariableInfo("SamplesEnd").ActualName = " TestSamplesEnd";92 testTheil.GetVariableInfo("SamplesStart").ActualName = "ActualTestSamplesStart"; 93 testTheil.GetVariableInfo("SamplesEnd").ActualName = "ActualTestSamplesEnd"; 81 94 testTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "TestTheilInequalityCoefficient"; 82 95 testTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "TestTheilInequalityCoefficientBias"; … … 85 98 86 99 SimpleEvaluator trainingEvaluator = new SimpleEvaluator(); 87 trainingEvaluator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";88 trainingEvaluator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";100 trainingEvaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 101 trainingEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 89 102 trainingEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesTraining"; 90 103 -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/AlgorithmBase.cs
r2057 r2161 65 65 66 66 public virtual IOperator ProblemInjector { 67 get { return algorithm.SubOperators[ 0]; }67 get { return algorithm.SubOperators[1]; } 68 68 set { 69 69 value.Name = "ProblemInjector"; 70 algorithm.RemoveSubOperator( 0);71 algorithm.AddSubOperator(value, 0);70 algorithm.RemoveSubOperator(1); 71 algorithm.AddSubOperator(value, 1); 72 72 } 73 73 } … … 155 155 MeanSquaredErrorEvaluator evaluator = new MeanSquaredErrorEvaluator(); 156 156 evaluator.GetVariableInfo("MSE").ActualName = "Quality"; 157 evaluator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";158 evaluator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";157 evaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 158 evaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 159 159 evaluator.Name = "Evaluator"; 160 160 … … 165 165 LeftReducer cleanUp = new LeftReducer(); 166 166 167 seq.AddSubOperator(randomInjector); 167 168 seq.AddSubOperator(problemInjector); 168 seq.AddSubOperator(randomInjector);169 169 seq.AddSubOperator(globalInjector); 170 170 seq.AddSubOperator(funLibInjector); … … 465 465 // SequentialProcessor in GP 466 466 algorithm = (SequentialProcessor)co1.OperatorGraph.InitialOperator; 467 return (RandomInjector)algorithm.SubOperators[ 1];467 return (RandomInjector)algorithm.SubOperators[0]; 468 468 } 469 469 -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGP.cs
r2130 r2161 96 96 } 97 97 98 public override IOperator ProblemInjector { 99 get { return base.ProblemInjector.SubOperators[0]; } 100 set { 101 value.Name = "ProblemInjector"; 102 base.ProblemInjector.RemoveSubOperator(0); 103 base.ProblemInjector.AddSubOperator(value, 0); 104 } 105 } 106 98 107 public StandardGP() 99 108 : base() { … … 113 122 114 123 protected internal override IOperator CreateProblemInjector() { 115 return new ProblemInjector(); 124 SequentialProcessor seq = new SequentialProcessor(); 125 var probInject = new ProblemInjector(); 126 probInject.GetVariableInfo("MaxNumberOfTrainingSamples").Local = true; 127 probInject.AddVariable(new HeuristicLab.Core.Variable("MaxNumberOfTrainingSamples", new IntData(5000))); 128 129 var shuffler = new DatasetShuffler(); 130 shuffler.GetVariableInfo("ShuffleStart").ActualName = "TrainingSamplesStart"; 131 shuffler.GetVariableInfo("ShuffleEnd").ActualName = "TrainingSamplesEnd"; 132 133 seq.AddSubOperator(probInject); 134 seq.AddSubOperator(shuffler); 135 return seq; 116 136 } 117 137 … … 200 220 protected internal override IOperator CreateBestSolutionProcessor() { 201 221 SequentialProcessor bestSolutionProcessor = new SequentialProcessor(); 222 #region MSE 202 223 MeanSquaredErrorEvaluator testMseEvaluator = new MeanSquaredErrorEvaluator(); 203 224 testMseEvaluator.Name = "TestMeanSquaredErrorEvaluator"; … … 205 226 testMseEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart"; 206 227 testMseEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd"; 228 #endregion 229 #region MAPE 207 230 MeanAbsolutePercentageErrorEvaluator trainingMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator(); 208 231 trainingMapeEvaluator.Name = "TrainingMapeEvaluator"; 209 232 trainingMapeEvaluator.GetVariableInfo("MAPE").ActualName = "TrainingMAPE"; 210 trainingMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";211 trainingMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";233 trainingMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 234 trainingMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 212 235 MeanAbsolutePercentageErrorEvaluator validationMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator(); 213 236 validationMapeEvaluator.Name = "ValidationMapeEvaluator"; … … 220 243 testMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart"; 221 244 testMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd"; 245 #endregion 246 #region MAPRE 222 247 MeanAbsolutePercentageOfRangeErrorEvaluator trainingMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator(); 223 248 trainingMapreEvaluator.Name = "TrainingMapreEvaluator"; 224 249 trainingMapreEvaluator.GetVariableInfo("MAPRE").ActualName = "TrainingMAPRE"; 225 trainingMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";226 trainingMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";250 trainingMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 251 trainingMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 227 252 MeanAbsolutePercentageOfRangeErrorEvaluator validationMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator(); 228 253 validationMapreEvaluator.Name = "ValidationMapreEvaluator"; … … 235 260 testMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart"; 236 261 testMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd"; 262 #endregion MAPRE 263 #region R2 237 264 CoefficientOfDeterminationEvaluator trainingR2Evaluator = new CoefficientOfDeterminationEvaluator(); 238 265 trainingR2Evaluator.Name = "TrainingR2Evaluator"; 239 266 trainingR2Evaluator.GetVariableInfo("R2").ActualName = "TrainingR2"; 240 trainingR2Evaluator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";241 trainingR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";267 trainingR2Evaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 268 trainingR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 242 269 CoefficientOfDeterminationEvaluator validationR2Evaluator = new CoefficientOfDeterminationEvaluator(); 243 270 validationR2Evaluator.Name = "ValidationR2Evaluator"; … … 250 277 testR2Evaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart"; 251 278 testR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd"; 279 #endregion 280 #region VAF 252 281 VarianceAccountedForEvaluator trainingVAFEvaluator = new VarianceAccountedForEvaluator(); 253 282 trainingVAFEvaluator.Name = "TrainingVAFEvaluator"; 254 283 trainingVAFEvaluator.GetVariableInfo("VAF").ActualName = "TrainingVAF"; 255 trainingVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";256 trainingVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";284 trainingVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 285 trainingVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 257 286 VarianceAccountedForEvaluator validationVAFEvaluator = new VarianceAccountedForEvaluator(); 258 287 validationVAFEvaluator.Name = "ValidationVAFEvaluator"; … … 265 294 testVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart"; 266 295 testVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd"; 267 296 #endregion 268 297 ProgrammableOperator progOperator = new ProgrammableOperator(); 269 298 progOperator.RemoveVariableInfo("Result"); -
trunk/sources/HeuristicLab.LinearRegression/3.2/HeuristicLab.LinearRegression-3.2.csproj
r2154 r2161 133 133 <Name>HeuristicLab.PluginInfrastructure</Name> 134 134 </ProjectReference> 135 <ProjectReference Include="..\..\HeuristicLab.Random\3.2\HeuristicLab.Random-3.2.csproj"> 136 <Project>{47019A74-F7F7-482E-83AA-D3F4F777E879}</Project> 137 <Name>HeuristicLab.Random-3.2</Name> 138 </ProjectReference> 135 139 <ProjectReference Include="..\..\HeuristicLab.SequentialEngine\3.2\HeuristicLab.SequentialEngine-3.2.csproj"> 136 140 <Project>{B4BE8E53-BA06-4237-9A01-24255F880201}</Project> -
trunk/sources/HeuristicLab.LinearRegression/3.2/HeuristicLabLinearRegressionPlugin.cs
r2155 r2161 34 34 [Dependency(Dependency = "HeuristicLab.GP.StructureIdentification-3.3")] 35 35 [Dependency(Dependency = "HeuristicLab.Modeling-3.2")] 36 [Dependency(Dependency = "HeuristicLab.Random-3.2")] 36 37 [Dependency(Dependency = "HeuristicLab.SequentialEngine-3.2")] 37 38 public class HeuristicLabLinearRegression : PluginBase { -
trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs
r2154 r2161 33 33 using HeuristicLab.Modeling; 34 34 using HeuristicLab.GP; 35 using HeuristicLab.Random; 35 36 36 37 namespace HeuristicLab.LinearRegression { … … 88 89 seq.Name = "LinearRegression"; 89 90 91 var randomInjector = new RandomInjector(); 92 randomInjector.Name = "Random Injector"; 90 93 IOperator globalInjector = CreateGlobalInjector(); 91 94 ProblemInjector problemInjector = new ProblemInjector(); 95 problemInjector.GetVariableInfo("MaxNumberOfTrainingSamples").Local = true; 96 problemInjector.AddVariable(new HeuristicLab.Core.Variable("MaxNumberOfTrainingSamples", new IntData(5000))); 97 98 IOperator shuffler = new DatasetShuffler(); 99 shuffler.GetVariableInfo("ShuffleStart").ActualName = "TrainingSamplesStart"; 100 shuffler.GetVariableInfo("ShuffleEnd").ActualName = "TrainingSamplesEnd"; 101 92 102 LinearRegressionOperator lrOperator = new LinearRegressionOperator(); 93 lrOperator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";94 lrOperator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";95 96 103 lrOperator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 104 lrOperator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 105 106 seq.AddSubOperator(randomInjector); 97 107 seq.AddSubOperator(globalInjector); 98 108 seq.AddSubOperator(problemInjector); 109 seq.AddSubOperator(shuffler); 99 110 seq.AddSubOperator(lrOperator); 100 111 seq.AddSubOperator(CreateModelAnalyser()); 101 102 112 103 113 algo.OperatorGraph.InitialOperator = seq; … … 126 136 trainingMSE.GetVariableInfo("FunctionTree").ActualName = "LinearRegressionModel"; 127 137 trainingMSE.GetVariableInfo("MSE").ActualName = "TrainingQuality"; 128 trainingMSE.GetVariableInfo("SamplesStart").ActualName = " ValidationSamplesStart";129 trainingMSE.GetVariableInfo("SamplesEnd").ActualName = " ValidationSamplesEnd";138 trainingMSE.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 139 trainingMSE.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 130 140 MeanSquaredErrorEvaluator validationMSE = new MeanSquaredErrorEvaluator(); 131 141 validationMSE.Name = "ValidationMseEvaluator"; … … 147 157 trainingR2.GetVariableInfo("FunctionTree").ActualName = "LinearRegressionModel"; 148 158 trainingR2.GetVariableInfo("R2").ActualName = "TrainingR2"; 149 trainingR2.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";150 trainingR2.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";159 trainingR2.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 160 trainingR2.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 151 161 CoefficientOfDeterminationEvaluator validationR2 = new CoefficientOfDeterminationEvaluator(); 152 162 validationR2.Name = "ValidationR2Evaluator"; … … 168 178 trainingMAPE.GetVariableInfo("FunctionTree").ActualName = "LinearRegressionModel"; 169 179 trainingMAPE.GetVariableInfo("MAPE").ActualName = "TrainingMAPE"; 170 trainingMAPE.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";171 trainingMAPE.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";180 trainingMAPE.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 181 trainingMAPE.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 172 182 MeanAbsolutePercentageErrorEvaluator validationMAPE = new MeanAbsolutePercentageErrorEvaluator(); 173 183 validationMAPE.Name = "ValidationMapeEvaluator"; … … 189 199 trainingMAPRE.GetVariableInfo("FunctionTree").ActualName = "LinearRegressionModel"; 190 200 trainingMAPRE.GetVariableInfo("MAPRE").ActualName = "TrainingMAPRE"; 191 trainingMAPRE.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";192 trainingMAPRE.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";201 trainingMAPRE.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 202 trainingMAPRE.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 193 203 MeanAbsolutePercentageOfRangeErrorEvaluator validationMAPRE = new MeanAbsolutePercentageOfRangeErrorEvaluator(); 194 204 validationMAPRE.Name = "ValidationMapreEvaluator"; … … 210 220 trainingVAF.GetVariableInfo("FunctionTree").ActualName = "LinearRegressionModel"; 211 221 trainingVAF.GetVariableInfo("VAF").ActualName = "TrainingVAF"; 212 trainingVAF.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";213 trainingVAF.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";222 trainingVAF.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 223 trainingVAF.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 214 224 VarianceAccountedForEvaluator validationVAF = new VarianceAccountedForEvaluator(); 215 225 validationVAF.Name = "ValidationVafEvaluator"; -
trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs
r1856 r2161 56 56 AddVariable(new Variable("TrainingSamplesEnd", new IntData())); 57 57 58 AddVariableInfo(new VariableInfo("ActualTrainingSamplesStart", "ActualTrainingSamplesStart", typeof(IntData), VariableKind.New)); 59 AddVariableInfo(new VariableInfo("ActualTrainingSamplesEnd", "ActualTrainingSamplesEnd", typeof(IntData), VariableKind.New)); 60 58 61 AddVariableInfo(new VariableInfo("ValidationSamplesStart", "ValidationSamplesStart", typeof(IntData), VariableKind.New)); 59 62 GetVariableInfo("ValidationSamplesStart").Local = true; … … 71 74 GetVariableInfo("TestSamplesEnd").Local = true; 72 75 AddVariable(new Variable("TestSamplesEnd", new IntData())); 76 77 AddVariableInfo(new VariableInfo("MaxNumberOfTrainingSamples", "Maximal number of training samples to use (optional)", typeof(IntData), VariableKind.In)); 73 78 } 74 79 … … 78 83 79 84 public override IOperation Apply(IScope scope) { 80 foreach(VariableInfo info in VariableInfos) { 81 if(info.Local) { 82 IVariable var = GetVariable(info.FormalName); 83 if(var != null) scope.AddVariable(new Variable(info.ActualName, (IItem)var.Value.Clone())); 84 } 85 AddVariableToScope("Dataset", scope); 86 AddVariableToScope("TargetVariable", scope); 87 AddVariableToScope("AllowedFeatures", scope); 88 AddVariableToScope("TrainingSamplesStart", scope); 89 AddVariableToScope("TrainingSamplesEnd", scope); 90 AddVariableToScope("ValidationSamplesStart", scope); 91 AddVariableToScope("ValidationSamplesEnd", scope); 92 AddVariableToScope("TestSamplesStart", scope); 93 AddVariableToScope("TestSamplesEnd", scope); 94 95 int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 96 int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 97 98 var maxTraining = GetVariableValue<IntData>("MaxNumberOfTrainingSamples", scope, true, false); 99 int nTrainingSamples; 100 if (maxTraining != null) { 101 nTrainingSamples = Math.Min(maxTraining.Data, trainingEnd - trainingStart); 102 if (nTrainingSamples <= 0) 103 throw new ArgumentException("Maximal number of training samples must be larger than 0", "MaxNumberOfTrainingSamples"); 104 } else { 105 nTrainingSamples = trainingEnd - trainingStart; 85 106 } 107 scope.AddVariable(new Variable(scope.TranslateName("ActualTrainingSamplesStart"), new IntData(trainingStart))); 108 scope.AddVariable(new Variable(scope.TranslateName("ActualTrainingSamplesEnd"), new IntData(trainingStart + nTrainingSamples))); 86 109 return null; 110 } 111 112 private void AddVariableToScope(string variableName, IScope scope) { 113 scope.AddVariable(new Variable(variableName, (IItem)GetVariable(variableName).Value.Clone())); 87 114 } 88 115 } -
trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs
r2127 r2161 142 142 seq.Name = "Initialization"; 143 143 seq.AddSubOperator(CreateGlobalInjector()); 144 seq.AddSubOperator(new ProblemInjector()); 144 ProblemInjector probInjector = new ProblemInjector(); 145 probInjector.GetVariableInfo("MaxNumberOfTrainingSamples").Local = true; 146 probInjector.AddVariable(new Variable("MaxNumberOfTrainingSamples", new IntData(5000))); 147 seq.AddSubOperator(probInjector); 145 148 seq.AddSubOperator(new RandomInjector()); 149 150 DatasetShuffler shuffler = new DatasetShuffler(); 151 shuffler.GetVariableInfo("ShuffleStart").ActualName = "TrainingSamplesStart"; 152 shuffler.GetVariableInfo("ShuffleEnd").ActualName = "TrainingSamplesEnd"; 153 seq.AddSubOperator(shuffler); 146 154 return seq; 147 155 } … … 246 254 247 255 SupportVectorCreator modelCreator = new SupportVectorCreator(); 248 modelCreator.GetVariableInfo("SamplesStart").ActualName = " TrainingSamplesStart";249 modelCreator.GetVariableInfo("SamplesEnd").ActualName = " TrainingSamplesEnd";256 modelCreator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 257 modelCreator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 250 258 modelCreator.GetVariableInfo("SVMCost").ActualName = "Cost"; 251 259 modelCreator.GetVariableInfo("SVMGamma").ActualName = "Gamma"; … … 256 264 257 265 modelProcessor.AddSubOperator(modelCreator); 258 CombinedOperator trainingEvaluator = (CombinedOperator)CreateEvaluator(" Training");266 CombinedOperator trainingEvaluator = (CombinedOperator)CreateEvaluator("ActualTraining"); 259 267 trainingEvaluator.OperatorGraph.InitialOperator.SubOperators[1].GetVariableInfo("MSE").ActualName = "Quality"; 260 268 modelProcessor.AddSubOperator(trainingEvaluator); … … 415 423 model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data; 416 424 model.TestMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("TestQuality", false).Data; 417 model.TrainingCoefficientOfDetermination = bestModelScope.GetVariableValue<DoubleData>(" TrainingR2", false).Data;425 model.TrainingCoefficientOfDetermination = bestModelScope.GetVariableValue<DoubleData>("ActualTrainingR2", false).Data; 418 426 model.ValidationCoefficientOfDetermination = bestModelScope.GetVariableValue<DoubleData>("ValidationR2", false).Data; 419 427 model.TestCoefficientOfDetermination = bestModelScope.GetVariableValue<DoubleData>("TestR2", false).Data; 420 model.TrainingMeanAbsolutePercentageError = bestModelScope.GetVariableValue<DoubleData>(" TrainingMAPE", false).Data;428 model.TrainingMeanAbsolutePercentageError = bestModelScope.GetVariableValue<DoubleData>("ActualTrainingMAPE", false).Data; 421 429 model.ValidationMeanAbsolutePercentageError = bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data; 422 430 model.TestMeanAbsolutePercentageError = bestModelScope.GetVariableValue<DoubleData>("TestMAPE", false).Data; 423 model.TrainingMeanAbsolutePercentageOfRangeError = bestModelScope.GetVariableValue<DoubleData>(" TrainingMAPRE", false).Data;431 model.TrainingMeanAbsolutePercentageOfRangeError = bestModelScope.GetVariableValue<DoubleData>("ActualTrainingMAPRE", false).Data; 424 432 model.ValidationMeanAbsolutePercentageOfRangeError = bestModelScope.GetVariableValue<DoubleData>("ValidationMAPRE", false).Data; 425 433 model.TestMeanAbsolutePercentageOfRangeError = bestModelScope.GetVariableValue<DoubleData>("TestMAPRE", false).Data; 426 model.TrainingVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>(" TrainingVAF", false).Data;434 model.TrainingVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("ActualTrainingVAF", false).Data; 427 435 model.ValidationVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("ValidationVAF", false).Data; 428 436 model.TestVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("TestVAF", false).Data;
Note: See TracChangeset
for help on using the changeset viewer.