Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 9 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r5829 r6760 111 111 </ItemGroup> 112 112 <ItemGroup> 113 <Compile Include="SymbolicDataAnalysisSolutionResponseFunctionView.cs"> 114 <SubType>UserControl</SubType> 115 </Compile> 116 <Compile Include="SymbolicDataAnalysisSolutionResponseFunctionView.Designer.cs"> 117 <DependentUpon>SymbolicDataAnalysisSolutionResponseFunctionView.cs</DependentUpon> 118 </Compile> 113 119 <Compile Include="TextualSymbolicDataAnalysisModelView.cs"> 114 120 <SubType>UserControl</SubType> … … 158 164 <Compile Include="Symbols\VariableView.Designer.cs"> 159 165 <DependentUpon>VariableView.cs</DependentUpon> 166 </Compile> 167 <Compile Include="VariableTrackbar.cs"> 168 <SubType>UserControl</SubType> 169 </Compile> 170 <Compile Include="VariableTrackbar.Designer.cs"> 171 <DependentUpon>VariableTrackbar.cs</DependentUpon> 160 172 </Compile> 161 173 <None Include="HeuristicLab.snk" /> -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin.cs.frame
r5860 r6760 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4. 0.$WCREV$")]28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4.1.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
r5809 r6760 49 49 this.splitContainer = new System.Windows.Forms.SplitContainer(); 50 50 this.grpSimplify = new System.Windows.Forms.GroupBox(); 51 this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); 51 52 this.btnSimplify = new System.Windows.Forms.Button(); 53 this.btnOptimizeConstants = new System.Windows.Forms.Button(); 52 54 this.grpViewHost = new System.Windows.Forms.GroupBox(); 55 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 53 56 this.splitContainer.Panel1.SuspendLayout(); 54 57 this.splitContainer.Panel2.SuspendLayout(); 55 58 this.splitContainer.SuspendLayout(); 56 59 this.grpSimplify.SuspendLayout(); 60 this.flowLayoutPanel.SuspendLayout(); 57 61 this.grpViewHost.SuspendLayout(); 58 62 this.SuspendLayout(); … … 60 64 // treeChart 61 65 // 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 66 this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 67 | System.Windows.Forms.AnchorStyles.Left) 68 | System.Windows.Forms.AnchorStyles.Right))); 65 69 this.treeChart.BackgroundColor = System.Drawing.Color.White; 66 70 this.treeChart.LineColor = System.Drawing.Color.Black; 67 71 this.treeChart.Location = new System.Drawing.Point(6, 16); 68 72 this.treeChart.Name = "treeChart"; 69 this.treeChart.Size = new System.Drawing.Size(201, 29 7);73 this.treeChart.Size = new System.Drawing.Size(201, 291); 70 74 this.treeChart.Spacing = 5; 71 75 this.treeChart.TabIndex = 0; … … 76 80 // viewHost 77 81 // 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 82 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 83 | System.Windows.Forms.AnchorStyles.Left) 84 | System.Windows.Forms.AnchorStyles.Right))); 81 85 this.viewHost.Caption = "View"; 82 86 this.viewHost.Content = null; … … 87 91 this.viewHost.Size = new System.Drawing.Size(335, 326); 88 92 this.viewHost.TabIndex = 0; 93 this.viewHost.ViewsLabelVisible = true; 89 94 this.viewHost.ViewType = null; 90 95 // … … 108 113 // grpSimplify 109 114 // 110 this.grpSimplify.Controls.Add(this. btnSimplify);115 this.grpSimplify.Controls.Add(this.flowLayoutPanel); 111 116 this.grpSimplify.Controls.Add(this.treeChart); 112 117 this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill; … … 118 123 this.grpSimplify.Text = "Simplify"; 119 124 // 125 // flowLayoutPanel 126 // 127 this.flowLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 128 | System.Windows.Forms.AnchorStyles.Right))); 129 this.flowLayoutPanel.Controls.Add(this.btnSimplify); 130 this.flowLayoutPanel.Controls.Add(this.btnOptimizeConstants); 131 this.flowLayoutPanel.Location = new System.Drawing.Point(6, 313); 132 this.flowLayoutPanel.Name = "flowLayoutPanel"; 133 this.flowLayoutPanel.Size = new System.Drawing.Size(204, 29); 134 this.flowLayoutPanel.TabIndex = 2; 135 this.flowLayoutPanel.WrapContents = false; 136 // 120 137 // btnSimplify 121 138 // 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); 139 this.btnSimplify.Location = new System.Drawing.Point(3, 3); 125 140 this.btnSimplify.Name = "btnSimplify"; 126 this.btnSimplify.Size = new System.Drawing.Size( 201, 23);141 this.btnSimplify.Size = new System.Drawing.Size(95, 23); 127 142 this.btnSimplify.TabIndex = 1; 128 143 this.btnSimplify.Text = "Simplify"; 129 144 this.btnSimplify.UseVisualStyleBackColor = true; 130 145 this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click); 146 // 147 // btnOptimizeConstants 148 // 149 this.btnOptimizeConstants.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 150 this.btnOptimizeConstants.Enabled = false; 151 this.btnOptimizeConstants.Location = new System.Drawing.Point(104, 3); 152 this.btnOptimizeConstants.Name = "btnOptimizeConstants"; 153 this.btnOptimizeConstants.Size = new System.Drawing.Size(97, 23); 154 this.btnOptimizeConstants.TabIndex = 2; 155 this.btnOptimizeConstants.Text = "Optimize"; 156 this.btnOptimizeConstants.UseVisualStyleBackColor = true; 157 this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click); 131 158 // 132 159 // grpViewHost … … 141 168 this.grpViewHost.Text = "Details"; 142 169 // 143 // InteractiveSymbolic RegressionSolutionSimplifierView170 // InteractiveSymbolicDataAnalysisSolutionSimplifierView 144 171 // 145 172 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 146 173 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 147 174 this.Controls.Add(this.splitContainer); 148 this.Name = "InteractiveSymbolic RegressionSolutionSimplifierView";175 this.Name = "InteractiveSymbolicDataAnalysisSolutionSimplifierView"; 149 176 this.Size = new System.Drawing.Size(564, 348); 150 177 this.splitContainer.Panel1.ResumeLayout(false); 151 178 this.splitContainer.Panel2.ResumeLayout(false); 179 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 152 180 this.splitContainer.ResumeLayout(false); 153 181 this.grpSimplify.ResumeLayout(false); 182 this.flowLayoutPanel.ResumeLayout(false); 154 183 this.grpViewHost.ResumeLayout(false); 155 184 this.ResumeLayout(false); … … 165 194 private System.Windows.Forms.GroupBox grpViewHost; 166 195 private System.Windows.Forms.Button btnSimplify; 196 private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel; 197 protected System.Windows.Forms.Button btnOptimizeConstants; 167 198 } 168 199 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r6113 r6760 212 212 UpdateModel(simplifiedExpressionTree); 213 213 } 214 215 protected abstract void btnOptimizeConstants_Click(object sender, EventArgs e); 214 216 } 215 217 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.frame
r5860 r6760 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.4.0.0")] 55 [assembly: AssemblyFileVersion("3.4. 0.$WCREV$")]55 [assembly: AssemblyFileVersion("3.4.1.$WCREV$")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.Designer.cs
r5809 r6760 46 46 private void InitializeComponent() { 47 47 this.matrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 48 this.comboBox = new System.Windows.Forms.ComboBox(); 49 this.label1 = new System.Windows.Forms.Label(); 50 this.variableImpactsGroupBox = new System.Windows.Forms.GroupBox(); 51 this.variableImpactsGroupBox.SuspendLayout(); 48 52 this.SuspendLayout(); 49 53 // … … 55 59 this.matrixView.Caption = "StringConvertibleMatrix View"; 56 60 this.matrixView.Content = null; 57 this.matrixView.Location = new System.Drawing.Point( 3, 3);61 this.matrixView.Location = new System.Drawing.Point(6, 19); 58 62 this.matrixView.Name = "matrixView"; 59 63 this.matrixView.ReadOnly = true; 60 this.matrixView.Size = new System.Drawing.Size(303, 229); 64 this.matrixView.ShowRowsAndColumnsTextBox = true; 65 this.matrixView.ShowStatisticalInformation = true; 66 this.matrixView.Size = new System.Drawing.Size(294, 174); 61 67 this.matrixView.TabIndex = 0; 68 // 69 // comboBox 70 // 71 this.comboBox.FormattingEnabled = true; 72 this.comboBox.Location = new System.Drawing.Point(39, 6); 73 this.comboBox.Name = "comboBox"; 74 this.comboBox.Size = new System.Drawing.Size(68, 21); 75 this.comboBox.TabIndex = 1; 76 this.comboBox.SelectedValueChanged += new System.EventHandler(this.comboBox_SelectedValueChanged); 77 // 78 // label1 79 // 80 this.label1.AutoSize = true; 81 this.label1.Location = new System.Drawing.Point(3, 9); 82 this.label1.Name = "label1"; 83 this.label1.Size = new System.Drawing.Size(30, 13); 84 this.label1.TabIndex = 2; 85 this.label1.Text = "Fold:"; 86 // 87 // variableImpactsGroupBox 88 // 89 this.variableImpactsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 90 | System.Windows.Forms.AnchorStyles.Left) 91 | System.Windows.Forms.AnchorStyles.Right))); 92 this.variableImpactsGroupBox.Controls.Add(this.matrixView); 93 this.variableImpactsGroupBox.Location = new System.Drawing.Point(0, 33); 94 this.variableImpactsGroupBox.Name = "variableImpactsGroupBox"; 95 this.variableImpactsGroupBox.Size = new System.Drawing.Size(306, 199); 96 this.variableImpactsGroupBox.TabIndex = 3; 97 this.variableImpactsGroupBox.TabStop = false; 98 this.variableImpactsGroupBox.Text = "Variable impacts:"; 62 99 // 63 100 // RunCollectionVariableImpactView … … 65 102 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 66 103 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 67 this.Controls.Add(this.matrixView); 104 this.Controls.Add(this.variableImpactsGroupBox); 105 this.Controls.Add(this.label1); 106 this.Controls.Add(this.comboBox); 68 107 this.Name = "RunCollectionVariableImpactView"; 69 108 this.Size = new System.Drawing.Size(309, 235); 109 this.variableImpactsGroupBox.ResumeLayout(false); 70 110 this.ResumeLayout(false); 111 this.PerformLayout(); 71 112 72 113 } … … 75 116 76 117 private HeuristicLab.Data.Views.StringConvertibleMatrixView matrixView; 118 private System.Windows.Forms.ComboBox comboBox; 119 private System.Windows.Forms.Label label1; 120 private System.Windows.Forms.GroupBox variableImpactsGroupBox; 77 121 } 78 122 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.cs
r5975 r6760 35 35 public sealed partial class RunCollectionVariableImpactView : AsynchronousContentView { 36 36 private const string variableImpactResultName = "Variable impacts"; 37 private const string crossValidationFoldsResultName = "CrossValidation Folds"; 38 private const string numberOfFoldsParameterName = "Folds"; 37 39 public RunCollectionVariableImpactView() { 38 40 InitializeComponent(); … … 95 97 } 96 98 99 private void comboBox_SelectedValueChanged(object sender, EventArgs e) { 100 if (comboBox.SelectedItem != null) { 101 var cvRuns = from r in Content 102 where r.Visible 103 where r.Parameters.ContainsKey(numberOfFoldsParameterName) 104 select r; 105 var selectedFolds = from r in cvRuns 106 let foldCollection = (RunCollection)r.Results[crossValidationFoldsResultName] 107 select (IRun)foldCollection.ElementAt((int)comboBox.SelectedItem).Clone(); 108 matrixView.Content = CalculateVariableImpactMatrix(selectedFolds.ToArray(), cvRuns.Select(r => r.Name).ToArray()); 109 } 110 } 111 112 97 113 private void UpdateData() { 98 matrixView.Content = CalculateVariableImpactMatrix(); 99 } 100 101 private DoubleMatrix CalculateVariableImpactMatrix() { 114 if (Content != null) { 115 comboBox.Items.Clear(); 116 comboBox.Enabled = false; 117 var visibleRuns = Content.Where(r => r.Visible).ToArray(); 118 var representativeCvRun = 119 visibleRuns.Where(r => r.Parameters.ContainsKey(numberOfFoldsParameterName)).FirstOrDefault(); 120 if (representativeCvRun != null) { 121 // make sure all runs have the same number of folds 122 int nFolds = ((IntValue)representativeCvRun.Parameters[numberOfFoldsParameterName]).Value; 123 var cvRuns = visibleRuns.Where(r => r.Parameters.ContainsKey(numberOfFoldsParameterName)); 124 if (cvRuns.All(r => ((IntValue)r.Parameters[numberOfFoldsParameterName]).Value == nFolds)) { 125 // populate combobox 126 for (int foldIndex = 0; foldIndex < nFolds; foldIndex++) { 127 comboBox.Items.Add(foldIndex); 128 } 129 comboBox.Enabled = true; 130 var selectedFolds = from r in cvRuns 131 let foldCollection = (RunCollection)r.Results[crossValidationFoldsResultName] 132 select foldCollection.First(); 133 matrixView.Content = CalculateVariableImpactMatrix(selectedFolds.ToArray(), cvRuns.Select(f => f.Name).ToArray()); 134 } else { 135 matrixView.Content = null; 136 } 137 } else { 138 var runsWithVariables = visibleRuns.Where(r => r.Results.ContainsKey(variableImpactResultName)).ToArray(); 139 matrixView.Content = CalculateVariableImpactMatrix(runsWithVariables); 140 } 141 } 142 } 143 144 private IStringConvertibleMatrix CalculateVariableImpactMatrix(IRun[] runs) { 145 return CalculateVariableImpactMatrix(runs, runs.Select(r => r.Name).ToArray()); 146 } 147 148 private DoubleMatrix CalculateVariableImpactMatrix(IRun[] runs, string[] runNames) { 102 149 DoubleMatrix matrix = null; 103 if (Content != null) { 104 List<IRun> runsWithVariables = Content.Where(r => r.Visible && r.Results.ContainsKey(variableImpactResultName)).ToList(); 105 IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runsWithVariables 106 select run.Results[variableImpactResultName]).Cast<DoubleMatrix>(); 107 IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts 108 from variableName in variableImpact.RowNames 109 select variableName) 110 .Distinct(); 111 // filter variableNames: only include names that have at least one non-zero value in a run 112 List<string> variableNamesList = (from variableName in variableNames 113 where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0)) 114 select variableName) 115 .ToList(); 116 117 List<string> statictics = new List<string> { "Median Rank", "Mean", "StdDev", "pValue" }; 118 List<string> columnNames = runsWithVariables.Select(r => r.Name).ToList(); 119 columnNames.AddRange(statictics); 120 int runs = runsWithVariables.Count(); 121 122 matrix = new DoubleMatrix(variableNamesList.Count, runs + statictics.Count); 123 matrix.SortableView = true; 124 matrix.RowNames = variableNamesList; 125 matrix.ColumnNames = columnNames; 126 127 for (int i = 0; i < runsWithVariables.Count; i++) { 128 IRun run = runsWithVariables[i]; 129 DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName]; 130 for (int j = 0; j < runVariableImpacts.Rows; j++) { 131 int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j)); 132 if (rowIndex > -1) { 133 matrix[rowIndex, i] = runVariableImpacts[j, 0]; 134 } 135 } 136 } 137 138 List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList 139 select GetVariableImpacts(variableName, allVariableImpacts).ToList()) 140 .ToList(); 141 List<List<double>> variableRanks = (from variableName in variableNamesList 142 select GetVariableImpactRanks(variableName, allVariableImpacts).ToList()) 143 .ToList(); 144 if (variableImpactsOverRuns.Count() > 0) { 145 // the variable with the worst median impact value is chosen as the reference variable 146 // this is problematic if all variables are relevant, however works often in practice 147 List<double> referenceImpacts = (from impacts in variableImpactsOverRuns 148 let avg = impacts.Median() 149 orderby avg 150 select impacts) 151 .First(); 152 // for all variables 153 for (int row = 0; row < variableImpactsOverRuns.Count; row++) { 154 // median rank 155 matrix[row, runs] = variableRanks[row].Median(); 156 // also show mean and std.dev. of relative variable impacts to indicate the relative difference in impacts of variables 157 matrix[row, runs + 1] = variableImpactsOverRuns[row].Average(); 158 matrix[row, runs + 2] = variableImpactsOverRuns[row].StandardDeviation(); 159 160 double leftTail = 0; double rightTail = 0; double bothTails = 0; 161 // calc differences of impacts for current variable and reference variable 162 double[] z = new double[referenceImpacts.Count]; 163 for (int i = 0; i < z.Length; i++) { 164 z[i] = variableImpactsOverRuns[row][i] - referenceImpacts[i]; 165 } 166 // wilcoxon signed rank test is used because the impact values of two variables in a single run are not independent 167 alglib.wsr.wilcoxonsignedranktest(z, z.Length, 0, ref bothTails, ref leftTail, ref rightTail); 168 matrix[row, runs + 3] = bothTails; 169 } 170 } 171 } 172 return matrix; 150 IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs 151 select run.Results[variableImpactResultName]).Cast<DoubleMatrix>(); 152 IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts 153 from variableName in variableImpact.RowNames 154 select variableName) 155 .Distinct(); 156 // filter variableNames: only include names that have at least one non-zero value in a run 157 List<string> variableNamesList = (from variableName in variableNames 158 where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0)) 159 select variableName) 160 .ToList(); 161 162 List<string> statictics = new List<string> { "Median Rank", "Mean", "StdDev", "pValue" }; 163 List<string> columnNames = new List<string>(runNames); 164 columnNames.AddRange(statictics); 165 int numberOfRuns = runs.Length; 166 167 matrix = new DoubleMatrix(variableNamesList.Count, numberOfRuns + statictics.Count); 168 matrix.SortableView = true; 169 matrix.RowNames = variableNamesList; 170 matrix.ColumnNames = columnNames; 171 172 // calculate statistics 173 List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList 174 select GetVariableImpacts(variableName, allVariableImpacts).ToList()) 175 .ToList(); 176 List<List<double>> variableRanks = (from variableName in variableNamesList 177 select GetVariableImpactRanks(variableName, allVariableImpacts).ToList()) 178 .ToList(); 179 if (variableImpactsOverRuns.Count() > 0) { 180 // the variable with the worst median impact value is chosen as the reference variable 181 // this is problematic if all variables are relevant, however works often in practice 182 List<double> referenceImpacts = (from impacts in variableImpactsOverRuns 183 let avg = impacts.Median() 184 orderby avg 185 select impacts) 186 .First(); 187 // for all variables 188 for (int row = 0; row < variableImpactsOverRuns.Count; row++) { 189 // median rank 190 matrix[row, numberOfRuns] = variableRanks[row].Median(); 191 // also show mean and std.dev. of relative variable impacts to indicate the relative difference in impacts of variables 192 matrix[row, numberOfRuns + 1] = Math.Round(variableImpactsOverRuns[row].Average(), 3); 193 matrix[row, numberOfRuns + 2] = Math.Round(variableImpactsOverRuns[row].StandardDeviation(), 3); 194 195 double leftTail = 0; double rightTail = 0; double bothTails = 0; 196 // calc differences of impacts for current variable and reference variable 197 double[] z = new double[referenceImpacts.Count]; 198 for (int i = 0; i < z.Length; i++) { 199 z[i] = variableImpactsOverRuns[row][i] - referenceImpacts[i]; 200 } 201 // wilcoxon signed rank test is used because the impact values of two variables in a single run are not independent 202 alglib.wsr.wilcoxonsignedranktest(z, z.Length, 0, ref bothTails, ref leftTail, ref rightTail); 203 matrix[row, numberOfRuns + 3] = Math.Round(bothTails, 4); 204 } 205 } 206 207 // fill matrix with impacts from runs 208 for (int i = 0; i < runs.Length; i++) { 209 IRun run = runs[i]; 210 DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName]; 211 for (int j = 0; j < runVariableImpacts.Rows; j++) { 212 int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j)); 213 if (rowIndex > -1) { 214 matrix[rowIndex, i] = Math.Round(runVariableImpacts[j, 0], 3); 215 } 216 } 217 } 218 // sort by median 219 var sortedMatrix = (DoubleMatrix)matrix.Clone(); 220 var sortedIndexes = from i in Enumerable.Range(0, sortedMatrix.Rows) 221 orderby matrix[i, numberOfRuns] 222 select i; 223 224 int targetIndex = 0; 225 foreach (var sourceIndex in sortedIndexes) { 226 for (int c = 0; c < matrix.Columns; c++) 227 sortedMatrix[targetIndex, c] = matrix[sourceIndex, c]; 228 targetIndex++; 229 } 230 return sortedMatrix; 173 231 } 174 232 … … 213 271 } 214 272 } 273 215 274 } 216 275 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs
r5809 r6760 23 23 using System.Linq; 24 24 using System.Windows.Forms; 25 using HeuristicLab.Collections; 26 using HeuristicLab.Core; 27 using HeuristicLab.Core.Views; 28 using HeuristicLab.Data; 25 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; 26 30 using HeuristicLab.MainForm; 27 31 using HeuristicLab.MainForm.WindowsForms; 28 using HeuristicLab.Core;29 using HeuristicLab.Data;30 using HeuristicLab.Core.Views;31 using HeuristicLab.Collections;32 32 33 33 34 34 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 35 36 35 [View("Variable View")] 37 36 [Content(typeof(Variable), true)] … … 59 58 variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(variableNames_Changed); 60 59 variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(variableNames_Changed); 61 } 60 foreach (var variable in variableNamesView.Content) { 61 variable.ValueChanged += new EventHandler(variable_ValueChanged); 62 } 63 } 64 62 65 63 66 private void DeregisterVariableNamesViewContentEvents() { … … 66 69 variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(variableNames_Changed); 67 70 variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(variableNames_Changed); 71 foreach (var variable in variableNamesView.Content) { 72 variable.ValueChanged -= new EventHandler(variable_ValueChanged); 73 } 68 74 } 69 75 … … 81 87 protected override void OnContentChanged() { 82 88 base.OnContentChanged(); 89 variableNamesView.Content.Clear(); 83 90 UpdateControl(); 84 91 } … … 104 111 #region control event handlers 105 112 private void variableNames_Changed(object sender, CollectionItemsChangedEventArgs<StringValue> args) { 113 if (args.Items != null) 114 foreach (var newVar in args.Items) 115 newVar.ValueChanged += new EventHandler(variable_ValueChanged); 116 if (args.OldItems != null) 117 foreach (var oldVar in args.OldItems) 118 oldVar.ValueChanged -= new EventHandler(variable_ValueChanged); 119 UpdateContent(); 120 } 121 122 private void variable_ValueChanged(object sender, EventArgs e) { 123 UpdateContent(); 124 } 125 126 private void UpdateContent() { 106 127 if (Content != null) { 128 Content.Changed -= new EventHandler(Content_Changed); 107 129 Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value).ToList(); 108 } 109 } 130 Content.Changed += new EventHandler(Content_Changed); 131 } 132 } 133 110 134 111 135 private void weightMuTextBox_TextChanged(object sender, EventArgs e) { … … 137 161 } 138 162 } 139 140 163 private void multiplicativeWeightChangeSigmaTextBox_TextChanged(object sender, EventArgs e) { 141 164 double sigma; … … 161 184 RegisterVariableNamesViewContentEvents(); 162 185 } else { 163 var existingEntries = variableNamesView.Content. Select(x => x.Value);164 186 var existingEntries = variableNamesView.Content.ToList(); 187 165 188 // temporarily deregister to prevent circular calling of events 166 189 DeregisterVariableNamesViewContentEvents(); 167 190 // add additional entries 168 foreach (var variableName in Content.VariableNames.Except(existingEntries )) {191 foreach (var variableName in Content.VariableNames.Except(existingEntries.Select(x => x.Value))) 169 192 variableNamesView.Content.Add(new StringValue(variableName), true); 170 } 193 foreach (var oldEntry in existingEntries.Where(x => !Content.VariableNames.Contains(x.Value))) 194 variableNamesView.Content.Remove(oldEntry); 171 195 RegisterVariableNamesViewContentEvents(); 172 196
Note: See TracChangeset
for help on using the changeset viewer.