Changeset 11146
- Timestamp:
- 07/08/14 19:30:48 (10 years ago)
- Location:
- stable
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10492
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views merged: 10492
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs
r9456 r11146 59 59 return model; 60 60 } 61 62 61 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) { 63 62 return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary( … … 68 67 69 68 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) { 70 return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary( 71 n => n, 72 n => calculator.CalculateImpactValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices, Content.TrainingAccuracy) 73 ); 69 var values = CalculateImpactAndReplacementValues(tree); 70 return values.ToDictionary(x => x.Key, x => x.Value.Item1); 71 } 72 73 protected override Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) { 74 var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>(); 75 foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) { 76 double impactValue, replacementValue; 77 calculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue); 78 impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue)); 79 } 80 return impactAndReplacementValues; 74 81 } 75 82 -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views merged: 10492
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
r9456 r11146 56 56 57 57 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) { 58 return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary( 59 n => n, 60 n => calculator.CalculateImpactValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices, Content.TrainingRSquared) 61 ); 58 var values = CalculateImpactAndReplacementValues(tree); 59 return values.ToDictionary(x => x.Key, x => x.Value.Item1); 60 } 61 62 protected override Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) { 63 var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>(); 64 foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) { 65 double impactValue, replacementValue; 66 calculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue); 67 impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue)); 68 } 69 return impactAndReplacementValues; 62 70 } 63 71 -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs
r9462 r11146 49 49 } 50 50 51 protected override void UpdateModel(ISymbolicExpressionTree tree) { 52 var model = new SymbolicTimeSeriesPrognosisModel(tree, Content.Model.Interpreter); 53 model.Scale(Content.ProblemData); 54 Content.Model = model; 55 } 56 57 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) { 58 Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); 59 foreach (var componentBranch in tree.Root.GetSubtree(0).Subtrees) 60 foreach (ISymbolicExpressionTreeNode node in componentBranch.IterateNodesPrefix()) { 61 replacementValues[node] = CalculateReplacementValue(node, tree); 62 } 63 return replacementValues; 64 } 65 66 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) { 51 protected override Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) { 67 52 var interpreter = Content.Model.Interpreter; 68 53 var rows = Content.ProblemData.TrainingIndices; … … 72 57 var originalOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows).ToArray(); 73 58 74 Dictionary<ISymbolicExpressionTreeNode, double> impactValues = new Dictionary<ISymbolicExpressionTreeNode, double>();59 var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>(); 75 60 List<ISymbolicExpressionTreeNode> nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPostfix().ToList(); 76 61 OnlineCalculatorError errorState; … … 90 75 // impact < 0 if new solution is better 91 76 // impact > 0 if new solution is worse 92 impactValues[node] = originalR2 - newR2; 77 double impact = originalR2 - newR2; 78 impactAndReplacementValues[node] = new Tuple<double, double>(impact, constantNode.Value); 93 79 SwitchNode(parent, replacementNode, node); 94 80 } 95 return impactValues; 81 return impactAndReplacementValues; 82 } 83 84 protected override void UpdateModel(ISymbolicExpressionTree tree) { 85 var model = new SymbolicTimeSeriesPrognosisModel(tree, Content.Model.Interpreter); 86 model.Scale(Content.ProblemData); 87 Content.Model = model; 88 } 89 90 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) { 91 var replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); 92 foreach (var componentBranch in tree.Root.GetSubtree(0).Subtrees) 93 foreach (ISymbolicExpressionTreeNode node in componentBranch.IterateNodesPrefix()) { 94 replacementValues[node] = CalculateReplacementValue(node, tree); 95 } 96 return replacementValues; 97 } 98 99 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) { 100 var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree); 101 return impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1); // item1 of the tuple is the impact value 96 102 } 97 103 -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 10492
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r11120 r11146 82 82 treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); 83 83 84 var replacementValues = CalculateReplacementValues(tree); 84 var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree); 85 nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1); 86 var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2); 85 87 foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) { 86 88 foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value); 87 89 } 88 89 nodeImpacts = CalculateImpactValues(tree);90 90 PaintNodeImpacts(); 91 91 } … … 93 93 protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree); 94 94 protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree); 95 protected abstract Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree); 95 96 protected abstract void UpdateModel(ISymbolicExpressionTree tree); 96 97
Note: See TracChangeset
for help on using the changeset viewer.