- Timestamp:
- 10/06/17 13:38:16 (7 years ago)
- Location:
- stable
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 15371-15372,15390,15400,15402
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
r15131 r15406 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 23 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 24 using HeuristicLab.MainForm; 26 25 using HeuristicLab.Problems.DataAnalysis.Symbolic.Views; 27 26 28 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views { 29 28 public partial class InteractiveSymbolicRegressionSolutionSimplifierView : InteractiveSymbolicDataAnalysisSolutionSimplifierView { 30 private readonly SymbolicRegressionSolutionImpactValuesCalculator calculator;31 32 29 public new SymbolicRegressionSolution Content { 33 30 get { return (SymbolicRegressionSolution)base.Content; } … … 36 33 37 34 public InteractiveSymbolicRegressionSolutionSimplifierView() 38 : base( ) {35 : base(new SymbolicRegressionSolutionImpactValuesCalculator()) { 39 36 InitializeComponent(); 40 37 this.Caption = "Interactive Regression Solution Simplifier"; 41 calculator = new SymbolicRegressionSolutionImpactValuesCalculator();42 38 } 43 39 … … 48 44 } 49 45 50 51 protected override Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) { 52 var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>(); 53 foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) { 54 double impactValue, replacementValue, newQualityForImpactsCalculation; 55 calculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation); 56 impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue)); 57 } 58 return impactAndReplacementValues; 59 } 60 61 protected override void btnOptimizeConstants_Click(object sender, EventArgs e) { 46 protected override ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) { 47 const int constOptIterations = 50; 48 var regressionProblemData = Content.ProblemData; 62 49 var model = Content.Model; 63 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(model.Interpreter, model.SymbolicExpressionTree, Content.ProblemData, Content.ProblemData.TrainingIndices, 64 applyLinearScaling: true, maxIterations: 50, updateVariableWeights: true, lowerEstimationLimit: model.LowerEstimationLimit, upperEstimationLimit: model.UpperEstimationLimit); 65 UpdateModel(Content.Model.SymbolicExpressionTree); 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 }); 56 return tree; 66 57 } 67 58 } -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.cs
r14186 r15406 51 51 private void btn_SimplifyModel_Click(object sender, EventArgs e) { 52 52 var view = new InteractiveSymbolicRegressionSolutionSimplifierView(); 53 view.Show(); // open view first that a progress can be displayed when setting the content 53 54 view.Content = (SymbolicRegressionSolution)this.Content.Clone(); 54 view.Show();55 55 } 56 56
Note: See TracChangeset
for help on using the changeset viewer.