Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/04/08 17:30:24 (16 years ago)
Author:
gkronber
Message:
  • implemented operator to store the best of run solution, in regard of a specific fitness variable).
  • adapted struct-id infrastructure to allow evaluation of models on validation data.

ticket #194

Location:
trunk/sources/HeuristicLab.StructureIdentification
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/CoefficientOfDeterminationEvaluator.cs

    r155 r363  
    4747      double originalDeviationTotalSumOfSquares = 0.0;
    4848      double targetMean = dataset.GetMean(targetVariable);
     49      functionTree.PrepareEvaluation(dataset);
    4950      for(int sample = 0; sample < dataset.Rows; sample++) {
    50         double estimated = functionTree.Evaluate(dataset, sample);
     51        double estimated = functionTree.Evaluate(sample);
    5152        double original = dataset.GetValue(sample, targetVariable);
    5253        if(!double.IsNaN(original) && !double.IsInfinity(original)) {
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/EarlyStoppingMeanSquaredErrorEvaluator.cs

    r334 r363  
    6060      double errorsSquaredSum = 0;
    6161      double targetMean = dataset.GetMean(targetVariable);
     62      functionTree.PrepareEvaluation(dataset);
    6263      for(int sample = trainingStart; sample < trainingEnd; sample++) {
    63         double estimated = functionTree.Evaluate(dataset, sample);
     64        double estimated = functionTree.Evaluate(sample);
    6465        double original = dataset.GetValue(sample, targetVariable);
    6566        if(double.IsNaN(estimated) || double.IsInfinity(estimated)) {
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/GPEvaluatorBase.cs

    r334 r363  
    5757      this.totalEvaluatedNodes = scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data;
    5858      double result = Evaluate(scope, functionTree, targetVariable, dataset);
    59       scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Quality"), new DoubleData(result)));
     59
     60      DoubleData quality = GetVariableValue<DoubleData>("Quality", scope, false, false);
     61      if(quality == null) {
     62        scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Quality"), new DoubleData(result)));
     63      } else {
     64        quality.Data = result;
     65      }
     66
    6067      return null;
    6168    }
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MCCEvaluator.cs

    r191 r363  
    5454      double negative = 0;
    5555      double targetMean = dataset.GetMean(targetVariable);
     56      functionTree.PrepareEvaluation(dataset);
    5657      for(int sample = 0; sample < dataset.Rows; sample++) {
    57         double est = functionTree.Evaluate(dataset, sample);
     58        double est = functionTree.Evaluate(sample);
    5859        double orig = dataset.GetValue(sample, targetVariable);
    5960        if(double.IsNaN(est) || double.IsInfinity(est)) {
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanSquaredErrorEvaluator.cs

    r334 r363  
    6060      }
    6161
     62      functionTree.PrepareEvaluation(dataset);
    6263      for(int sample = trainingStart; sample < trainingEnd; sample++) {
    63         double estimated = functionTree.Evaluate(dataset, sample);
     64        double estimated = functionTree.Evaluate(sample);
    6465        double original = dataset.GetValue(sample, targetVariable);
    6566        if(double.IsNaN(estimated) || double.IsInfinity(estimated)) {
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/VarianceAccountedForEvaluator.cs

    r155 r363  
    5757      double[] originalTargetVariableValues = new double[dataset.Rows];
    5858      double targetMean = dataset.GetMean(targetVariable);
     59      functionTree.PrepareEvaluation(dataset);
    5960      for(int sample = 0; sample < dataset.Rows; sample++) {
    60         double estimated = functionTree.Evaluate(dataset, sample);
     61        double estimated = functionTree.Evaluate(sample);
    6162        double original = dataset.GetValue(sample, targetVariable);
    6263        if(!double.IsNaN(original) && !double.IsInfinity(original)) {
  • trunk/sources/HeuristicLab.StructureIdentification/HeuristicLab.StructureIdentification.csproj

    r358 r363  
    4848  </ItemGroup>
    4949  <ItemGroup>
     50    <Compile Include="Evaluation\SimpleEvaluator.cs" />
    5051    <Compile Include="ProbabilisticTreeCreator.cs" />
    5152    <Compile Include="Evaluation\CoefficientOfDeterminationEvaluator.cs" />
  • trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjector.cs

    r172 r363  
    4141      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(IntData), VariableKind.New));
    4242      AddVariable(new Variable("TargetVariable", new IntData()));
     43      AddVariableInfo(new VariableInfo("TrainingSamplesStart", "TrainingSamplesStart", typeof(IntData), VariableKind.New));
     44      AddVariable(new Variable("TrainingSamplesStart", new IntData()));
     45      AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "TrainingSamplesEnd", typeof(IntData), VariableKind.New));
     46      AddVariable(new Variable("TrainingSamplesEnd", new IntData()));
     47      AddVariableInfo(new VariableInfo("ValidationSamplesStart", "ValidationSamplesStart", typeof(IntData), VariableKind.New));
     48      AddVariable(new Variable("ValidationSamplesStart", new IntData()));
     49      AddVariableInfo(new VariableInfo("ValidationSamplesEnd", "ValidationSamplesEnd", typeof(IntData), VariableKind.New));
     50      AddVariable(new Variable("ValidationSamplesEnd", new IntData()));
    4351    }
    4452
     
    5058      scope.AddVariable(new Variable(scope.TranslateName("Dataset"), (IItem)GetVariable("Dataset").Value.Clone()));
    5159      scope.AddVariable(new Variable(scope.TranslateName("TargetVariable"), (IItem)GetVariable("TargetVariable").Value.Clone()));
     60      scope.AddVariable(new Variable(scope.TranslateName("TrainingSamplesStart"), (IItem)GetVariable("TrainingSamplesStart").Value.Clone()));
     61      scope.AddVariable(new Variable(scope.TranslateName("TrainingSamplesEnd"), (IItem)GetVariable("TrainingSamplesEnd").Value.Clone()));
     62      scope.AddVariable(new Variable(scope.TranslateName("ValidationSamplesStart"), (IItem)GetVariable("ValidationSamplesStart").Value.Clone()));
     63      scope.AddVariable(new Variable(scope.TranslateName("ValidationSamplesEnd"), (IItem)GetVariable("ValidationSamplesEnd").Value.Clone()));
    5264      return null;
    5365    }
  • trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjectorView.Designer.cs

    r168 r363  
    5151      this.variableInfosTabPage = new System.Windows.Forms.TabPage();
    5252      this.operatorBaseVariableInfosView = new HeuristicLab.Core.OperatorBaseVariableInfosView();
     53      this.tabPage1 = new System.Windows.Forms.TabPage();
     54      this.operatorBaseVariablesView = new HeuristicLab.Core.OperatorBaseVariablesView();
    5355      this.descriptionTabPage = new System.Windows.Forms.TabPage();
    5456      this.operatorBaseDescriptionView = new HeuristicLab.Core.OperatorBaseDescriptionView();
     
    5759      this.dataTabPage.SuspendLayout();
    5860      this.variableInfosTabPage.SuspendLayout();
     61      this.tabPage1.SuspendLayout();
    5962      this.descriptionTabPage.SuspendLayout();
    6063      this.SuspendLayout();
     
    8184      this.tabControl.Controls.Add(this.dataTabPage);
    8285      this.tabControl.Controls.Add(this.variableInfosTabPage);
     86      this.tabControl.Controls.Add(this.tabPage1);
    8387      this.tabControl.Controls.Add(this.descriptionTabPage);
    8488      this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
     
    122126      this.operatorBaseVariableInfosView.TabIndex = 0;
    123127      //
     128      // tabPage1
     129      //
     130      this.tabPage1.Controls.Add(this.operatorBaseVariablesView);
     131      this.tabPage1.Location = new System.Drawing.Point(4, 22);
     132      this.tabPage1.Name = "tabPage1";
     133      this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
     134      this.tabPage1.Size = new System.Drawing.Size(499, 425);
     135      this.tabPage1.TabIndex = 3;
     136      this.tabPage1.Text = "Variables";
     137      this.tabPage1.UseVisualStyleBackColor = true;
     138      //
     139      // operatorBaseVariablesView
     140      //
     141      this.operatorBaseVariablesView.Caption = "Operator";
     142      this.operatorBaseVariablesView.Dock = System.Windows.Forms.DockStyle.Fill;
     143      this.operatorBaseVariablesView.Location = new System.Drawing.Point(3, 3);
     144      this.operatorBaseVariablesView.Name = "operatorBaseVariablesView";
     145      this.operatorBaseVariablesView.Operator = null;
     146      this.operatorBaseVariablesView.Size = new System.Drawing.Size(493, 419);
     147      this.operatorBaseVariablesView.TabIndex = 0;
     148      //
    124149      // descriptionTabPage
    125150      //
     
    143168      this.operatorBaseDescriptionView.TabIndex = 0;
    144169      //
    145       // datasetView
     170      // datasetView1
    146171      //
    147172      this.datasetView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    148173                  | System.Windows.Forms.AnchorStyles.Left)
    149174                  | System.Windows.Forms.AnchorStyles.Right)));
    150       this.datasetView.Caption = "View";
     175      this.datasetView.Caption = "Editor";
     176      this.datasetView.Dataset = null;
     177      this.datasetView.Filename = null;
    151178      this.datasetView.Location = new System.Drawing.Point(6, 33);
    152       this.datasetView.Name = "datasetView";
     179      this.datasetView.Name = "datasetView1";
    153180      this.datasetView.Size = new System.Drawing.Size(487, 386);
    154181      this.datasetView.TabIndex = 7;
     
    164191      this.dataTabPage.ResumeLayout(false);
    165192      this.variableInfosTabPage.ResumeLayout(false);
     193      this.tabPage1.ResumeLayout(false);
    166194      this.descriptionTabPage.ResumeLayout(false);
    167195      this.ResumeLayout(false);
     
    179207    private System.Windows.Forms.TabPage descriptionTabPage;
    180208    private HeuristicLab.Core.OperatorBaseDescriptionView operatorBaseDescriptionView;
     209    private System.Windows.Forms.TabPage tabPage1;
     210    private HeuristicLab.Core.OperatorBaseVariablesView operatorBaseVariablesView;
    181211    private HeuristicLab.DataAnalysis.DatasetView datasetView;
    182212  }
  • trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjectorView.cs

    r274 r363  
    8989        if (success) {
    9090          Dataset dataset = (Dataset)StructIdProblemInjector.GetVariable("Dataset").Value;
    91           dataset.Rows = parser.TrainingSamplesEnd - parser.TrainingSamplesStart;
     91          dataset.Rows = parser.Rows;
    9292          dataset.Columns = parser.Columns;
    9393          dataset.VariableNames = parser.VariableNames;
     
    9595          dataset.Samples = new double[dataset.Rows * dataset.Columns];
    9696          Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows);
    97 
     97          ((IntData)StructIdProblemInjector.GetVariable("TrainingSamplesStart").Value).Data = parser.TrainingSamplesStart;
     98          ((IntData)StructIdProblemInjector.GetVariable("TrainingSamplesEnd").Value).Data = parser.TrainingSamplesEnd;
     99          ((IntData)StructIdProblemInjector.GetVariable("ValidationSamplesStart").Value).Data = parser.ValidationSamplesStart;
     100          ((IntData)StructIdProblemInjector.GetVariable("ValidationSamplesEnd").Value).Data = parser.ValidationSamplesEnd;
    98101          ((IntData)StructIdProblemInjector.GetVariable("TargetVariable").Value).Data = parser.TargetVariable;
    99102          Refresh();
Note: See TracChangeset for help on using the changeset viewer.