Changeset 15161
- Timestamp:
- 07/06/17 14:31:05 (7 years ago)
- Location:
- stable
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs
r14186 r15161 139 139 this.xAxisComboBox.Size = new System.Drawing.Size(400, 21); 140 140 this.xAxisComboBox.TabIndex = 7; 141 this.xAxisComboBox.Sorted = false; 141 142 this.xAxisComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged); 142 143 // … … 160 161 this.yAxisComboBox.Size = new System.Drawing.Size(400, 21); 161 162 this.yAxisComboBox.TabIndex = 5; 163 this.yAxisComboBox.Sorted = false; 162 164 this.yAxisComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged); 163 165 // … … 183 185 this.sizeComboBox.Name = "sizeComboBox"; 184 186 this.sizeComboBox.Size = new System.Drawing.Size(300, 21); 187 this.sizeComboBox.Sorted = false; 185 188 this.sizeComboBox.TabIndex = 14; 186 189 this.sizeComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged); … … 264 267 this.radioButtonGroup.Controls.Add(this.zoomButton); 265 268 this.radioButtonGroup.Controls.Add(this.selectButton); 266 this.radioButtonGroup.Location = new System.Drawing.Point( 3, 704);269 this.radioButtonGroup.Location = new System.Drawing.Point(6, 679); 267 270 this.radioButtonGroup.Name = "radioButtonGroup"; 268 271 this.radioButtonGroup.Size = new System.Drawing.Size(122, 32); … … 275 278 this.colorRunsButton.Enabled = false; 276 279 this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 277 this.colorRunsButton.Location = new System.Drawing.Point( 131, 713);280 this.colorRunsButton.Location = new System.Drawing.Point(6, 715); 278 281 this.colorRunsButton.Name = "colorRunsButton"; 279 282 this.colorRunsButton.Size = new System.Drawing.Size(21, 21); … … 317 320 this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 318 321 this.transparencyTrackBar.LargeChange = 16; 319 this.transparencyTrackBar.Location = new System.Drawing.Point( 302, 715);322 this.transparencyTrackBar.Location = new System.Drawing.Point(177, 717); 320 323 this.transparencyTrackBar.Maximum = 254; 321 324 this.transparencyTrackBar.Name = "transparencyTrackBar"; … … 331 334 this.hideRunsButton.Enabled = false; 332 335 this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 333 this.hideRunsButton.Location = new System.Drawing.Point( 172, 713);336 this.hideRunsButton.Location = new System.Drawing.Point(47, 715); 334 337 this.hideRunsButton.Name = "hideRunsButton"; 335 338 this.hideRunsButton.Size = new System.Drawing.Size(43, 21); … … 347 350 this.colorDialogButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 348 351 this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 349 this.colorDialogButton.Location = new System.Drawing.Point( 152, 713);352 this.colorDialogButton.Location = new System.Drawing.Point(27, 715); 350 353 this.colorDialogButton.Name = "colorDialogButton"; 351 354 this.colorDialogButton.Size = new System.Drawing.Size(14, 21); … … 390 393 this.transparencyLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 391 394 this.transparencyLabel.AutoSize = true; 392 this.transparencyLabel.Location = new System.Drawing.Point( 233, 717);395 this.transparencyLabel.Location = new System.Drawing.Point(108, 719); 393 396 this.transparencyLabel.Name = "transparencyLabel"; 394 397 this.transparencyLabel.Size = new System.Drawing.Size(75, 13); -
stable/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
r15154 r15161 93 93 } 94 94 95 public string SelectedXAxis { 96 get { return xAxisValue; } 97 set { 98 if (xAxisComboBox.Items.Contains(value)) { 99 xAxisComboBox.SelectedItem = value; 100 } 101 } 102 } 103 public string SelectedYAxis { 104 get { return yAxisValue; } 105 set { 106 if (yAxisComboBox.Items.Contains(value)) { 107 yAxisComboBox.SelectedItem = value; 108 } 109 } 110 } 111 95 112 protected override void RegisterContentEvents() { 96 113 base.RegisterContentEvents(); … … 227 244 string[] additionalAxisDimension = Enum.GetNames(typeof(AxisDimension)); 228 245 this.xAxisComboBox.Items.AddRange(additionalAxisDimension); 229 this.xAxisComboBox.Items.AddRange(Matrix.ColumnNames.ToArray()); 246 var comparer = new HeuristicLab.Common.NaturalStringComparer(); 247 var sortedColumnNames = Matrix.ColumnNames.ToArray(); 248 sortedColumnNames.StableSort(comparer); 249 this.xAxisComboBox.Items.AddRange(sortedColumnNames); 230 250 this.yAxisComboBox.Items.AddRange(additionalAxisDimension); 231 this.yAxisComboBox.Items.AddRange( Matrix.ColumnNames.ToArray());251 this.yAxisComboBox.Items.AddRange(sortedColumnNames); 232 252 string[] additionalSizeDimension = Enum.GetNames(typeof(SizeDimension)); 233 253 this.sizeComboBox.Items.AddRange(additionalSizeDimension); 234 this.sizeComboBox.Items.AddRange( Matrix.ColumnNames.ToArray());254 this.sizeComboBox.Items.AddRange(sortedColumnNames); 235 255 this.sizeComboBox.SelectedItem = SizeDimension.Constant.ToString(); 236 256 -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r15137 r15161 271 271 <Compile Include="Regression\RegressionSolutionResidualsLineChartView.Designer.cs"> 272 272 <DependentUpon>RegressionSolutionResidualsLineChartView.cs</DependentUpon> 273 </Compile> 274 <Compile Include="Regression\RegressionSolutionResidualAnalysisView.cs"> 275 <SubType>UserControl</SubType> 276 </Compile> 277 <Compile Include="Regression\RegressionSolutionResidualAnalysisView.Designer.cs"> 278 <DependentUpon>RegressionSolutionResidualAnalysisView.cs</DependentUpon> 273 279 </Compile> 274 280 <Compile Include="Regression\RegressionSolutionVariableImpactsView.cs"> -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs
r14890 r15161 20 20 #endregion 21 21 using System; 22 using System.Collections.Generic; 22 23 using System.Drawing; 23 24 using System.Linq; 24 using System.Runtime.Remoting.Contexts;25 using System.Threading.Tasks;26 25 using HeuristicLab.Data; 27 26 using HeuristicLab.MainForm; … … 31 30 [View("Residual Analysis")] 32 31 [Content(typeof(IRegressionSolution))] 33 public partial class RegressionSolutionResidualAnalysisView : DataAnalysisSolutionEvaluationView { 32 public sealed partial class RegressionSolutionResidualAnalysisView : DataAnalysisSolutionEvaluationView { 33 34 // names should be relatively save to prevent collisions with variable names in the dataset 35 private const string TargetLabel = "> Target"; 36 private const string PredictionLabel = "> Prediction"; 37 private const string ResidualLabel = "> Residual"; 38 private const string AbsResidualLabel = "> Residual (abs.)"; 39 private const string RelativeErrorLabel = "> Relative Error"; 40 private const string AbsRelativeErrorLabel = "> Relative Error (abs.)"; 41 private const string PartitionLabel = "> Partition"; 34 42 35 43 public new IRegressionSolution Content { 36 44 get { return (IRegressionSolution)base.Content; } 37 set { 38 base.Content = value; 39 } 45 set { base.Content = value; } 40 46 } 41 47 42 public RegressionSolutionResidualAnalysisView() 43 : base() { 48 public RegressionSolutionResidualAnalysisView() : base() { 44 49 InitializeComponent(); 45 50 } … … 58 63 } 59 64 60 pr otected virtualvoid Content_ProblemDataChanged(object sender, EventArgs e) {65 private void Content_ProblemDataChanged(object sender, EventArgs e) { 61 66 OnContentChanged(); 62 67 } 63 68 64 pr otected virtualvoid Content_ModelChanged(object sender, EventArgs e) {69 private void Content_ModelChanged(object sender, EventArgs e) { 65 70 OnContentChanged(); 66 71 } … … 83 88 var ds = problemData.Dataset; 84 89 var runs = new RunCollection(); 90 // determine relevant variables (at least two different values) 91 var doubleVars = ds.DoubleVariables.Where(vn => ds.GetDoubleValues(vn).Max() > ds.GetDoubleValues(vn).Min()).ToArray(); 92 var stringVars = ds.StringVariables.Where(vn => ds.GetStringValues(vn).Distinct().Skip(1).Any()).ToArray(); 93 var dateTimeVars = ds.DateTimeVariables.Where(vn => ds.GetDateTimeValues(vn).Distinct().Skip(1).Any()).ToArray(); 94 85 95 // produce training and test values separately as they might overlap (e.g. for ensembles) 86 96 var predictedValuesTrain = Content.EstimatedTrainingValues.ToArray(); 87 97 int j = 0; // idx for predictedValues array 88 var partitionId = "Partition";89 while (ds.VariableNames.Contains(partitionId)) partitionId += "_";90 98 foreach (var i in problemData.TrainingIndices) { 91 var run = CreateRunForIdx(i, problemData );99 var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars); 92 100 var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i); 93 101 AddErrors(run, predictedValuesTrain[j++], targetValue); 94 run.Results.Add( partitionId, new StringValue("Training"));102 run.Results.Add(PartitionLabel, new StringValue("Training")); 95 103 run.Color = Color.Gold; 96 104 runs.Add(run); … … 99 107 j = 0; 100 108 foreach (var i in problemData.TestIndices) { 101 var run = CreateRunForIdx(i, problemData );109 var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars); 102 110 var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i); 103 111 AddErrors(run, predictedValuesTest[j++], targetValue); 104 run.Results.Add( partitionId, new StringValue("Test"));112 run.Results.Add(PartitionLabel, new StringValue("Test")); 105 113 run.Color = Color.Red; 106 114 runs.Add(run); … … 119 127 var residual = target - pred; 120 128 var relError = residual / target; 121 var predId = "Prediction"; 122 while (run.Results.ContainsKey(predId)) predId += "_"; 123 var resId = "Residual"; 124 while (run.Results.ContainsKey(resId)) resId += "_"; 125 var relErrorId = "Rel. Error"; 126 while (run.Results.ContainsKey(relErrorId)) relErrorId+= "_"; 127 run.Results.Add(predId, new DoubleValue(pred)); 128 run.Results.Add(resId, new DoubleValue(residual)); 129 run.Results.Add(relErrorId, new DoubleValue(relError)); 129 run.Results.Add(TargetLabel, new DoubleValue(target)); 130 run.Results.Add(PredictionLabel, new DoubleValue(pred)); 131 run.Results.Add(ResidualLabel, new DoubleValue(residual)); 132 run.Results.Add(AbsResidualLabel, new DoubleValue(Math.Abs(residual))); 133 run.Results.Add(RelativeErrorLabel, new DoubleValue(relError)); 134 run.Results.Add(AbsRelativeErrorLabel, new DoubleValue(Math.Abs(relError))); 130 135 } 131 136 132 private IRun CreateRunForIdx(int i, IRegressionProblemData problemData ) {137 private IRun CreateRunForIdx(int i, IRegressionProblemData problemData, IEnumerable<string> doubleVars, IEnumerable<string> stringVars, IEnumerable<string> dateTimeVars) { 133 138 var ds = problemData.Dataset; 134 139 var run = new Run(); 135 foreach (var variableName in d s.DoubleVariables) {140 foreach (var variableName in doubleVars) { 136 141 run.Results.Add(variableName, new DoubleValue(ds.GetDoubleValue(variableName, i))); 137 142 } 138 foreach (var variableName in ds.StringVariables) {143 foreach (var variableName in stringVars) { 139 144 run.Results.Add(variableName, new StringValue(ds.GetStringValue(variableName, i))); 140 145 } 141 146 foreach (var variableName in dateTimeVars) { 147 run.Results.Add(variableName, new DateTimeValue(ds.GetDateTimeValue(variableName, i))); 148 } 142 149 return run; 143 150 } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r15159 r15161 181 181 } 182 182 183 public IEnumerable<string> DateTimeVariables { 184 get { return variableValues.Where(p => p.Value is IList<DateTime>).Select(p => p.Key); } 185 } 186 183 187 public IEnumerable<double> GetDoubleValues(string variableName) { 184 188 return GetValues<double>(variableName); … … 215 219 return new ReadOnlyCollection<string>(values); 216 220 } 221 222 public DateTime GetDateTimeValue(string variableName, int row) { 223 var values = GetValues<DateTime>(variableName); 224 return values[row]; 225 } 226 public IEnumerable<DateTime> GetDateTimeValues(string variableName, IEnumerable<int> rows) { 227 return GetValues<DateTime>(variableName, rows); 228 } 229 public ReadOnlyCollection<DateTime> GetReadOnlyDateTimeValues(string variableName) { 230 var values = GetValues<DateTime>(variableName); 231 return new ReadOnlyCollection<DateTime>(values); 232 } 233 217 234 218 235 private IEnumerable<T> GetValues<T>(string variableName, IEnumerable<int> rows) { -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataset.cs
r15131 r15161 31 31 IEnumerable<string> DoubleVariables { get; } 32 32 IEnumerable<string> StringVariables { get; } 33 IEnumerable<string> DateTimeVariables { get; } 33 34 34 35 bool VariableHasType<T>(string variableName); … … 44 45 ReadOnlyCollection<string> GetReadOnlyStringValues(string VariableName); 45 46 47 System.DateTime GetDateTimeValue(string variableName, int row); 46 48 IEnumerable<DateTime> GetDateTimeValues(string variableName); 49 IEnumerable<DateTime> GetDateTimeValues(string variableName, IEnumerable<int> rows); 50 ReadOnlyCollection<DateTime> GetReadOnlyDateTimeValues(string variableName); 47 51 } 48 52 }
Note: See TracChangeset
for help on using the changeset viewer.