Changeset 5699
- Timestamp:
- 03/15/11 19:37:20 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 14 added
- 4 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab 3.3.sln
r5693 r5699 115 115 {DC3D7072-7999-4719-B65D-3997744D5DC1} = {DC3D7072-7999-4719-B65D-3997744D5DC1} 116 116 {FC841674-62A7-4055-BE91-E41944B6C606} = {FC841674-62A7-4055-BE91-E41944B6C606} 117 {20831A74-D18F-42D9-A667-1CE3AF53DF93} = {20831A74-D18F-42D9-A667-1CE3AF53DF93} 117 118 {76945D76-CA61-4147-9DC2-0ACDCDDF87F9} = {76945D76-CA61-4147-9DC2-0ACDCDDF87F9} 118 119 {2E782078-FA81-4B70-B56F-74CE38DAC6C8} = {2E782078-FA81-4B70-B56F-74CE38DAC6C8} … … 162 163 {96AEBBEE-4203-45F3-BCF5-7B73BF256BDA} = {96AEBBEE-4203-45F3-BCF5-7B73BF256BDA} 163 164 {5A4679EF-A8F3-4647-B722-441A36B3BA6B} = {5A4679EF-A8F3-4647-B722-441A36B3BA6B} 165 {BF1E4DF4-A4CC-451F-9D50-303F405E265E} = {BF1E4DF4-A4CC-451F-9D50-303F405E265E} 164 166 {23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE} = {23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE} 165 167 {BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937} = {BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937} … … 381 383 EndProject 382 384 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj", "{7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}" 385 EndProject 386 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.csproj", "{BF1E4DF4-A4CC-451F-9D50-303F405E265E}" 387 EndProject 388 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.csproj", "{20831A74-D18F-42D9-A667-1CE3AF53DF93}" 383 389 EndProject 384 390 Global … … 1751 1757 {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}.Release|x86.ActiveCfg = Release|x86 1752 1758 {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}.Release|x86.Build.0 = Release|x86 1759 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 1760 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Debug|Any CPU.Build.0 = Debug|Any CPU 1761 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Debug|x64.ActiveCfg = Debug|x64 1762 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Debug|x64.Build.0 = Debug|x64 1763 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Debug|x86.ActiveCfg = Debug|x86 1764 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Debug|x86.Build.0 = Debug|x86 1765 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Release|Any CPU.ActiveCfg = Release|Any CPU 1766 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Release|Any CPU.Build.0 = Release|Any CPU 1767 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Release|x64.ActiveCfg = Release|x64 1768 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Release|x64.Build.0 = Release|x64 1769 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Release|x86.ActiveCfg = Release|x86 1770 {BF1E4DF4-A4CC-451F-9D50-303F405E265E}.Release|x86.Build.0 = Release|x86 1771 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 1772 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Debug|Any CPU.Build.0 = Debug|Any CPU 1773 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Debug|x64.ActiveCfg = Debug|x64 1774 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Debug|x64.Build.0 = Debug|x64 1775 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Debug|x86.ActiveCfg = Debug|x86 1776 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Debug|x86.Build.0 = Debug|x86 1777 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Release|Any CPU.ActiveCfg = Release|Any CPU 1778 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Release|Any CPU.Build.0 = Release|Any CPU 1779 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Release|x64.ActiveCfg = Release|x64 1780 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Release|x64.Build.0 = Release|x64 1781 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Release|x86.ActiveCfg = Release|x86 1782 {20831A74-D18F-42D9-A667-1CE3AF53DF93}.Release|x86.Build.0 = Release|x86 1753 1783 EndGlobalSection 1754 1784 GlobalSection(SolutionProperties) = preSolution -
branches/DataAnalysis Refactoring/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs
r5618 r5699 32 32 /// <returns></returns> 33 33 public static double Median(this IEnumerable<double> values) { 34 int n = values.Count(); 34 // iterate only once 35 double[] valuesArr = values.ToArray(); 36 int n = valuesArr.Length; 35 37 if (n == 0) throw new InvalidOperationException("Enumeration contains no elements."); 36 38 37 double[] sortedValues = new double[n]; 38 int i = 0; 39 foreach (double x in values) 40 sortedValues[i++] = x; 41 42 Array.Sort(sortedValues); 39 Array.Sort(valuesArr); 43 40 44 41 // return the middle element (if n is uneven) or the average of the two middle elements if n is even. 45 42 if (n % 2 == 1) { 46 return sortedValues[n / 2];43 return valuesArr[n / 2]; 47 44 } else { 48 return ( sortedValues[(n / 2) - 1] + sortedValues[n / 2]) / 2.0;45 return (valuesArr[(n / 2) - 1] + valuesArr[n / 2]) / 2.0; 49 46 } 50 47 } … … 92 89 /// </summary 93 90 public static double Percentile(this IEnumerable<double> values, double p) { 94 if (values.Count() == 0) throw new InvalidOperationException("Enumeration contains no elements."); 95 if (values.Count() == 1) return values.ElementAt(0); 91 // iterate only once 92 double[] valuesArr = values.ToArray(); 93 int n = valuesArr.Length; 94 if (n == 0) throw new InvalidOperationException("Enumeration contains no elements."); 95 if (n == 1) return values.ElementAt(0); 96 96 97 double[] sortedValues = values.ToArray(); 98 Array.Sort(sortedValues); 99 100 int n = sortedValues.Length; 101 if (p.IsAlmost(0.0)) return sortedValues[0]; 102 if (p.IsAlmost(1.0)) return sortedValues[n - 1]; 97 if (p.IsAlmost(0.0)) return valuesArr[0]; 98 if (p.IsAlmost(1.0)) return valuesArr[n - 1]; 103 99 104 100 double t = p * (n - 1); 105 101 int index = (int)Math.Floor(t); 106 102 double percentage = t - index; 107 return sortedValues[index] * (1 - percentage) + sortedValues[index + 1] * percentage;103 return valuesArr[index] * (1 - percentage) + valuesArr[index + 1] * percentage; 108 104 } 109 105 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.Designer.cs
r5692 r5699 20 20 #endregion 21 21 22 namespace HeuristicLab.Problems.DataAnalysis. Views.Symbolic{22 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views { 23 23 partial class InteractiveSymbolicRegressionSolutionSimplifierView { 24 24 /// <summary> … … 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();48 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();49 this.splitContainer = new System.Windows.Forms.SplitContainer();50 this.grpSimplify = new System.Windows.Forms.GroupBox();51 this.btnSimplify = new System.Windows.Forms.Button();52 this.grpViewHost = new System.Windows.Forms.GroupBox();53 this.splitContainer.Panel1.SuspendLayout();54 this.splitContainer.Panel2.SuspendLayout();55 this.splitContainer.SuspendLayout();56 this.grpSimplify.SuspendLayout();57 this.grpViewHost.SuspendLayout();58 47 this.SuspendLayout(); 59 //60 // treeChart61 //62 this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)63 | System.Windows.Forms.AnchorStyles.Left)64 | System.Windows.Forms.AnchorStyles.Right)));65 this.treeChart.BackgroundColor = System.Drawing.Color.White;66 this.treeChart.LineColor = System.Drawing.Color.Black;67 this.treeChart.Location = new System.Drawing.Point(6, 16);68 this.treeChart.Name = "treeChart";69 this.treeChart.Size = new System.Drawing.Size(201, 297);70 this.treeChart.Spacing = 5;71 this.treeChart.TabIndex = 0;72 this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);73 this.treeChart.Tree = null;74 this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);75 //76 // viewHost77 //78 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)79 | System.Windows.Forms.AnchorStyles.Left)80 | System.Windows.Forms.AnchorStyles.Right)));81 this.viewHost.Caption = "View";82 this.viewHost.Content = null;83 this.viewHost.Enabled = false;84 this.viewHost.Location = new System.Drawing.Point(6, 16);85 this.viewHost.Name = "viewHost";86 this.viewHost.ReadOnly = false;87 this.viewHost.Size = new System.Drawing.Size(335, 326);88 this.viewHost.TabIndex = 0;89 this.viewHost.ViewType = null;90 //91 // splitContainer92 //93 this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;94 this.splitContainer.Location = new System.Drawing.Point(0, 0);95 this.splitContainer.Name = "splitContainer";96 //97 // splitContainer.Panel198 //99 this.splitContainer.Panel1.Controls.Add(this.grpSimplify);100 //101 // splitContainer.Panel2102 //103 this.splitContainer.Panel2.Controls.Add(this.grpViewHost);104 this.splitContainer.Size = new System.Drawing.Size(564, 348);105 this.splitContainer.SplitterDistance = 213;106 this.splitContainer.TabIndex = 1;107 //108 // grpSimplify109 //110 this.grpSimplify.Controls.Add(this.btnSimplify);111 this.grpSimplify.Controls.Add(this.treeChart);112 this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill;113 this.grpSimplify.Location = new System.Drawing.Point(0, 0);114 this.grpSimplify.Name = "grpSimplify";115 this.grpSimplify.Size = new System.Drawing.Size(213, 348);116 this.grpSimplify.TabIndex = 1;117 this.grpSimplify.TabStop = false;118 this.grpSimplify.Text = "Simplify";119 //120 // btnSimplify121 //122 this.btnSimplify.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)123 | System.Windows.Forms.AnchorStyles.Right)));124 this.btnSimplify.Location = new System.Drawing.Point(6, 319);125 this.btnSimplify.Name = "btnSimplify";126 this.btnSimplify.Size = new System.Drawing.Size(201, 23);127 this.btnSimplify.TabIndex = 1;128 this.btnSimplify.Text = "Simplify";129 this.btnSimplify.UseVisualStyleBackColor = true;130 this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);131 //132 // grpViewHost133 //134 this.grpViewHost.Controls.Add(this.viewHost);135 this.grpViewHost.Dock = System.Windows.Forms.DockStyle.Fill;136 this.grpViewHost.Location = new System.Drawing.Point(0, 0);137 this.grpViewHost.Name = "grpViewHost";138 this.grpViewHost.Size = new System.Drawing.Size(347, 348);139 this.grpViewHost.TabIndex = 1;140 this.grpViewHost.TabStop = false;141 this.grpViewHost.Text = "Details";142 48 // 143 49 // InteractiveSymbolicRegressionSolutionSimplifierView … … 145 51 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 146 52 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 147 this.Controls.Add(this.splitContainer);148 53 this.Name = "InteractiveSymbolicRegressionSolutionSimplifierView"; 149 54 this.Size = new System.Drawing.Size(564, 348); 150 this.splitContainer.Panel1.ResumeLayout(false);151 this.splitContainer.Panel2.ResumeLayout(false);152 this.splitContainer.ResumeLayout(false);153 this.grpSimplify.ResumeLayout(false);154 this.grpViewHost.ResumeLayout(false);155 55 this.ResumeLayout(false); 156 157 56 } 158 57 159 58 #endregion 160 161 private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;162 private System.Windows.Forms.SplitContainer splitContainer;163 private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;164 private System.Windows.Forms.GroupBox grpSimplify;165 private System.Windows.Forms.GroupBox grpViewHost;166 private System.Windows.Forms.Button btnSimplify;167 59 } 168 60 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
r5692 r5699 26 26 using System.Windows.Forms; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.MainForm.WindowsForms; 29 using HeuristicLab.Problems.DataAnalysis.Symbolic.Views; 28 30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;31 using HeuristicLab.MainForm.WindowsForms;32 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic;33 using HeuristicLab.Problems.DataAnalysis.Symbolic;34 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;35 31 36 namespace HeuristicLab.Problems.DataAnalysis.Views.Symbolic { 37 public partial class InteractiveSymbolicRegressionSolutionSimplifierView : AsynchronousContentView { 38 private SymbolicExpressionTree simplifiedExpressionTree; 39 private Dictionary<SymbolicExpressionTreeNode, ConstantTreeNode> replacementNodes; 40 private Dictionary<SymbolicExpressionTreeNode, double> nodeImpacts; 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views { 33 public partial class InteractiveSymbolicRegressionSolutionSimplifierView : InteractiveSymbolicDataAnalysisSolutionSimplifierView { 34 private readonly ConstantTreeNode constantNode; 35 private readonly SymbolicExpressionTree tempTree; 36 public InteractiveSymbolicRegressionSolutionSimplifierView() 37 : base() { 38 InitializeComponent(); 39 this.Caption = "Interactive Regression Solution Simplifier"; 41 40 42 public InteractiveSymbolicRegressionSolutionSimplifierView() { 43 InitializeComponent(); 44 this.replacementNodes = new Dictionary<SymbolicExpressionTreeNode, ConstantTreeNode>(); 45 this.nodeImpacts = new Dictionary<SymbolicExpressionTreeNode, double>(); 46 this.simplifiedExpressionTree = null; 47 this.Caption = "Interactive Solution Simplifier"; 41 constantNode = ((ConstantTreeNode)new Constant().CreateTreeNode()); 42 ISymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode(); 43 ISymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode(); 44 root.AddSubTree(start); 45 tempTree = new SymbolicExpressionTree(root); 48 46 } 49 47 50 public new SymbolicRegressionSolution Content {51 get { return ( SymbolicRegressionSolution)base.Content; }48 public new ISymbolicRegressionSolution Content { 49 get { return (ISymbolicRegressionSolution)base.Content; } 52 50 set { base.Content = value; } 53 51 } 54 52 55 protected override void RegisterContentEvents() { 56 base.RegisterContentEvents(); 57 Content.ModelChanged += new EventHandler(Content_ModelChanged); 58 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged); 59 } 60 protected override void DeregisterContentEvents() { 61 base.DeregisterContentEvents(); 62 Content.ModelChanged -= new EventHandler(Content_ModelChanged); 63 Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged); 53 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) { 54 Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); 55 foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) { 56 if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) { 57 replacementValues[node] = CalculateReplacementValue(node, interpreter, dataset, rows); 58 } 59 } 60 return replacementValues; 64 61 } 65 62 66 private void Content_ModelChanged(object sender, EventArgs e) { 67 this.CalculateReplacementNodesAndNodeImpacts(); 68 } 69 private void Content_ProblemDataChanged(object sender, EventArgs e) { 70 this.CalculateReplacementNodesAndNodeImpacts(); 63 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) { 64 Dictionary<ISymbolicExpressionTreeNode, double> impactValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); 65 List<ISymbolicExpressionTreeNode> nodes = tree.Root.GetSubTree(0).GetSubTree(0).IterateNodesPostfix().ToList(); 66 var originalOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows) 67 .ToArray(); 68 69 foreach (ISymbolicExpressionTreeNode node in nodes) { 70 var parent = node.Parent; 71 constantNode.Value = CalculateReplacementValue(node, interpreter, dataset, rows); 72 ISymbolicExpressionTreeNode replacementNode = constantNode; 73 SwitchNode(parent, node, replacementNode); 74 var newOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows).ToArray(); 75 76 impactValues[node] = 1 - OnlinePearsonsRSquaredEvaluator.Calculate(originalOutput, newOutput); 77 SwitchNode(parent, replacementNode, node); 78 } 79 return impactValues; 71 80 } 72 81 73 protected override void OnContentChanged() { 74 base.OnContentChanged(); 75 this.CalculateReplacementNodesAndNodeImpacts(); 76 this.viewHost.Content = this.Content; 82 private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, Dataset dataset, IEnumerable<int> rows) { 83 var start = tempTree.Root.GetSubTree(0); 84 while (start.SubTrees.Count() > 0) start.RemoveSubTree(0); 85 start.AddSubTree((ISymbolicExpressionTreeNode)node.Clone()); 86 return interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows).Median(); 77 87 } 78 88 79 private void CalculateReplacementNodesAndNodeImpacts() {80 this.replacementNodes.Clear();81 this.nodeImpacts.Clear();82 if (Content != null && Content.Model != null && Content.ProblemData != null) {83 SymbolicSimplifier simplifier = new SymbolicSimplifier();84 simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);85 int samplesStart = Content.ProblemData.TrainingSamplesStart.Value;86 int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value;87 double originalTrainingMeanSquaredError = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate(88 Content.Model.Interpreter, simplifiedExpressionTree, Content.LowerEstimationLimit, Content.UpperEstimationLimit,89 Content.ProblemData.Dataset, Content.ProblemData.TargetVariable.Value,90 Enumerable.Range(samplesStart, samplesEnd - samplesStart));91 89 92 this.CalculateReplacementNodes(); 93 94 this.CalculateNodeImpacts(simplifiedExpressionTree, simplifiedExpressionTree.Root.SubTrees[0], originalTrainingMeanSquaredError); 95 // automatically fold all branches with impact = 1 96 List<SymbolicExpressionTreeNode> nodeList = simplifiedExpressionTree.Root.SubTrees[0].IterateNodesPrefix().ToList(); 97 foreach (var parent in nodeList) { 98 for (int subTreeIndex = 0; subTreeIndex < parent.SubTrees.Count; subTreeIndex++) { 99 var child = parent.SubTrees[subTreeIndex]; 100 if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(1.0)) { 101 ReplaceNodeWithConstant(parent, subTreeIndex); 102 } 103 } 104 } 105 // show only interesting part of solution 106 this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root.SubTrees[0].SubTrees[0]); 107 this.PaintNodeImpacts(); 108 } 109 } 110 111 private void CalculateReplacementNodes() { 112 ISymbolicExpressionTreeInterpreter interpreter = Content.Model.Interpreter; 113 IEnumerable<int> trainingSamples = Enumerable.Range(Content.ProblemData.TrainingSamplesStart.Value, Content.ProblemData.TrainingSamplesEnd.Value - Content.ProblemData.TrainingSamplesStart.Value); 114 SymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode(); 115 SymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode(); 116 root.AddSubTree(start); 117 SymbolicExpressionTree tree = new SymbolicExpressionTree(root); 118 foreach (SymbolicExpressionTreeNode node in this.simplifiedExpressionTree.IterateNodesPrefix()) { 119 if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) { 120 while (start.SubTrees.Count > 0) start.RemoveSubTree(0); 121 start.AddSubTree(node); 122 double constantTreeNodeValue = interpreter.GetSymbolicExpressionTreeValues(tree, Content.ProblemData.Dataset, trainingSamples).Median(); 123 ConstantTreeNode constantTreeNode = MakeConstantTreeNode(constantTreeNodeValue); 124 replacementNodes[node] = constantTreeNode; 125 } 126 } 127 } 128 129 private void CalculateNodeImpacts(SymbolicExpressionTree tree, SymbolicExpressionTreeNode currentTreeNode, double originalTrainingMeanSquaredError) { 130 foreach (SymbolicExpressionTreeNode childNode in currentTreeNode.SubTrees.ToList()) { 131 SwitchNode(currentTreeNode, childNode, replacementNodes[childNode]); 132 int samplesStart = Content.ProblemData.TrainingSamplesStart.Value; 133 int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value; 134 double newTrainingMeanSquaredError = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate( 135 Content.Model.Interpreter, tree, 136 Content.LowerEstimationLimit, Content.UpperEstimationLimit, 137 Content.ProblemData.Dataset, Content.ProblemData.TargetVariable.Value, 138 Enumerable.Range(samplesStart, samplesEnd - samplesStart)); 139 nodeImpacts[childNode] = newTrainingMeanSquaredError / originalTrainingMeanSquaredError; 140 SwitchNode(currentTreeNode, replacementNodes[childNode], childNode); 141 CalculateNodeImpacts(tree, childNode, originalTrainingMeanSquaredError); 142 } 143 } 144 145 private void SwitchNode(SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode oldBranch, SymbolicExpressionTreeNode newBranch) { 146 for (int i = 0; i < root.SubTrees.Count; i++) { 147 if (root.SubTrees[i] == oldBranch) { 90 private void SwitchNode(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode oldBranch, ISymbolicExpressionTreeNode newBranch) { 91 for (int i = 0; i < root.SubTrees.Count(); i++) { 92 if (root.GetSubTree(i) == oldBranch) { 148 93 root.RemoveSubTree(i); 149 94 root.InsertSubTree(i, newBranch); … … 152 97 } 153 98 } 154 155 private ConstantTreeNode MakeConstantTreeNode(double value) {156 Constant constant = new Constant();157 constant.MinValue = value - 1;158 constant.MaxValue = value + 1;159 ConstantTreeNode constantTreeNode = (ConstantTreeNode)constant.CreateTreeNode();160 constantTreeNode.Value = value;161 return constantTreeNode;162 }163 164 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {165 VisualSymbolicExpressionTreeNode visualTreeNode = (VisualSymbolicExpressionTreeNode)sender;166 foreach (SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {167 for (int i = 0; i < treeNode.SubTrees.Count; i++) {168 SymbolicExpressionTreeNode subTree = treeNode.SubTrees[i];169 if (subTree == visualTreeNode.SymbolicExpressionTreeNode) {170 ReplaceNodeWithConstant(treeNode, i);171 }172 }173 }174 175 // show only interesting part of solution176 this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root.SubTrees[0].SubTrees[0]);177 178 SymbolicExpressionTree tree = (SymbolicExpressionTree)simplifiedExpressionTree.Clone();179 180 this.Content.ModelChanged -= new EventHandler(Content_ModelChanged);181 this.Content.Model = new SymbolicRegressionModel(Content.Model.Interpreter, tree);182 this.Content.ModelChanged += new EventHandler(Content_ModelChanged);183 184 this.PaintNodeImpacts();185 }186 187 private void ReplaceNodeWithConstant(SymbolicExpressionTreeNode parent, int subTreeIndex) {188 SymbolicExpressionTreeNode subTree = parent.SubTrees[subTreeIndex];189 parent.RemoveSubTree(subTreeIndex);190 if (replacementNodes.ContainsKey(subTree))191 parent.InsertSubTree(subTreeIndex, replacementNodes[subTree]);192 else if (subTree is ConstantTreeNode && replacementNodes.ContainsValue((ConstantTreeNode)subTree))193 parent.InsertSubTree(subTreeIndex, replacementNodes.Where(v => v.Value == subTree).Single().Key);194 else if (!(subTree is ConstantTreeNode))195 throw new InvalidOperationException("Could not find replacement value.");196 }197 198 private void PaintNodeImpacts() {199 var impacts = nodeImpacts.Values;200 double max = impacts.Max();201 double min = impacts.Min();202 foreach (SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {203 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {204 double impact = this.nodeImpacts[treeNode];205 double replacementValue = this.replacementNodes[treeNode].Value;206 VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);207 208 if (impact < 1.0) {209 visualTree.FillColor = Color.FromArgb((int)((1.0 - impact) * 255), Color.Red);210 } else {211 visualTree.FillColor = Color.FromArgb((int)((impact - 1.0) / max * 255), Color.Green);212 }213 visualTree.ToolTip += Environment.NewLine + "Node impact: " + impact;214 visualTree.ToolTip += Environment.NewLine + "Replacement value: " + replacementValue;215 }216 }217 this.PaintCollapsedNodes();218 this.treeChart.Repaint();219 }220 221 private void PaintCollapsedNodes() {222 foreach (SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {223 if (treeNode is ConstantTreeNode && replacementNodes.ContainsValue((ConstantTreeNode)treeNode))224 this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DarkOrange;225 else {226 VisualSymbolicExpressionTreeNode visNode = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);227 if (visNode != null)228 visNode.LineColor = Color.Black;229 }230 }231 }232 233 private void btnSimplify_Click(object sender, EventArgs e) {234 this.CalculateReplacementNodesAndNodeImpacts();235 }236 99 } 237 100 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.Designer.cs
r5692 r5699 20 20 #endregion 21 21 22 namespace HeuristicLab.Problems.DataAnalysis. Views.Symbolic{22 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views { 23 23 partial class SymbolicRegressionSolutionView { 24 24 /// <summary> -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.cs
r5692 r5699 23 23 using System.Windows.Forms; 24 24 using HeuristicLab.MainForm; 25 using HeuristicLab.Problems.DataAnalysis. Regression.Symbolic;25 using HeuristicLab.Problems.DataAnalysis.Views; 26 26 27 namespace HeuristicLab.Problems.DataAnalysis. Views.Symbolic{28 [Content(typeof( SymbolicRegressionSolution))]27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views { 28 [Content(typeof(ISymbolicRegressionSolution))] 29 29 [View("Symbolic Regression Solution View")] 30 30 public partial class SymbolicRegressionSolutionView : DataAnalysisSolutionView { … … 33 33 } 34 34 35 protected new SymbolicRegressionSolution Content {36 get { return ( SymbolicRegressionSolution)base.Content; }35 protected new ISymbolicRegressionSolution Content { 36 get { return (ISymbolicRegressionSolution)base.Content; } 37 37 set { base.Content = value; } 38 38 } … … 40 40 private void btn_SimplifyModel_Click(object sender, EventArgs e) { 41 41 InteractiveSymbolicRegressionSolutionSimplifierView view = new InteractiveSymbolicRegressionSolutionSimplifierView(); 42 view.Content = ( SymbolicRegressionSolution)this.Content.Clone();42 view.Content = (ISymbolicRegressionSolution)this.Content.Clone(); 43 43 view.Show(); 44 44 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r5693 r5699 110 110 </ItemGroup> 111 111 <ItemGroup> 112 <Compile Include="InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs"> 116 <DependentUpon>InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs</DependentUpon> 117 </Compile> 112 118 <Compile Include="SymbolicDataAnalysisModelView.cs"> 113 119 <SubType>UserControl</SubType> -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
r5692 r5699 20 20 #endregion 21 21 22 namespace HeuristicLab.Problems.DataAnalysis. Views.Symbolic{23 partial class InteractiveSymbolic RegressionSolutionSimplifierView {22 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 23 partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView { 24 24 /// <summary> 25 25 /// Required designer variable. -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r5692 r5699 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;30 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; 31 30 using HeuristicLab.MainForm.WindowsForms; 32 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic;33 31 using HeuristicLab.Problems.DataAnalysis.Symbolic; 34 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;35 32 36 namespace HeuristicLab.Problems.DataAnalysis. Views.Symbolic{37 public partial class InteractiveSymbolicRegressionSolutionSimplifierView : AsynchronousContentView {38 private SymbolicExpressionTree simplifiedExpressionTree;39 private Dictionary< SymbolicExpressionTreeNode, ConstantTreeNode> replacementNodes;40 private Dictionary< SymbolicExpressionTreeNode, double> nodeImpacts;33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 34 public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView { 35 private ISymbolicExpressionTree simplifiedExpressionTree; 36 private Dictionary<ISymbolicExpressionTreeNode, ConstantTreeNode> replacementNodes; 37 private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts; 41 38 42 public InteractiveSymbolic RegressionSolutionSimplifierView() {39 public InteractiveSymbolicDataAnalysisSolutionSimplifierView() { 43 40 InitializeComponent(); 44 this.replacementNodes = new Dictionary< SymbolicExpressionTreeNode, ConstantTreeNode>();45 this.nodeImpacts = new Dictionary< SymbolicExpressionTreeNode, double>();41 this.replacementNodes = new Dictionary<ISymbolicExpressionTreeNode, ConstantTreeNode>(); 42 this.nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>(); 46 43 this.simplifiedExpressionTree = null; 47 44 this.Caption = "Interactive Solution Simplifier"; 48 45 } 49 46 50 public new SymbolicRegressionSolution Content {51 get { return ( SymbolicRegressionSolution)base.Content; }47 public new ISymbolicDataAnalysisSolution Content { 48 get { return (ISymbolicDataAnalysisSolution)base.Content; } 52 49 set { base.Content = value; } 53 50 } … … 65 62 66 63 private void Content_ModelChanged(object sender, EventArgs e) { 64 OnModelChanged(); 65 } 66 private void Content_ProblemDataChanged(object sender, EventArgs e) { 67 OnProblemDataChanged(); 68 } 69 70 protected virtual void OnModelChanged() { 67 71 this.CalculateReplacementNodesAndNodeImpacts(); 68 72 } 69 private void Content_ProblemDataChanged(object sender, EventArgs e) { 73 74 protected virtual void OnProblemDataChanged() { 70 75 this.CalculateReplacementNodesAndNodeImpacts(); 71 76 } … … 78 83 79 84 private void CalculateReplacementNodesAndNodeImpacts() { 80 this.replacementNodes.Clear(); 81 this.nodeImpacts.Clear(); 85 replacementNodes.Clear(); 82 86 if (Content != null && Content.Model != null && Content.ProblemData != null) { 83 Symbolic Simplifier simplifier = new SymbolicSimplifier();87 SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier(); 84 88 simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree); 85 int samplesStart = Content.ProblemData.TrainingSamplesStart.Value;86 int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value;87 double originalTrainingMeanSquaredError = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate(88 Content.Model.Interpreter, simplifiedExpressionTree, Content.LowerEstimationLimit, Content.UpperEstimationLimit,89 Content.ProblemData.Dataset, Content.ProblemData.TargetVariable.Value,90 Enumerable.Range(samplesStart, samplesEnd - samplesStart));91 89 92 this.CalculateReplacementNodes(); 90 var replacementValues = CalculateReplacementValues(Content.Model.Interpreter, simplifiedExpressionTree, Content.ProblemData.Dataset, Content.ProblemData.TrainingIndizes); 91 foreach (var pair in replacementValues) { 92 replacementNodes.Add(pair.Key, MakeConstantTreeNode(pair.Value)); 93 } 94 nodeImpacts = CalculateImpactValues(Content.Model.Interpreter, simplifiedExpressionTree, Content.ProblemData.Dataset, Content.ProblemData.TrainingIndizes); 93 95 94 this.CalculateNodeImpacts(simplifiedExpressionTree, simplifiedExpressionTree.Root.SubTrees[0], originalTrainingMeanSquaredError);95 96 // automatically fold all branches with impact = 1 96 List< SymbolicExpressionTreeNode> nodeList = simplifiedExpressionTree.Root.SubTrees[0].IterateNodesPrefix().ToList();97 List<ISymbolicExpressionTreeNode> nodeList = simplifiedExpressionTree.Root.GetSubTree(0).IterateNodesPrefix().ToList(); 97 98 foreach (var parent in nodeList) { 98 for (int subTreeIndex = 0; subTreeIndex < parent.SubTrees.Count ; subTreeIndex++) {99 var child = parent. SubTrees[subTreeIndex];99 for (int subTreeIndex = 0; subTreeIndex < parent.SubTrees.Count(); subTreeIndex++) { 100 var child = parent.GetSubTree(subTreeIndex); 100 101 if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(1.0)) { 101 102 ReplaceNodeWithConstant(parent, subTreeIndex); … … 104 105 } 105 106 // show only interesting part of solution 106 this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root. SubTrees[0].SubTrees[0]);107 this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root.GetSubTree(0).GetSubTree(0)); 107 108 this.PaintNodeImpacts(); 108 109 } 109 110 } 110 111 111 private void CalculateReplacementNodes() { 112 ISymbolicExpressionTreeInterpreter interpreter = Content.Model.Interpreter; 113 IEnumerable<int> trainingSamples = Enumerable.Range(Content.ProblemData.TrainingSamplesStart.Value, Content.ProblemData.TrainingSamplesEnd.Value - Content.ProblemData.TrainingSamplesStart.Value); 114 SymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode(); 115 SymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode(); 116 root.AddSubTree(start); 117 SymbolicExpressionTree tree = new SymbolicExpressionTree(root); 118 foreach (SymbolicExpressionTreeNode node in this.simplifiedExpressionTree.IterateNodesPrefix()) { 119 if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) { 120 while (start.SubTrees.Count > 0) start.RemoveSubTree(0); 121 start.AddSubTree(node); 122 double constantTreeNodeValue = interpreter.GetSymbolicExpressionTreeValues(tree, Content.ProblemData.Dataset, trainingSamples).Median(); 123 ConstantTreeNode constantTreeNode = MakeConstantTreeNode(constantTreeNodeValue); 124 replacementNodes[node] = constantTreeNode; 125 } 126 } 127 } 128 129 private void CalculateNodeImpacts(SymbolicExpressionTree tree, SymbolicExpressionTreeNode currentTreeNode, double originalTrainingMeanSquaredError) { 130 foreach (SymbolicExpressionTreeNode childNode in currentTreeNode.SubTrees.ToList()) { 131 SwitchNode(currentTreeNode, childNode, replacementNodes[childNode]); 132 int samplesStart = Content.ProblemData.TrainingSamplesStart.Value; 133 int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value; 134 double newTrainingMeanSquaredError = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate( 135 Content.Model.Interpreter, tree, 136 Content.LowerEstimationLimit, Content.UpperEstimationLimit, 137 Content.ProblemData.Dataset, Content.ProblemData.TargetVariable.Value, 138 Enumerable.Range(samplesStart, samplesEnd - samplesStart)); 139 nodeImpacts[childNode] = newTrainingMeanSquaredError / originalTrainingMeanSquaredError; 140 SwitchNode(currentTreeNode, replacementNodes[childNode], childNode); 141 CalculateNodeImpacts(tree, childNode, originalTrainingMeanSquaredError); 142 } 143 } 144 145 private void SwitchNode(SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode oldBranch, SymbolicExpressionTreeNode newBranch) { 146 for (int i = 0; i < root.SubTrees.Count; i++) { 147 if (root.SubTrees[i] == oldBranch) { 148 root.RemoveSubTree(i); 149 root.InsertSubTree(i, newBranch); 150 return; 151 } 152 } 153 } 112 protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows); 113 protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows); 154 114 155 115 private ConstantTreeNode MakeConstantTreeNode(double value) { … … 165 125 VisualSymbolicExpressionTreeNode visualTreeNode = (VisualSymbolicExpressionTreeNode)sender; 166 126 foreach (SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) { 167 for (int i = 0; i < treeNode.SubTrees.Count ; i++) {168 SymbolicExpressionTreeNode subTree = treeNode.SubTrees[i];127 for (int i = 0; i < treeNode.SubTrees.Count(); i++) { 128 ISymbolicExpressionTreeNode subTree = treeNode.GetSubTree(i); 169 129 if (subTree == visualTreeNode.SymbolicExpressionTreeNode) { 170 130 ReplaceNodeWithConstant(treeNode, i); … … 174 134 175 135 // show only interesting part of solution 176 this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root. SubTrees[0].SubTrees[0]);136 this.treeChart.Tree = new SymbolicExpressionTree(simplifiedExpressionTree.Root.GetSubTree(0).GetSubTree(0)); 177 137 178 138 SymbolicExpressionTree tree = (SymbolicExpressionTree)simplifiedExpressionTree.Clone(); 179 139 180 this.Content.ModelChanged -= new EventHandler(Content_ModelChanged);181 this.Content.Model = new SymbolicRegressionModel(Content.Model.Interpreter, tree);182 this.Content.ModelChanged += new EventHandler(Content_ModelChanged);140 //this.Content.ModelChanged -= new EventHandler(Content_ModelChanged); 141 //this.Content.Model = new SymbolicRegressionModel(Content.Model.Interpreter, tree); 142 //this.Content.ModelChanged += new EventHandler(Content_ModelChanged); 183 143 184 144 this.PaintNodeImpacts(); 185 145 } 186 146 187 private void ReplaceNodeWithConstant( SymbolicExpressionTreeNode parent, int subTreeIndex) {188 SymbolicExpressionTreeNode subTree = parent.SubTrees[subTreeIndex];147 private void ReplaceNodeWithConstant(ISymbolicExpressionTreeNode parent, int subTreeIndex) { 148 ISymbolicExpressionTreeNode subTree = parent.GetSubTree(subTreeIndex); 189 149 parent.RemoveSubTree(subTreeIndex); 190 150 if (replacementNodes.ContainsKey(subTree)) … … 200 160 double max = impacts.Max(); 201 161 double min = impacts.Min(); 202 foreach ( SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {162 foreach (ISymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) { 203 163 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) { 204 164 double impact = this.nodeImpacts[treeNode]; 205 165 double replacementValue = this.replacementNodes[treeNode].Value; 206 166 VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode); 207 208 if (impact < 1.0) {209 visualTree.FillColor = Color.FromArgb((int)((1.0 - impact) * 255), Color.Red);210 } else {211 212 }167 168 //if (impact < 1.0) { 169 // visualTree.FillColor = Color.FromArgb((int)((1.0 - impact) * 255), Color.Red); 170 //} else { 171 visualTree.FillColor = Color.FromArgb((int)((impact - 1.0) / max * 255), Color.Green); 172 //} 213 173 visualTree.ToolTip += Environment.NewLine + "Node impact: " + impact; 214 174 visualTree.ToolTip += Environment.NewLine + "Replacement value: " + replacementValue; … … 220 180 221 181 private void PaintCollapsedNodes() { 222 foreach ( SymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) {182 foreach (ISymbolicExpressionTreeNode treeNode in simplifiedExpressionTree.IterateNodesPostfix()) { 223 183 if (treeNode is ConstantTreeNode && replacementNodes.ContainsValue((ConstantTreeNode)treeNode)) 224 184 this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DarkOrange; -
branches/DataAnalysis Refactoring/HeuristicLab/3.3/Files.txt
r5693 r5699 65 65 HeuristicLab.Problems.DataAnalysis.Symbolic.Views\3.4:HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll 66 66 HeuristicLab.Problems.DataAnalysis.Symbolic.Classification\3.4:HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll 67 HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views\3.4:HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.dll 67 68 HeuristicLab.Problems.DataAnalysis.Symbolic.Regression\3.4:HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll 69 HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views\3.4:HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.dll 68 70 HeuristicLab.Problems.DataAnalysis.Views\3.3:HeuristicLab.Problems.DataAnalysis.Views-3.3.dll 69 71 HeuristicLab.Problems.DataAnalysis.Views\3.4:HeuristicLab.Problems.DataAnalysis.Views-3.4.dll
Note: See TracChangeset
for help on using the changeset viewer.