Changeset 5722
- Timestamp:
- 03/16/11 19:29:57 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 1 added
- 27 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5624 r5722 60 60 61 61 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 62 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 62 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 LowerEstimationLimitParameter.ExecutionContext = context; 64 UpperEstimationLimitParameter.ExecutionContext = context; 65 66 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 67 68 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 69 LowerEstimationLimitParameter.ExecutionContext = null; 70 UpperEstimationLimitParameter.ExecutionContext = null; 71 72 return quality; 63 73 } 64 74 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5624 r5722 38 38 39 39 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 40 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 40 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 41 LowerEstimationLimitParameter.ExecutionContext = context; 42 UpperEstimationLimitParameter.ExecutionContext = context; 43 44 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 45 46 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 47 LowerEstimationLimitParameter.ExecutionContext = null; 48 UpperEstimationLimitParameter.ExecutionContext = null; 49 50 return quality; 41 51 } 42 52 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r5720 r5722 71 71 InitializeOperators(); 72 72 UpdateEstimationLimits(); 73 UpdateDatasetPartitions(); 73 74 } 74 75 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs
r5720 r5722 43 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 45 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 45 46 #region parameter properties 46 47 public ILookupParameter<IClassificationProblemData> ProblemDataParameter { … … 56 57 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 58 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 59 } 60 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 61 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 58 62 } 59 63 #endregion … … 71 75 get { return LowerEstimationLimitParameter.ActualValue; } 72 76 } 77 public BoolValue ApplyLinearScaling { 78 get { return ApplyLinearScalingParameter.Value; } 79 } 73 80 #endregion 74 81 … … 82 89 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 83 90 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 91 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false))); 84 92 } 85 93 public override IDeepCloneable Clone(Cloner cloner) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs
r5720 r5722 41 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 43 44 44 45 #region parameter properties … … 49 50 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 51 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 52 } 53 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 54 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 51 55 } 52 56 #endregion … … 59 63 get { return LowerEstimationLimitParameter.ActualValue; } 60 64 } 65 public BoolValue ApplyLinearScaling { 66 get { return ApplyLinearScalingParameter.Value; } 67 } 61 68 #endregion 62 69 [StorableConstructor] … … 67 74 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 68 75 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 76 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false))); 69 77 } 70 78 public override IDeepCloneable Clone(Cloner cloner) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5624 r5722 59 59 60 60 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 61 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 62 LowerEstimationLimitParameter.ExecutionContext = context; 63 UpperEstimationLimitParameter.ExecutionContext = context; 64 65 double mse = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 66 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 LowerEstimationLimitParameter.ExecutionContext = null; 69 UpperEstimationLimitParameter.ExecutionContext = null; 70 71 return mse; 62 72 } 63 73 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5624 r5722 58 58 59 59 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 60 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 60 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 61 LowerEstimationLimitParameter.ExecutionContext = context; 62 UpperEstimationLimitParameter.ExecutionContext = context; 63 64 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 65 66 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 67 LowerEstimationLimitParameter.ExecutionContext = null; 68 UpperEstimationLimitParameter.ExecutionContext = null; 69 70 return r2; 61 71 } 62 72 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r5720 r5722 70 70 InitializeOperators(); 71 71 UpdateEstimationLimits(); 72 UpdateDatasetPartitions(); 72 73 } 73 74 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs
r5720 r5722 43 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 45 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 45 46 #region parameter properties 46 47 public ILookupParameter<IClassificationProblemData> ProblemDataParameter { … … 56 57 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 58 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 59 } 60 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 61 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 58 62 } 59 63 #endregion … … 71 75 get { return LowerEstimationLimitParameter.ActualValue; } 72 76 } 77 public BoolValue ApplyLinearScaling { 78 get { return ApplyLinearScalingParameter.Value; } 79 } 73 80 #endregion 74 81 … … 82 89 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 83 90 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 91 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false))); 84 92 } 85 93 public override IDeepCloneable Clone(Cloner cloner) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs
r5720 r5722 41 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 43 44 44 45 #region parameter properties … … 49 50 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 51 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 52 } 53 54 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 55 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 51 56 } 52 57 #endregion … … 59 64 get { return LowerEstimationLimitParameter.ActualValue; } 60 65 } 66 public BoolValue ApplyLinearScaling { 67 get { return ApplyLinearScalingParameter.Value; } 68 } 61 69 #endregion 62 70 [StorableConstructor] … … 67 75 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 68 76 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 77 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false))); 69 78 } 70 79 public override IDeepCloneable Clone(Cloner cloner) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r5685 r5722 129 129 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs" /> 130 130 <Compile Include="SymbolicRegressionSolution.cs" /> 131 <Compile Include="SymbolicRegressionSolutionLinearScaler.cs" /> 131 132 <None Include="HeuristicLab.snk" /> 132 133 <None Include="HeuristicLabProblemsDataAnalysisSymbolicRegressionPlugin.cs.frame" /> -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5624 r5722 60 60 61 61 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 62 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 62 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 LowerEstimationLimitParameter.ExecutionContext = context; 64 UpperEstimationLimitParameter.ExecutionContext = context; 65 66 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 67 68 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 69 LowerEstimationLimitParameter.ExecutionContext = null; 70 UpperEstimationLimitParameter.ExecutionContext = null; 71 72 return quality; 63 73 } 64 74 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5624 r5722 59 59 60 60 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 61 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 62 LowerEstimationLimitParameter.ExecutionContext = context; 63 UpperEstimationLimitParameter.ExecutionContext = context; 64 65 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 66 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 LowerEstimationLimitParameter.ExecutionContext = null; 69 UpperEstimationLimitParameter.ExecutionContext = null; 70 71 return quality; 62 72 } 63 73 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs
r5720 r5722 72 72 InitializeOperators(); 73 73 UpdateEstimationLimits(); 74 UpdateDatasetPartitions(); 74 75 } 75 76 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs
r5720 r5722 43 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 45 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 45 46 #region parameter properties 46 47 public ILookupParameter<IRegressionProblemData> ProblemDataParameter { … … 56 57 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 58 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 59 } 60 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 61 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 58 62 } 59 63 #endregion … … 72 76 get { return LowerEstimationLimitParameter.ActualValue; } 73 77 } 78 public BoolValue ApplyLinearScaling { 79 get { return ApplyLinearScalingParameter.Value; } 80 } 74 81 #endregion 75 82 … … 83 90 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 84 91 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 92 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false))); 85 93 } 86 94 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs
r5720 r5722 41 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 43 44 44 45 #region parameter properties … … 49 50 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 51 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 52 } 53 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 54 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 51 55 } 52 56 #endregion … … 59 63 get { return LowerEstimationLimitParameter.ActualValue; } 60 64 } 65 public BoolValue ApplyLinearScaling { 66 get { return ApplyLinearScalingParameter.Value; } 67 } 61 68 #endregion 62 69 [StorableConstructor] … … 67 74 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 68 75 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 76 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false))); 69 77 } 70 78 public override IDeepCloneable Clone(Cloner cloner) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
r5624 r5722 59 59 60 60 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 61 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 62 LowerEstimationLimitParameter.ExecutionContext = context; 63 UpperEstimationLimitParameter.ExecutionContext = context; 64 65 double mse = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 66 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 LowerEstimationLimitParameter.ExecutionContext = null; 69 UpperEstimationLimitParameter.ExecutionContext = null; 70 71 return mse; 62 72 } 63 73 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r5624 r5722 59 59 60 60 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 61 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 62 LowerEstimationLimitParameter.ExecutionContext = context; 63 UpperEstimationLimitParameter.ExecutionContext = context; 64 65 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 66 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 LowerEstimationLimitParameter.ExecutionContext = null; 69 UpperEstimationLimitParameter.ExecutionContext = null; 70 71 return r2; 62 72 } 63 73 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
r5720 r5722 72 72 InitializeOperators(); 73 73 UpdateEstimationLimits(); 74 UpdateDatasetPartitions(); 74 75 } 75 76 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs
r5720 r5722 43 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 45 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 45 46 #region parameter properties 46 47 public ILookupParameter<IRegressionProblemData> ProblemDataParameter { … … 56 57 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 58 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 59 } 60 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 61 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 58 62 } 59 63 #endregion … … 72 76 get { return LowerEstimationLimitParameter.ActualValue; } 73 77 } 78 public BoolValue ApplyLinearScaling { 79 get { return ApplyLinearScalingParameter.Value; } 80 } 74 81 #endregion 75 82 [StorableConstructor] … … 82 89 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 83 90 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 91 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false))); 84 92 } 85 93 public override IDeepCloneable Clone(Cloner cloner) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs
r5720 r5722 41 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 43 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 44 44 #region parameter properties 45 45 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { … … 59 59 get { return LowerEstimationLimitParameter.ActualValue; } 60 60 } 61 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 62 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } 63 } 64 public BoolValue ApplyLinearScaling { 65 get { return ApplyLinearScalingParameter.Value; } 66 } 61 67 #endregion 62 68 … … 68 74 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 69 75 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 76 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(false))); 70 77 } 71 78 … … 76 83 protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 77 84 var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 78 return new SymbolicRegressionSolution(model, ProblemData); 85 var solution = new SymbolicRegressionSolution(model, ProblemData); 86 if (ApplyLinearScaling.Value) 87 SymbolicRegressionSolutionLinearScaler.Scale(solution); 88 return solution; 79 89 } 80 90 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionLinearScaler.cs
r5720 r5722 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Problems.DataAnalysis.Symbolic .Symbols;29 using HeuristicLab.Problems.DataAnalysis.Symbolic; 30 30 31 namespace HeuristicLab.Problems.DataAnalysis. Regression.Symbolic.Analyzers{31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 32 32 /// <summary> 33 33 /// An operator that creates a linearly transformed symbolic regression solution (given alpha and beta). … … 70 70 71 71 public override IOperation Apply() { 72 SymbolicExpressionTree tree = SymbolicExpressionTreeParameter.ActualValue; 73 DoubleValue alpha = AlphaParameter.ActualValue; 74 DoubleValue beta = BetaParameter.ActualValue; 75 if (alpha != null && beta != null) { 76 ScaledSymbolicExpressionTreeParameter.ActualValue = Scale(tree, alpha.Value, beta.Value); 77 } else { 78 // alpha or beta parameter not available => do not scale tree 79 ScaledSymbolicExpressionTreeParameter.ActualValue = tree; 80 } 81 72 // TODO 82 73 return base.Apply(); 83 74 } 84 75 85 p ublic static SymbolicExpressionTree Scale(SymbolicExpressionTree original, double alpha, double beta) {86 var mainBranch = original.Root. SubTrees[0].SubTrees[0];76 private static ISymbolicExpressionTree Scale(ISymbolicExpressionTree original, double alpha, double beta) { 77 var mainBranch = original.Root.GetSubTree(0).GetSubTree(0); 87 78 var scaledMainBranch = MakeSum(MakeProduct(beta, mainBranch), alpha); 88 79 89 80 // remove the main branch before cloning to prevent cloning of sub-trees 90 original.Root. SubTrees[0].RemoveSubTree(0);81 original.Root.GetSubTree(0).RemoveSubTree(0); 91 82 var scaledTree = (SymbolicExpressionTree)original.Clone(); 92 83 // insert main branch into the original tree again 93 original.Root. SubTrees[0].InsertSubTree(0, mainBranch);84 original.Root.GetSubTree(0).InsertSubTree(0, mainBranch); 94 85 // insert the scaled main branch into the cloned tree 95 scaledTree.Root. SubTrees[0].InsertSubTree(0, scaledMainBranch);86 scaledTree.Root.GetSubTree(0).InsertSubTree(0, scaledMainBranch); 96 87 return scaledTree; 97 88 } 98 89 99 private static SymbolicExpressionTreeNode MakeSum(SymbolicExpressionTreeNode treeNode, double alpha) {90 private static ISymbolicExpressionTreeNode MakeSum(ISymbolicExpressionTreeNode treeNode, double alpha) { 100 91 var node = (new Addition()).CreateTreeNode(); 101 92 var alphaConst = MakeConstant(alpha); … … 105 96 } 106 97 107 private static SymbolicExpressionTreeNode MakeProduct(double beta,SymbolicExpressionTreeNode treeNode) {98 private static ISymbolicExpressionTreeNode MakeProduct(double beta, ISymbolicExpressionTreeNode treeNode) { 108 99 var node = (new Multiplication()).CreateTreeNode(); 109 100 var betaConst = MakeConstant(beta); … … 113 104 } 114 105 115 private static SymbolicExpressionTreeNode MakeConstant(double c) {106 private static ISymbolicExpressionTreeNode MakeConstant(double c) { 116 107 var node = (ConstantTreeNode)(new Constant()).CreateTreeNode(); 117 108 node.Value = c; 118 109 return node; 119 110 } 111 112 internal static void Scale(SymbolicRegressionSolution solution) { 113 var dataset = solution.ProblemData.Dataset; 114 var targetVariable = solution.ProblemData.TargetVariable; 115 var rows = solution.ProblemData.TrainingIndizes; 116 var estimatedValues = solution.GetEstimatedValues(rows); 117 var targetValues = dataset.GetEnumeratedVariableValues(targetVariable, rows); 118 double alpha; 119 double beta; 120 OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out alpha, out beta); 121 122 var originalModel = solution.Model; 123 solution.Model = new SymbolicRegressionModel(Scale(originalModel.SymbolicExpressionTree, alpha, beta), originalModel.Interpreter); 124 } 120 125 } 121 126 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r5717 r5722 33 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 34 34 public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView { 35 private ISymbolicExpressionTree simplifiedExpressionTree;36 35 private Dictionary<ISymbolicExpressionTreeNode, ConstantTreeNode> replacementNodes; 37 36 private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts; … … 41 40 this.replacementNodes = new Dictionary<ISymbolicExpressionTreeNode, ConstantTreeNode>(); 42 41 this.nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>(); 43 this.simplifiedExpressionTree = null;44 42 this.Caption = "Interactive Solution Simplifier"; 45 43 } … … 85 83 replacementNodes.Clear(); 86 84 if (Content != null && Content.Model != null && Content.ProblemData != null) { 87 SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier(); 88 simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree); 89 90 var replacementValues = CalculateReplacementValues(simplifiedExpressionTree); 85 var tree = Content.Model.SymbolicExpressionTree; 86 var replacementValues = CalculateReplacementValues(tree); 91 87 foreach (var pair in replacementValues) { 92 88 replacementNodes.Add(pair.Key, MakeConstantTreeNode(pair.Value)); 93 89 } 94 nodeImpacts = CalculateImpactValues( simplifiedExpressionTree);90 nodeImpacts = CalculateImpactValues(Content.Model.SymbolicExpressionTree); 95 91 96 92 // automatically fold all branches with impact = 1 97 List<ISymbolicExpressionTreeNode> nodeList = simplifiedExpressionTree.Root.GetSubTree(0).IterateNodesPrefix().ToList();93 List<ISymbolicExpressionTreeNode> nodeList = Content.Model.SymbolicExpressionTree.Root.GetSubTree(0).IterateNodesPrefix().ToList(); 98 94 foreach (var parent in nodeList) { 99 95 for (int subTreeIndex = 0; subTreeIndex < parent.SubTrees.Count(); subTreeIndex++) { … … 105 101 } 106 102 // show only interesting part of solution 107 this.treeChart.Tree = new SymbolicExpressionTree( simplifiedExpressionTree.Root.GetSubTree(0).GetSubTree(0));103 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubTree(0).GetSubTree(0)); 108 104 this.PaintNodeImpacts(); 109 105 } … … 125 121 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) { 126 122 VisualSymbolicExpressionTreeNode visualTreeNode = (VisualSymbolicExpressionTreeNode)sender; 127 foreach (SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) { 123 var tree = Content.Model.SymbolicExpressionTree; 124 foreach (SymbolicExpressionTreeNode treeNode in tree.IterateNodesPostfix()) { 128 125 for (int i = 0; i < treeNode.SubTrees.Count(); i++) { 129 126 ISymbolicExpressionTreeNode subTree = treeNode.GetSubTree(i); … … 135 132 136 133 // show only interesting part of solution 137 this.treeChart.Tree = new SymbolicExpressionTree( simplifiedExpressionTree.Root.GetSubTree(0).GetSubTree(0));134 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubTree(0).GetSubTree(0)); 138 135 139 SymbolicExpressionTree tree = (SymbolicExpressionTree)simplifiedExpressionTree.Clone();140 136 UpdateModel(tree); 141 137 this.PaintNodeImpacts(); … … 157 153 double max = impacts.Max(); 158 154 double min = impacts.Min(); 159 foreach (ISymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {155 foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) { 160 156 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) { 161 157 double impact = this.nodeImpacts[treeNode]; 162 158 double replacementValue = this.replacementNodes[treeNode].Value; 163 159 VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode); 164 160 165 161 // impact = 0 if no change 166 162 // impact < 0 if new solution is better … … 180 176 181 177 private void PaintCollapsedNodes() { 182 foreach (ISymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {178 foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) { 183 179 if (treeNode is ConstantTreeNode && replacementNodes.ContainsValue((ConstantTreeNode)treeNode)) 184 180 this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DarkOrange; … … 192 188 193 189 private void btnSimplify_Click(object sender, EventArgs e) { 194 this.CalculateReplacementNodesAndNodeImpacts(); 190 SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier(); 191 var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree); 192 UpdateModel(simplifiedExpressionTree); 195 193 } 196 194 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer.cs
r5685 r5722 115 115 int end = ValidationSamplesEnd.Value; 116 116 IEnumerable<int> rows = Enumerable.Range(start, end - start); 117 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator); 117 118 for (int i = 0; i < tree.Length; i++) { 118 qualities.Add(evaluator.Evaluate( ExecutionContext, tree[i], ProblemData, rows)); // qualities[i] = ...119 qualities.Add(evaluator.Evaluate(childContext, tree[i], ProblemData, rows)); // qualities[i] = ... 119 120 if (IsNonDominated(qualities[i], trainingBestQualities, maximization) && 120 121 IsNonDominated(qualities[i], qualities, maximization)) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
r5613 r5722 87 87 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The qualities of the trees that should be analyzed.")); 88 88 Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "The direction of optimization.")); 89 Parameters.Add(new LookupParameter< T>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution."));89 Parameters.Add(new LookupParameter<S>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution.")); 90 90 Parameters.Add(new LookupParameter<DoubleValue>(ValidationBestSolutionQualityParameterName, "The quality of the validation best symbolic data analysis solution.")); 91 91 } … … 101 101 int end = ValidationSamplesEnd.Value; 102 102 IEnumerable<int> rows = Enumerable.Range(start, end - start); 103 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator); 103 104 for (int i = 0; i < tree.Length; i++) { 104 quality[i] = evaluator.Evaluate( ExecutionContext, tree[i], ProblemData, rows);105 quality[i] = evaluator.Evaluate(childContext, tree[i], ProblemData, rows); 105 106 if (IsBetter(quality[i], bestQuality, Maximization.Value)) { 106 107 bestQuality = quality[i]; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisValidationAnalyzer.cs
r5607 r5722 22 22 using HeuristicLab.Data; 23 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 24 public interface ISymbolicDataAnalysisValidationAnalyzer<T, U> : ISymbolicDataAnalysisAnalyzer 24 public interface ISymbolicDataAnalysisValidationAnalyzer<T, U> : ISymbolicDataAnalysisAnalyzer, ISymbolicDataAnalysisInterpreterOperator 25 25 where T : class,ISymbolicDataAnalysisEvaluator<U> 26 26 where U : class, IDataAnalysisProblemData { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r5716 r5722 146 146 SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeInterpreter(); 147 147 148 InitializeOperators(); 149 148 150 UpdateGrammar(); 149 151 UpdateDatasetPartitions(); 150 152 RegisterEventHandlers(); 151 InitializeOperators();152 153 } 153 154 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r5681 r5722 118 118 <Compile Include="Interfaces\Classification\IClassificationEnsembleModel.cs" /> 119 119 <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs" /> 120 <Compile Include="OnlineEvaluators\OnlineLinearScalingParameterCalculator.cs" /> 120 121 <Compile Include="RegressionEnsembleModel.cs" /> 121 122 <Compile Include="DiscriminantFunctionClassificationModel.cs" />
Note: See TracChangeset
for help on using the changeset viewer.