Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/15/09 16:23:29 (15 years ago)
Author:
gkronber
Message:

Implemented #704 (Shuffling of training data (only) in (non-timeseries) modeling algorithms)

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/AlgorithmBase.cs

    r2057 r2161  
    6565
    6666    public virtual IOperator ProblemInjector {
    67       get { return algorithm.SubOperators[0]; }
     67      get { return algorithm.SubOperators[1]; }
    6868      set {
    6969        value.Name = "ProblemInjector";
    70         algorithm.RemoveSubOperator(0);
    71         algorithm.AddSubOperator(value, 0);
     70        algorithm.RemoveSubOperator(1);
     71        algorithm.AddSubOperator(value, 1);
    7272      }
    7373    }
     
    155155      MeanSquaredErrorEvaluator evaluator = new MeanSquaredErrorEvaluator();
    156156      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";
    159159      evaluator.Name = "Evaluator";
    160160
     
    165165      LeftReducer cleanUp = new LeftReducer();
    166166
     167      seq.AddSubOperator(randomInjector);
    167168      seq.AddSubOperator(problemInjector);
    168       seq.AddSubOperator(randomInjector);
    169169      seq.AddSubOperator(globalInjector);
    170170      seq.AddSubOperator(funLibInjector);
     
    465465      // SequentialProcessor in GP
    466466      algorithm = (SequentialProcessor)co1.OperatorGraph.InitialOperator;
    467       return (RandomInjector)algorithm.SubOperators[1];
     467      return (RandomInjector)algorithm.SubOperators[0];
    468468    }
    469469
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGP.cs

    r2130 r2161  
    9696    }
    9797
     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
    98107    public StandardGP()
    99108      : base() {
     
    113122
    114123    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;
    116136    }
    117137
     
    200220    protected internal override IOperator CreateBestSolutionProcessor() {
    201221      SequentialProcessor bestSolutionProcessor = new SequentialProcessor();
     222      #region MSE
    202223      MeanSquaredErrorEvaluator testMseEvaluator = new MeanSquaredErrorEvaluator();
    203224      testMseEvaluator.Name = "TestMeanSquaredErrorEvaluator";
     
    205226      testMseEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
    206227      testMseEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
     228      #endregion
     229      #region MAPE
    207230      MeanAbsolutePercentageErrorEvaluator trainingMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
    208231      trainingMapeEvaluator.Name = "TrainingMapeEvaluator";
    209232      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";
    212235      MeanAbsolutePercentageErrorEvaluator validationMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
    213236      validationMapeEvaluator.Name = "ValidationMapeEvaluator";
     
    220243      testMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
    221244      testMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
     245      #endregion
     246      #region MAPRE
    222247      MeanAbsolutePercentageOfRangeErrorEvaluator trainingMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator();
    223248      trainingMapreEvaluator.Name = "TrainingMapreEvaluator";
    224249      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";
    227252      MeanAbsolutePercentageOfRangeErrorEvaluator validationMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator();
    228253      validationMapreEvaluator.Name = "ValidationMapreEvaluator";
     
    235260      testMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
    236261      testMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
     262      #endregion MAPRE
     263      #region R2
    237264      CoefficientOfDeterminationEvaluator trainingR2Evaluator = new CoefficientOfDeterminationEvaluator();
    238265      trainingR2Evaluator.Name = "TrainingR2Evaluator";
    239266      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";
    242269      CoefficientOfDeterminationEvaluator validationR2Evaluator = new CoefficientOfDeterminationEvaluator();
    243270      validationR2Evaluator.Name = "ValidationR2Evaluator";
     
    250277      testR2Evaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
    251278      testR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
     279      #endregion
     280      #region VAF
    252281      VarianceAccountedForEvaluator trainingVAFEvaluator = new VarianceAccountedForEvaluator();
    253282      trainingVAFEvaluator.Name = "TrainingVAFEvaluator";
    254283      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";
    257286      VarianceAccountedForEvaluator validationVAFEvaluator = new VarianceAccountedForEvaluator();
    258287      validationVAFEvaluator.Name = "ValidationVAFEvaluator";
     
    265294      testVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
    266295      testVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
    267 
     296      #endregion
    268297      ProgrammableOperator progOperator = new ProgrammableOperator();
    269298      progOperator.RemoveVariableInfo("Result");
Note: See TracChangeset for help on using the changeset viewer.