Changeset 10538 for branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Timestamp:
- 03/05/14 14:48:13 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 10 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj
r9288 r10538 120 120 <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" /> 121 121 <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" /> 122 <Compile Include="SymbolicClassificationPruningAnalyzer.cs" /> 122 123 <Compile Include="SymbolicClassificationSolutionImpactValuesCalculator.cs" /> 123 124 <Compile Include="SymbolicNearestNeighbourClassificationModel.cs" /> … … 149 150 <SubType>Code</SubType> 150 151 </Compile> 152 <Compile Include="SymbolicClassificationPruningOperator.cs" /> 151 153 <None Include="HeuristicLab.snk" /> 152 154 <None Include="Plugin.cs.frame" /> -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r9456 r10538 44 44 public override IEnumerable<bool> Maximization { get { return new bool[2] { false, false }; } } 45 45 46 public override IOperation Apply() {46 public override IOperation InstrumentedApply() { 47 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 48 var solution = SymbolicExpressionTreeParameter.ActualValue; 49 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 50 QualitiesParameter.ActualValue = new DoubleArray(qualities); 51 return base. Apply();51 return base.InstrumentedApply(); 52 52 } 53 53 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r9456 r10538 44 44 public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } 45 45 46 public override IOperation Apply() {46 public override IOperation InstrumentedApply() { 47 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 48 var solution = SymbolicExpressionTreeParameter.ActualValue; 49 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 50 50 QualitiesParameter.ActualValue = new DoubleArray(qualities); 51 return base. Apply();51 return base.InstrumentedApply(); 52 52 } 53 53 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs
r9456 r10538 44 44 public override bool Maximization { get { return false; } } 45 45 46 public override IOperation Apply() {46 public override IOperation InstrumentedApply() { 47 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 48 var solution = SymbolicExpressionTreeParameter.ActualValue; 49 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 50 50 QualityParameter.ActualValue = new DoubleValue(quality); 51 return base. Apply();51 return base.InstrumentedApply(); 52 52 } 53 53 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r9456 r10538 45 45 public override bool Maximization { get { return false; } } 46 46 47 public override IOperation Apply() {47 public override IOperation InstrumentedApply() { 48 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 49 var solution = SymbolicExpressionTreeParameter.ActualValue; 50 50 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 51 51 QualityParameter.ActualValue = new DoubleValue(quality); 52 return base. Apply();52 return base.InstrumentedApply(); 53 53 } 54 54 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r9456 r10538 44 44 public override bool Maximization { get { return true; } } 45 45 46 public override IOperation Apply() {46 public override IOperation InstrumentedApply() { 47 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 48 var solution = SymbolicExpressionTreeParameter.ActualValue; 49 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 50 50 QualityParameter.ActualValue = new DoubleValue(quality); 51 return base. Apply();51 return base.InstrumentedApply(); 52 52 } 53 53 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePenaltyScoreEvaluator.cs
r9456 r10538 64 64 65 65 66 public override IOperation Apply() {66 public override IOperation InstrumentedApply() { 67 67 double quality = Evaluate(ExecutionContext, SymbolicExpressionTreeParameter.ActualValue, ProblemDataParameter.ActualValue, GenerateRowsToEvaluate()); 68 68 QualityParameter.ActualValue = new DoubleValue(quality); 69 return base. Apply();69 return base.InstrumentedApply(); 70 70 } 71 71 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolutionImpactValuesCalculator.cs
r9456 r10538 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 28 26 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 30 [StorableClass] 31 [Item("SymbolicClassificationSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for classification problems.")] 27 32 public class SymbolicClassificationSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator { 33 public SymbolicClassificationSolutionImpactValuesCalculator() { } 34 protected SymbolicClassificationSolutionImpactValuesCalculator(SymbolicClassificationSolutionImpactValuesCalculator original, Cloner cloner) 35 : base(original, cloner) { } 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new SymbolicClassificationSolutionImpactValuesCalculator(this, cloner); 38 } 39 [StorableConstructor] 40 protected SymbolicClassificationSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { } 41 28 42 public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) { 29 43 var classificationModel = (ISymbolicClassificationModel)model; … … 34 48 35 49 public override double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN) { 50 double impactValue, replacementValue; 51 CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, originalQuality); 52 return impactValue; 53 } 54 55 public override void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, 56 IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue, 57 double originalQuality = Double.NaN) { 36 58 var classificationModel = (ISymbolicClassificationModel)model; 37 59 var classificationProblemData = (IClassificationProblemData)problemData; … … 47 69 } 48 70 49 varreplacementValue = CalculateReplacementValue(classificationModel, node, classificationProblemData, rows);71 replacementValue = CalculateReplacementValue(classificationModel, node, classificationProblemData, rows); 50 72 var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue }; 73 51 74 var cloner = new Cloner(); 52 cloner.RegisterClonedObject(node, constantNode);53 75 var tempModel = cloner.Clone(classificationModel); 54 tempModel.RecalculateModelParameters(classificationProblemData, rows); 76 var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node); 77 78 var tempModelParentNode = tempModelNode.Parent; 79 int i = tempModelParentNode.IndexOfSubtree(tempModelNode); 80 tempModelParentNode.RemoveSubtree(i); 81 tempModelParentNode.InsertSubtree(i, constantNode); 55 82 56 83 var estimatedClassValues = tempModel.GetEstimatedClassValues(dataset, rows); … … 58 85 if (errorState != OnlineCalculatorError.None) newQuality = 0.0; 59 86 60 returnoriginalQuality - newQuality;87 impactValue = originalQuality - newQuality; 61 88 } 62 63 89 } 64 90 }
Note: See TracChangeset
for help on using the changeset viewer.