- Timestamp:
- 04/16/19 23:41:31 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
r16565 r16798 46 46 protected override ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) { 47 47 const int constOptIterations = 50; 48 const int maxRepetitions = 1000; 48 49 var regressionProblemData = Content.ProblemData; 49 50 var model = Content.Model; 50 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(model.Interpreter, tree, regressionProblemData, regressionProblemData.TrainingIndices, 51 applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: model.LowerEstimationLimit, upperEstimationLimit: model.UpperEstimationLimit, 52 iterationCallback: (args, func, obj) => { 53 double newProgressValue = progress.ProgressValue + 1.0 / (constOptIterations + 2); // (maxIterations + 2) iterations are reported 54 progress.ProgressValue = Math.Min(newProgressValue, 1.0); 55 }); 51 progress.CanBeStopped = true; 52 var prevResult = 0.0; 53 var result = 0.0; 54 int reps = 0; 55 56 do { 57 prevResult = result; 58 result = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(model.Interpreter, tree, regressionProblemData, regressionProblemData.TrainingIndices, 59 applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: model.LowerEstimationLimit, upperEstimationLimit: model.UpperEstimationLimit, 60 iterationCallback: (args, func, obj) => { 61 double newProgressValue = progress.ProgressValue + 1.0 / (constOptIterations + 2); // (maxIterations + 2) iterations are reported 62 progress.ProgressValue = Math.Min(newProgressValue, 1.0); 63 }); 64 reps++; 65 } while (prevResult < result && reps < maxRepetitions && 66 progress.ProgressState != ProgressState.StopRequested && 67 progress.ProgressState != ProgressState.CancelRequested); 56 68 return tree; 57 69 }
Note: See TracChangeset
for help on using the changeset viewer.