Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/01/14 10:53:46 (10 years ago)
Author:
mkommend
Message:

#2206: Updated data preprocessing branch with trunk changes.

Location:
branches/DataPreprocessing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing

  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification

  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs

    r10538 r11064  
    1 using System.Linq;
     1#region License Information
     2
     3/* HeuristicLab
     4 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     5 *
     6 * This file is part of HeuristicLab.
     7 *
     8 * HeuristicLab is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * HeuristicLab is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
     22#endregion
     23
     24using System.Linq;
    225using HeuristicLab.Common;
    326using HeuristicLab.Core;
    4 using HeuristicLab.Data;
    527using HeuristicLab.Parameters;
    628using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    1234    private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
    1335    private const string ModelCreatorParameterName = "ModelCreator";
    14     private const string ApplyLinearScalingParmameterName = "ApplyLinearScaling";
    1536
    1637    #region parameter properties
     
    1839      get { return (ILookupParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
    1940    }
    20 
    21     public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
    22       get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParmameterName]; }
    23     }
    24     #endregion
    25     #region properties
    26     private ISymbolicClassificationModelCreator ModelCreator { get { return ModelCreatorParameter.ActualValue; } }
    27     private BoolValue ApplyLinearScaling { get { return ApplyLinearScalingParameter.ActualValue; } }
    2841    #endregion
    2942
     
    3144      : base(original, cloner) {
    3245    }
     46
    3347    public override IDeepCloneable Clone(Cloner cloner) {
    3448      return new SymbolicClassificationPruningOperator(this, cloner);
     
    4458
    4559    protected override ISymbolicDataAnalysisModel CreateModel() {
    46       var model = ModelCreator.CreateSymbolicClassificationModel(SymbolicExpressionTree, Interpreter, EstimationLimits.Lower, EstimationLimits.Upper);
    47       var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);
     60      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(SymbolicExpressionTree, Interpreter, EstimationLimits.Lower, EstimationLimits.Upper);
    4861      var problemData = (IClassificationProblemData)ProblemData;
     62      var rows = problemData.TrainingIndices;
    4963      model.RecalculateModelParameters(problemData, rows);
    5064      return model;
     
    5468      var classificationModel = (IClassificationModel)model;
    5569      var classificationProblemData = (IClassificationProblemData)ProblemData;
    56       var trainingIndices = ProblemData.TrainingIndices.ToList();
     70      var trainingIndices = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);
    5771      var estimatedValues = classificationModel.GetEstimatedClassValues(ProblemData.Dataset, trainingIndices);
    5872      var targetValues = ProblemData.Dataset.GetDoubleValues(classificationProblemData.TargetVariable, trainingIndices);
    5973      OnlineCalculatorError errorState;
    60       var quality = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, estimatedValues, out errorState);
     74      var quality = OnlineAccuracyCalculator.Calculate(targetValues, estimatedValues, out errorState);
    6175      if (errorState != OnlineCalculatorError.None) return double.NaN;
    6276      return quality;
Note: See TracChangeset for help on using the changeset viewer.