Changeset 13289
- Timestamp:
- 11/19/15 12:02:40 (9 years ago)
- Location:
- stable
- Files:
-
- 15 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12983,12986,13252,13271
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Data.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Data.Views merged: 12983
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Data.Views/3.3
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Data.Views/3.3 merged: 12983
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r12725 r13289 383 383 ClearSorting(); 384 384 } 385 pr ivatestring[,] SplitClipboardString(string clipboardText) {385 protected string[,] SplitClipboardString(string clipboardText) { 386 386 if (clipboardText.EndsWith(Environment.NewLine)) 387 387 clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length); //remove last newline constant -
stable/HeuristicLab.DataPreprocessing.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing.Views merged: 12983,12986,13252,13271
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.Designer.cs
r12009 r13289 63 63 this.btnReplace = new System.Windows.Forms.Button(); 64 64 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 65 this.addRowButton = new System.Windows.Forms.Button(); 66 this.addColumnButton = new System.Windows.Forms.Button(); 67 this.renameColumnsButton = new System.Windows.Forms.Button(); 65 68 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 66 69 this.contextMenuCell.SuspendLayout(); … … 70 73 // 71 74 this.rowsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); 72 this.rowsTextBox.Enabled = false;73 75 this.errorProvider.SetIconAlignment(this.rowsTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 74 76 this.errorProvider.SetIconPadding(this.rowsTextBox, 2); 75 this.rowsTextBox.ReadOnly = true;76 77 this.rowsTextBox.Size = new System.Drawing.Size(71, 20); 77 78 // … … 79 80 // 80 81 this.columnsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); 81 this.columnsTextBox.Enabled = false;82 this.columnsTextBox.ReadOnly = true;83 82 this.columnsTextBox.Size = new System.Drawing.Size(71, 20); 84 83 // 85 84 // statisticsTextBox 86 85 // 87 this.statisticsTextBox.Size = new System.Drawing.Size(522, 13); 86 this.statisticsTextBox.Location = new System.Drawing.Point(3, 387); 87 this.statisticsTextBox.Size = new System.Drawing.Size(421, 13); 88 88 // 89 89 // btnApplySort 90 90 // 91 this.btnApplySort.Location = new System.Drawing.Point( 349, 19);91 this.btnApplySort.Location = new System.Drawing.Point(234, 0); 92 92 this.btnApplySort.Name = "btnApplySort"; 93 this.btnApplySort.Size = new System.Drawing.Size( 75, 23);93 this.btnApplySort.Size = new System.Drawing.Size(104, 23); 94 94 this.btnApplySort.TabIndex = 7; 95 95 this.btnApplySort.Text = "Apply Sort"; … … 104 104 this.replaceValueOverSelectionToolStripMenuItem}); 105 105 this.contextMenuCell.Name = "contextMenuCell"; 106 this.contextMenuCell.Size = new System.Drawing.Size(225, 70);106 this.contextMenuCell.Size = new System.Drawing.Size(225, 48); 107 107 // 108 108 // replaceValueOverColumnToolStripMenuItem … … 154 154 this.interpolationToolStripMenuItem_Column.Click += new System.EventHandler(this.ReplaceWithInterpolation_Column_Click); 155 155 // 156 // smoothingToolStripMenuItem 157 // 158 this.smoothingToolStripMenuItem_Column.Name = "smoothingToolStripMenuItem ";156 // smoothingToolStripMenuItem_Column 157 // 158 this.smoothingToolStripMenuItem_Column.Name = "smoothingToolStripMenuItem_Column"; 159 159 this.smoothingToolStripMenuItem_Column.Size = new System.Drawing.Size(155, 22); 160 160 this.smoothingToolStripMenuItem_Column.Text = "Smoothing"; … … 202 202 // btnSearch 203 203 // 204 this.btnSearch.Location = new System.Drawing.Point( 201, 19);204 this.btnSearch.Location = new System.Drawing.Point(173, 0); 205 205 this.btnSearch.Name = "btnSearch"; 206 this.btnSearch.Size = new System.Drawing.Size(5 3, 23);206 this.btnSearch.Size = new System.Drawing.Size(55, 23); 207 207 this.btnSearch.TabIndex = 8; 208 208 this.btnSearch.Text = "Search"; … … 213 213 // btnReplace 214 214 // 215 this.btnReplace.Location = new System.Drawing.Point( 260, 19);215 this.btnReplace.Location = new System.Drawing.Point(173, 26); 216 216 this.btnReplace.Name = "btnReplace"; 217 217 this.btnReplace.Size = new System.Drawing.Size(55, 23); … … 222 222 this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click); 223 223 // 224 // addRowButton 225 // 226 this.addRowButton.Location = new System.Drawing.Point(344, 26); 227 this.addRowButton.Name = "addRowButton"; 228 this.addRowButton.Size = new System.Drawing.Size(76, 23); 229 this.addRowButton.TabIndex = 10; 230 this.addRowButton.Text = "Add Row"; 231 this.addRowButton.UseVisualStyleBackColor = true; 232 this.addRowButton.Click += new System.EventHandler(this.addRowButton_Click); 233 // 234 // addColumnButton 235 // 236 this.addColumnButton.Location = new System.Drawing.Point(344, 0); 237 this.addColumnButton.Name = "addColumnButton"; 238 this.addColumnButton.Size = new System.Drawing.Size(76, 23); 239 this.addColumnButton.TabIndex = 10; 240 this.addColumnButton.Text = "Add Column"; 241 this.addColumnButton.UseVisualStyleBackColor = true; 242 this.addColumnButton.Click += new System.EventHandler(this.addColumnButton_Click); 243 // 244 // renameColumnsButton 245 // 246 this.renameColumnsButton.Location = new System.Drawing.Point(234, 26); 247 this.renameColumnsButton.Name = "renameColumnsButton"; 248 this.renameColumnsButton.Size = new System.Drawing.Size(104, 23); 249 this.renameColumnsButton.TabIndex = 11; 250 this.renameColumnsButton.Text = "Rename Columns"; 251 this.renameColumnsButton.UseVisualStyleBackColor = true; 252 this.renameColumnsButton.Click += new System.EventHandler(this.renameColumnsButton_Click); 253 // 224 254 // DataGridContentView 225 255 // 226 256 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 227 257 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 258 this.Controls.Add(this.renameColumnsButton); 259 this.Controls.Add(this.addColumnButton); 260 this.Controls.Add(this.addRowButton); 228 261 this.Controls.Add(this.btnReplace); 229 262 this.Controls.Add(this.btnSearch); 230 263 this.Controls.Add(this.btnApplySort); 231 264 this.Name = "DataGridContentView"; 232 this.Size = new System.Drawing.Size(528, 404); 265 this.Size = new System.Drawing.Size(430, 403); 266 this.Controls.SetChildIndex(this.btnApplySort, 0); 267 this.Controls.SetChildIndex(this.btnSearch, 0); 268 this.Controls.SetChildIndex(this.btnReplace, 0); 269 this.Controls.SetChildIndex(this.addRowButton, 0); 270 this.Controls.SetChildIndex(this.addColumnButton, 0); 271 this.Controls.SetChildIndex(this.renameColumnsButton, 0); 233 272 this.Controls.SetChildIndex(this.statisticsTextBox, 0); 234 273 this.Controls.SetChildIndex(this.rowsLabel, 0); … … 236 275 this.Controls.SetChildIndex(this.rowsTextBox, 0); 237 276 this.Controls.SetChildIndex(this.columnsTextBox, 0); 238 this.Controls.SetChildIndex(this.btnApplySort, 0);239 this.Controls.SetChildIndex(this.btnSearch, 0);240 this.Controls.SetChildIndex(this.btnReplace, 0);241 277 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 242 278 this.contextMenuCell.ResumeLayout(false); … … 265 301 private System.Windows.Forms.ToolTip toolTip; 266 302 private System.Windows.Forms.ToolStripMenuItem smoothingToolStripMenuItem_Column; 303 private System.Windows.Forms.Button addRowButton; 304 private System.Windows.Forms.Button addColumnButton; 305 private System.Windows.Forms.Button renameColumnsButton; 267 306 } 268 307 } -
stable/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs
r12718 r13289 59 59 InitializeComponent(); 60 60 dataGridView.CellMouseClick += dataGridView_CellMouseClick; 61 dataGridView.RowHeaderMouseClick += dataGridView_RowHeaderMouseClick; 61 62 dataGridView.KeyDown += dataGridView_KeyDown; 62 63 dataGridView.MouseUp += dataGridView_MouseUp; … … 142 143 143 144 144 //protected override void PasteValuesToDataGridView() { 145 // base.PasteValuesToDataGridView(); 146 // dataGridView.Refresh(); 147 //} 145 protected override void PasteValuesToDataGridView() { 146 string[,] values = SplitClipboardString(Clipboard.GetText()); 147 int rowIndex = 0; 148 int columnIndex = 0; 149 if (dataGridView.CurrentCell != null) { 150 rowIndex = dataGridView.CurrentCell.RowIndex; 151 columnIndex = dataGridView.CurrentCell.ColumnIndex; 152 } 153 if (Content.Rows < values.GetLength(1) + rowIndex) Content.Rows = values.GetLength(1) + rowIndex; 154 if (Content.Columns < values.GetLength(0) + columnIndex) Content.Columns = values.GetLength(0) + columnIndex; 155 156 ReplaceTransaction(() => { 157 Content.PreProcessingData.InTransaction(() => { 158 for (int row = 0; row < values.GetLength(1); row++) { 159 for (int col = 0; col < values.GetLength(0); col++) { 160 Content.SetValue(values[col, row], row + rowIndex, col + columnIndex); 161 } 162 } 163 }); 164 }); 165 166 ClearSorting(); 167 } 148 168 149 169 protected override void SetEnabledStateOfControls() { … … 165 185 protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 166 186 if (Content != null) { 167 if (e.Button == System.Windows.Forms.MouseButtons.Left) {187 if (e.Button == MouseButtons.Left) { 168 188 dataGridView.Focus(); 169 189 dataGridView.ClearSelection(); … … 174 194 dataGridView[e.ColumnIndex, i].Selected = true; 175 195 } 176 } else if (Content.SortableView) { 196 } else if (e.Button == MouseButtons.Middle) { 197 int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0; 198 Content.PreProcessingData.InsertColumn<double>(newIndex.ToString(), newIndex); 199 } else if (e.Button == MouseButtons.Right && Content.SortableView) { 177 200 SortColumn(e.ColumnIndex); 178 201 } 179 202 } 180 203 searchIterator = null; 204 } 205 private void dataGridView_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 206 if (Content != null) { 207 if (e.Button == MouseButtons.Middle) { 208 int newIndex = e.RowIndex >= 0 ? e.RowIndex : 0; 209 Content.PreProcessingData.InsertRow(newIndex); 210 } 211 } 181 212 } 182 213 … … 450 481 private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 451 482 if (Content == null) return; 452 if (e.Button == System.Windows.Forms.MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) {483 if (e.Button == MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) { 453 484 if (e.ColumnIndex == -1 || e.RowIndex == -1) { 454 485 replaceValueOverColumnToolStripMenuItem.Visible = false; … … 612 643 #endregion 613 644 645 private void addRowButton_Click(object sender, EventArgs e) { 646 Content.PreProcessingData.InsertRow(Content.Rows); 647 } 648 649 private void addColumnButton_Click(object sender, EventArgs e) { 650 Content.PreProcessingData.InsertColumn<double>(Content.Columns.ToString(), Content.Columns); 651 } 652 653 private void renameColumnsButton_Click(object sender, EventArgs e) { 654 var renameDialog = new RenameColumnsDialog(Content.ColumnNames); 655 656 if (renameDialog.ShowDialog(this) == DialogResult.OK) { 657 Content.PreProcessingData.RenameColumns(renameDialog.ColumnNames); 658 } 659 } 614 660 } 615 661 } -
stable/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj
r12007 r13289 120 120 <Compile Include="ComparisonFilterView.Designer.cs"> 121 121 <DependentUpon>ComparisonFilterView.cs</DependentUpon> 122 </Compile> 123 <Compile Include="RenameColumnsDialog.cs"> 124 <SubType>Form</SubType> 125 </Compile> 126 <Compile Include="RenameColumnsDialog.Designer.cs"> 127 <DependentUpon>RenameColumnsDialog.cs</DependentUpon> 122 128 </Compile> 123 129 <Compile Include="ScatterPlotSingleView.cs"> -
stable/HeuristicLab.DataPreprocessing.Views/3.4/RenameColumnsDialog.Designer.cs
r13252 r13289 56 56 this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 57 57 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 58 this.okButton.Location = new System.Drawing.Point( 83, 283);58 this.okButton.Location = new System.Drawing.Point(48, 302); 59 59 this.okButton.Name = "okButton"; 60 60 this.okButton.Size = new System.Drawing.Size(75, 23); … … 67 67 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 68 68 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 69 this.cancelButton.Location = new System.Drawing.Point(1 64, 283);69 this.cancelButton.Location = new System.Drawing.Point(129, 302); 70 70 this.cancelButton.Name = "cancelButton"; 71 71 this.cancelButton.Size = new System.Drawing.Size(75, 23); … … 82 82 | System.Windows.Forms.AnchorStyles.Right))); 83 83 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 84 this.dataGridView.ColumnHeadersVisible = false; 84 85 this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 85 86 this.ColumName}); 86 this.dataGridView.Location = new System.Drawing.Point( 12, 12);87 this.dataGridView.Location = new System.Drawing.Point(0, 0); 87 88 this.dataGridView.Name = "dataGridView"; 88 this.dataGridView.Size = new System.Drawing.Size(227, 265); 89 this.dataGridView.RowHeadersVisible = false; 90 this.dataGridView.Size = new System.Drawing.Size(207, 296); 89 91 this.dataGridView.TabIndex = 2; 90 92 // 91 93 // ColumName 92 94 // 95 this.ColumName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; 93 96 this.ColumName.HeaderText = "Column Name"; 94 97 this.ColumName.Name = "ColumName"; … … 99 102 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 100 103 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 101 this.ClientSize = new System.Drawing.Size(2 51, 318);104 this.ClientSize = new System.Drawing.Size(207, 330); 102 105 this.Controls.Add(this.dataGridView); 103 106 this.Controls.Add(this.cancelButton); 104 107 this.Controls.Add(this.okButton); 108 this.MaximizeBox = false; 109 this.MinimizeBox = false; 105 110 this.Name = "RenameColumnsDialog"; 111 this.ShowIcon = false; 106 112 this.Text = "Rename Columns"; 107 113 ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); -
stable/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing/3.4 merged: 12983,12986,13252
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/DataGridContent.cs
r12718 r13289 41 41 public IFilterLogic FilterLogic { get; private set; } 42 42 43 private IEnumerable<string> rowNames;44 45 43 public int Rows { 46 44 get { … … 72 70 public IEnumerable<string> RowNames { 73 71 get { 74 return rowNames;72 return Enumerable.Range(1, Rows).Select(n => n.ToString()); 75 73 } 76 74 set { 77 //not supported75 throw new NotSupportedException(); 78 76 } 79 77 } … … 84 82 } 85 83 set { 86 //not supported84 throw new NotSupportedException(); 87 85 } 88 86 } … … 103 101 FilterLogic = theFilterLogic; 104 102 PreProcessingData = preProcessingData; 105 createRowNames();106 103 } 107 104 … … 116 113 public void DeleteRows(IEnumerable<int> rows) { 117 114 PreProcessingData.DeleteRowsWithIndices(rows); 118 createRowNames();119 115 } 120 116 … … 133 129 public bool SetValue(string value, int rowIndex, int columnIndex) { 134 130 return PreProcessingData.SetValue(value, columnIndex, rowIndex); 135 }136 137 private void createRowNames() {138 rowNames = Enumerable.Range(1, Rows).Select(n => n.ToString());139 131 } 140 132 -
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/FilteredPreprocessingData.cs
r12121 r13289 119 119 throw new InvalidOperationException("DeleteColumn not possible while data is filtered"); 120 120 originalData.DeleteColumn(columnIndex); 121 } 122 123 public void RenameColumn(int columnIndex, string name) { 124 if (IsFiltered) 125 throw new InvalidOperationException("RenameColumn not possible while data is filtered"); 126 originalData.RenameColumn(columnIndex, name); 127 } 128 129 public void RenameColumns(IList<string> names) { 130 if (IsFiltered) 131 throw new InvalidOperationException("RenameColumns not possible while data is filtered"); 132 originalData.RenameColumns(names); 121 133 } 122 134 -
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs
r12702 r13289 196 196 public abstract void DeleteColumn(int columnIndex); 197 197 198 public abstract void RenameColumn(int columnIndex, string name); 199 public abstract void RenameColumns(IList<string> list); 200 198 201 public abstract Dataset ExportToDataset(); 199 202 -
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
r12009 r13289 98 98 public override void SetCell<T>(int columnIndex, int rowIndex, T value) { 99 99 SaveSnapshot(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex); 100 101 for (int i = Rows; i <= rowIndex; i++) 102 InsertRow(i); 103 for (int i = Columns; i <= columnIndex; i++) 104 InsertColumn<T>(i.ToString(), i); 105 100 106 variableValues[columnIndex][rowIndex] = value; 101 107 if (!IsInTransaction) … … 116 122 117 123 public override bool VariableHasType<T>(int columnIndex) { 118 return variableValues[columnIndex] is List<T>;124 return columnIndex >= variableValues.Count || variableValues[columnIndex] is List<T>; 119 125 } 120 126 … … 219 225 if (!IsInTransaction) 220 226 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1); 227 ResetPartitions(); 221 228 } 222 229 … … 229 236 if (!IsInTransaction) 230 237 OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 238 ResetPartitions(); 231 239 } 232 240 … … 238 246 if (!IsInTransaction) 239 247 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 248 ResetPartitions(); 240 249 } 241 250 242 251 public override void InsertColumn<T>(string variableName, int columnIndex) { 243 252 SaveSnapshot(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1); 244 variableValues.Insert(columnIndex, new List<T>( Rows));253 variableValues.Insert(columnIndex, new List<T>(Enumerable.Repeat(default(T), Rows))); 245 254 variableNames.Insert(columnIndex, variableName); 246 255 if (!IsInTransaction) … … 256 265 } 257 266 267 public override void RenameColumn(int columnIndex, string name) { 268 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 269 if (columnIndex < 0 || columnIndex > variableNames.Count) 270 throw new ArgumentOutOfRangeException("columnIndex"); 271 variableNames[columnIndex] = name; 272 273 if (!IsInTransaction) 274 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 275 } 276 277 public override void RenameColumns(IList<string> names) { 278 if (names == null) throw new ArgumentNullException("names"); 279 if (names.Count != variableNames.Count) throw new ArgumentException("number of names must match the number of columns.", "names"); 280 281 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 282 for (int i = 0; i < names.Count; i++) 283 variableNames[i] = names[i]; 284 285 if (!IsInTransaction) 286 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 287 } 288 258 289 public override Dataset ExportToDataset() { 259 290 IList<IList> values = new List<IList>(); … … 278 309 } 279 310 311 312 private void ResetPartitions() { 313 TrainingPartition = new IntRange(); 314 TestPartition = new IntRange(); 315 } 280 316 281 317 #endregion -
stable/HeuristicLab.DataPreprocessing/3.4/Interfaces/IPreprocessingData.cs
r12121 r13289 47 47 void DeleteColumn(int columnIndex); 48 48 49 void RenameColumn(int columnIndex, string name); 50 void RenameColumns(IList<string> names); 51 49 52 bool AreAllStringColumns(IEnumerable<int> columnIndices); 50 53 bool Validate(string value, out string errorMessage, int columnIndex); -
stable/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r12718 r13289 63 63 var inputVariables = oldProblemData.InputVariables.ToDictionary(x => x.Value, x => x); 64 64 foreach (var variable in problemData.InputVariables) { 65 bool isChecked = oldProblemData.InputVariables.ItemChecked(inputVariables[variable.Value]);65 bool isChecked = inputVariables.ContainsKey(variable.Value) && oldProblemData.InputVariables.ItemChecked(inputVariables[variable.Value]); 66 66 problemData.InputVariables.SetItemCheckedState(variable, isChecked); 67 67 } … … 72 72 private IDataAnalysisProblemData CreateRegressionData(RegressionProblemData oldProblemData) { 73 73 var targetVariable = oldProblemData.TargetVariable; 74 // target variable must be double and must exist in the new dataset 75 return new RegressionProblemData(ExportedDataset, GetDoubleInputVariables(targetVariable), targetVariable, Transformations); 74 if (!context.Data.VariableNames.Contains(targetVariable)) 75 targetVariable = context.Data.VariableNames.First(); 76 var inputVariables = GetDoubleInputVariables(targetVariable); 77 var newProblemData = new RegressionProblemData(ExportedDataset, inputVariables, targetVariable, Transformations); 78 return newProblemData; 76 79 } 77 80 78 81 private IDataAnalysisProblemData CreateClassificationData(ClassificationProblemData oldProblemData) { 79 // target variable must be double and must exist in the new dataset80 82 var targetVariable = oldProblemData.TargetVariable; 81 var newProblemData = new ClassificationProblemData(ExportedDataset, GetDoubleInputVariables(targetVariable), targetVariable, Transformations); 83 if (!context.Data.VariableNames.Contains(targetVariable)) 84 targetVariable = context.Data.VariableNames.First(); 85 var inputVariables = GetDoubleInputVariables(targetVariable); 86 var newProblemData = new ClassificationProblemData(ExportedDataset, inputVariables, targetVariable, Transformations); 82 87 newProblemData.PositiveClass = oldProblemData.PositiveClass; 83 88 return newProblemData;
Note: See TracChangeset
for help on using the changeset viewer.