Changeset 16713 for branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Timestamp:
- 03/26/19 11:37:29 (6 years ago)
- Location:
- branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r16685 r16713 204 204 <Compile Include="Plugin.cs" /> 205 205 <Compile Include="SingleObjective\ConstantOptimizationAnalyzer.cs" /> 206 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionConstraintSatisfactionEvaluator.cs" /> 206 207 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" /> 207 208 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs" /> -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs
r16645 r16713 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HEAL.Attic;29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 59 59 OnlineCalculatorError errorState = OnlineCalculatorError.None; 60 60 61 IntervalConstraintsParser parser = new IntervalConstraintsParser(); 62 var constraints = parser.Parse(((RegressionProblemData)problemData).IntervalConstraintsParameter.Value.Value); 61 var constraints = IntervalConstraintsParser.Parse(((RegressionProblemData)problemData).IntervalConstraintsParameter.Value.Value); 63 62 var intervalInterpreter = new IntervalInterpreter(); 64 63 var variableRanges = ((RegressionProblemData)problemData).VariableRangesParameter.Value.VariableIntervals; … … 90 89 } 91 90 92 private static bool HasConstraintVioluations( List<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter,91 private static bool HasConstraintVioluations(IEnumerable<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter, 93 92 Dictionary<string, Interval> variableRanges, ISymbolicExpressionTree solution) { 94 93 foreach (var constraint in constraints) { … … 96 95 throw new ArgumentException($"The given variable {constraint.Variable} in the constraint does not exists in the model.", nameof(IntervalConstraintsParser)); 97 96 if (!constraint.IsDerivation) { 98 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(solution, variableRanges);97 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges); 99 98 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 100 99 constraint.InclusiveUpperBound)) { … … 106 105 tree = DerivativeCalculator.Derive(tree, constraint.Variable); 107 106 } 108 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(tree, variableRanges);107 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges); 109 108 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 110 109 constraint.InclusiveUpperBound)) { -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator.cs
r16644 r16713 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HEAL.Attic;29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 59 59 OnlineCalculatorError errorState = OnlineCalculatorError.None; 60 60 61 IntervalConstraintsParser parser = new IntervalConstraintsParser(); 62 var constraints = parser.Parse(((RegressionProblemData) problemData).IntervalConstraintsParameter.Value.Value); 61 var constraints = IntervalConstraintsParser.Parse(((RegressionProblemData)problemData).IntervalConstraintsParameter.Value.Value); 63 62 var intervalInterpreter = new IntervalInterpreter(); 64 var variableRanges = ((RegressionProblemData) 63 var variableRanges = ((RegressionProblemData)problemData).VariableRangesParameter.Value.VariableIntervals; 65 64 66 65 … … 92 91 // var e = m.GetEstimatedValues (TRAINING) 93 92 // OnlinePearsonCalc.Calculate(e, TARGET_TRAIING) 94 93 95 94 // scaledTree = model.Tree; 96 95 … … 120 119 } 121 120 if (errorState != OnlineCalculatorError.None) return double.NaN; 122 return r *r;121 return r * r; 123 122 } 124 123 … … 141 140 } 142 141 143 private static bool CheckConstraintsViolations( List<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter,142 private static bool CheckConstraintsViolations(IEnumerable<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter, 144 143 Dictionary<string, Interval> variableRanges, ISymbolicExpressionTree solution, out double r) { 145 144 foreach (var constraint in constraints) { … … 147 146 throw new ArgumentException($"The given variable {constraint.Variable} in the constraint does not exists in the model.", nameof(IntervalConstraintsParser)); 148 147 if (!constraint.IsDerivation) { 149 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(solution, variableRanges);148 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges); 150 149 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 151 150 constraint.InclusiveUpperBound)) { … … 158 157 tree = DerivativeCalculator.Derive(tree, constraint.Variable); 159 158 } 160 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(tree, variableRanges);159 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges); 161 160 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 162 161 constraint.InclusiveUpperBound)) { -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionConstraintAnalyzer.cs
r16644 r16713 24 24 using System; 25 25 using System.Collections.Generic; 26 using HEAL.Attic; 26 27 using HeuristicLab.Analysis; 27 28 using HeuristicLab.Common; … … 30 31 using HeuristicLab.Optimization; 31 32 using HeuristicLab.Parameters; 32 using HEAL.Attic;33 33 34 34 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 86 86 public override IOperation Apply() { 87 87 var results = ResultCollectionParameter.ActualValue; 88 IntervalConstraintsParser parser = new IntervalConstraintsParser();89 88 var intervalInterpreter = new IntervalInterpreter(); 90 89 if (!results.ContainsKey(ConstraintViolationsResultName)) { … … 99 98 var constraintViolations = new Dictionary<string, int>(); 100 99 101 var constraints = 102 parser.Parse(problemData.IntervalConstraints.Value); 100 var constraints = IntervalConstraintsParser.Parse(problemData.IntervalConstraints.Value); 103 101 var variableRanges = problemData.VariableRanges.VariableIntervals; 104 102 … … 122 120 nameof(IntervalConstraintsParser)); 123 121 if (!constraint.IsDerivation) { 124 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(tree,122 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, 125 123 variableRanges); 126 124 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, … … 134 132 } 135 133 136 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(dTree,134 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(dTree, 137 135 variableRanges); 138 136 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r16644 r16713 21 21 22 22 using System.Linq; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 26 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 28 using HeuristicLab.Optimization; 28 using HEAL.Attic;29 29 using HeuristicLab.Problems.DataAnalysis.Implementation; 30 30 … … 168 168 if (variableRanges != null) { 169 169 intervalEvaluation.Add($"Target {ProblemData.TargetVariable}", new Interval(variableRanges[ProblemData.TargetVariable].LowerBound, variableRanges[ProblemData.TargetVariable].UpperBound)); 170 intervalEvaluation.Add("Modell Interval", interpreter.GetSymbolicEx ressionTreeInterval(Model.SymbolicExpressionTree, variableRanges));170 intervalEvaluation.Add("Modell Interval", interpreter.GetSymbolicExpressionTreeInterval(Model.SymbolicExpressionTree, variableRanges)); 171 171 172 172 foreach (var derivate in variableRanges) { 173 173 if (derivate.Key != ProblemData.TargetVariable) { 174 174 var derived = DerivativeCalculator.Derive(Model.SymbolicExpressionTree, derivate.Key); 175 var derivedResultInterval = interpreter.GetSymbolicEx ressionTreeInterval(derived, variableRanges);175 var derivedResultInterval = interpreter.GetSymbolicExpressionTreeInterval(derived, variableRanges); 176 176 intervalEvaluation.Add(" ?f/?" + derivate.Key, 177 177 new Interval(derivedResultInterval.LowerBound, derivedResultInterval.UpperBound));
Note: See TracChangeset
for help on using the changeset viewer.