Changeset 8139
- Timestamp:
- 06/27/12 17:34:17 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs
r7259 r8139 68 68 string targetVariable = problemData.TargetVariable; 69 69 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 70 IEnumerable<int> rows = problemData.TrainingIndi zes;70 IEnumerable<int> rows = problemData.TrainingIndices; 71 71 int nClasses = problemData.ClassNames.Count(); 72 72 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs
r7588 r8139 72 72 string targetVariable = problemData.TargetVariable; 73 73 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 74 IEnumerable<int> rows = problemData.TrainingIndi zes;74 IEnumerable<int> rows = problemData.TrainingIndices; 75 75 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 76 76 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs
r7259 r8139 69 69 string targetVariable = problemData.TargetVariable; 70 70 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 71 IEnumerable<int> rows = problemData.TrainingIndi zes;71 IEnumerable<int> rows = problemData.TrainingIndices; 72 72 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 73 73 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) … … 81 81 int nClasses = classValues.Count(); 82 82 // map original class values to values [0..nClasses-1] 83 Dictionary<double, double> classIndi zes = new Dictionary<double, double>();83 Dictionary<double, double> classIndices = new Dictionary<double, double>(); 84 84 for (int i = 0; i < nClasses; i++) { 85 classIndi zes[classValues[i]] = i;85 classIndices[classValues[i]] = i; 86 86 } 87 87 for (int row = 0; row < nRows; row++) { 88 inputMatrix[row, nFeatures] = classIndi zes[inputMatrix[row, nFeatures]];88 inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]]; 89 89 } 90 90 int info; -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs
r7259 r8139 87 87 string targetVariable = problemData.TargetVariable; 88 88 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 89 IEnumerable<int> rows = problemData.TrainingIndi zes;89 IEnumerable<int> rows = problemData.TrainingIndices; 90 90 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 91 91 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) … … 99 99 int nClasses = classValues.Count(); 100 100 // map original class values to values [0..nClasses-1] 101 Dictionary<double, double> classIndi zes = new Dictionary<double, double>();101 Dictionary<double, double> classIndices = new Dictionary<double, double>(); 102 102 for (int i = 0; i < nClasses; i++) { 103 classIndi zes[classValues[i]] = i;103 classIndices[classValues[i]] = i; 104 104 } 105 105 for (int row = 0; row < nRows; row++) { 106 inputMatrix[row, nFeatures] = classIndi zes[inputMatrix[row, nFeatures]];106 inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]]; 107 107 } 108 108 alglib.nearestneighbor.kdtreebuild(inputMatrix, nRows, inputMatrix.GetLength(1) - 1, 1, 2, kdtree); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourRegression.cs
r7259 r8139 87 87 string targetVariable = problemData.TargetVariable; 88 88 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 89 IEnumerable<int> rows = problemData.TrainingIndi zes;89 IEnumerable<int> rows = problemData.TrainingIndices; 90 90 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 91 91 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs
r8121 r8139 185 185 string targetVariable = problemData.TargetVariable; 186 186 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 187 IEnumerable<int> rows = problemData.TrainingIndi zes;187 IEnumerable<int> rows = problemData.TrainingIndices; 188 188 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 189 189 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) … … 195 195 int nClasses = classValues.Count(); 196 196 // map original class values to values [0..nClasses-1] 197 Dictionary<double, double> classIndi zes = new Dictionary<double, double>();197 Dictionary<double, double> classIndices = new Dictionary<double, double>(); 198 198 for (int i = 0; i < nClasses; i++) { 199 classIndi zes[classValues[i]] = i;199 classIndices[classValues[i]] = i; 200 200 } 201 201 for (int row = 0; row < nRows; row++) { 202 inputMatrix[row, nFeatures] = classIndi zes[inputMatrix[row, nFeatures]];202 inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]]; 203 203 } 204 204 -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs
r8121 r8139 171 171 string targetVariable = problemData.TargetVariable; 172 172 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 173 IEnumerable<int> rows = problemData.TrainingIndi zes;173 IEnumerable<int> rows = problemData.TrainingIndices; 174 174 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 175 175 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) … … 181 181 int nClasses = classValues.Count(); 182 182 // map original class values to values [0..nClasses-1] 183 Dictionary<double, double> classIndi zes = new Dictionary<double, double>();183 Dictionary<double, double> classIndices = new Dictionary<double, double>(); 184 184 for (int i = 0; i < nClasses; i++) { 185 classIndi zes[classValues[i]] = i;185 classIndices[classValues[i]] = i; 186 186 } 187 187 for (int row = 0; row < nRows; row++) { 188 inputMatrix[row, nFeatures] = classIndi zes[inputMatrix[row, nFeatures]];188 inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]]; 189 189 } 190 190 -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs
r8121 r8139 170 170 string targetVariable = problemData.TargetVariable; 171 171 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 172 IEnumerable<int> rows = problemData.TrainingIndi zes;172 IEnumerable<int> rows = problemData.TrainingIndices; 173 173 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 174 174 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs
r8121 r8139 186 186 string targetVariable = problemData.TargetVariable; 187 187 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 188 IEnumerable<int> rows = problemData.TrainingIndi zes;188 IEnumerable<int> rows = problemData.TrainingIndices; 189 189 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 190 190 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs
r7259 r8139 97 97 string targetVariable = problemData.TargetVariable; 98 98 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 99 IEnumerable<int> rows = problemData.TrainingIndi zes;99 IEnumerable<int> rows = problemData.TrainingIndices; 100 100 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 101 101 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) … … 111 111 int nClasses = classValues.Count(); 112 112 // map original class values to values [0..nClasses-1] 113 Dictionary<double, double> classIndi zes = new Dictionary<double, double>();113 Dictionary<double, double> classIndices = new Dictionary<double, double>(); 114 114 for (int i = 0; i < nClasses; i++) { 115 classIndi zes[classValues[i]] = i;115 classIndices[classValues[i]] = i; 116 116 } 117 117 for (int row = 0; row < nRows; row++) { 118 inputMatrix[row, nCols - 1] = classIndi zes[inputMatrix[row, nCols - 1]];118 inputMatrix[row, nCols - 1] = classIndices[inputMatrix[row, nCols - 1]]; 119 119 } 120 120 // execute random forest algorithm -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs
r7259 r8139 97 97 string targetVariable = problemData.TargetVariable; 98 98 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 99 IEnumerable<int> rows = problemData.TrainingIndi zes;99 IEnumerable<int> rows = problemData.TrainingIndices; 100 100 double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows); 101 101 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs
r8121 r8139 132 132 Dataset dataset = problemData.Dataset; 133 133 string targetVariable = problemData.TargetVariable; 134 IEnumerable<int> rows = problemData.TrainingIndi zes;134 IEnumerable<int> rows = problemData.TrainingIndices; 135 135 136 136 //extract SVM parameters from scope and set them -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs
r8121 r8139 140 140 Dataset dataset = problemData.Dataset; 141 141 string targetVariable = problemData.TargetVariable; 142 IEnumerable<int> rows = problemData.TrainingIndi zes;142 IEnumerable<int> rows = problemData.TrainingIndices; 143 143 144 144 //extract SVM parameters from scope and set them -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs
r8080 r8139 85 85 Dataset dataset = problemData.Dataset; 86 86 IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables; 87 IEnumerable<int> rows = problemData.TrainingIndi zes;87 IEnumerable<int> rows = problemData.TrainingIndices; 88 88 int info; 89 89 double[,] centers; -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringSolution.cs
r7259 r8139 52 52 public KMeansClusteringSolution(KMeansClusteringModel model, IClusteringProblemData problemData) 53 53 : base(model, problemData) { 54 double trainingIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TrainingIndi zes);55 double testIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TestIndi zes);54 double trainingIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TrainingIndices); 55 double testIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TestIndices); 56 56 this.Add(new Result(TrainingIntraClusterSumOfSquaresResultName, "The sum of squared distances of points of the training partition to the cluster center (is minimized by k-Means).", new DoubleValue(trainingIntraClusterSumOfSquares))); 57 57 this.Add(new Result(TestIntraClusterSumOfSquaresResultName, "The sum of squared distances of points of the test partition to the cluster center (is minimized by k-Means).", new DoubleValue(testIntraClusterSumOfSquares))); -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r7987 r8139 35 35 [Content(typeof(IStringConvertibleMatrix), true)] 36 36 public partial class StringConvertibleMatrixView : AsynchronousContentView { 37 private int[] virtualRowIndi zes;38 private List<KeyValuePair<int, SortOrder>> sortedColumnIndi zes;37 private int[] virtualRowIndices; 38 private List<KeyValuePair<int, SortOrder>> sortedColumnIndices; 39 39 private RowComparer rowComparer; 40 40 … … 82 82 errorProvider.SetIconAlignment(columnsTextBox, ErrorIconAlignment.MiddleLeft); 83 83 errorProvider.SetIconPadding(columnsTextBox, 2); 84 sortedColumnIndi zes = new List<KeyValuePair<int, SortOrder>>();84 sortedColumnIndices = new List<KeyValuePair<int, SortOrder>>(); 85 85 rowComparer = new RowComparer(); 86 86 } … … 108 108 dataGridView.Rows.Clear(); 109 109 dataGridView.Columns.Clear(); 110 virtualRowIndi zes = new int[0];110 virtualRowIndices = new int[0]; 111 111 } else 112 112 UpdateData(); … … 128 128 columnsTextBox.Text = Content.Columns.ToString(); 129 129 columnsTextBox.Enabled = true; 130 virtualRowIndi zes = Enumerable.Range(0, Content.Rows).ToArray();130 virtualRowIndices = Enumerable.Range(0, Content.Rows).ToArray(); 131 131 132 132 if (Content.Columns == 0 && dataGridView.ColumnCount != Content.Columns && !Content.ReadOnly) … … 178 178 179 179 while (updatedRows < count) { 180 if (virtualRowIndi zes[index] < Content.RowNames.Count())181 dataGridView.Rows[index].HeaderCell.Value = Content.RowNames.ElementAt(virtualRowIndi zes[index]);180 if (virtualRowIndices[index] < Content.RowNames.Count()) 181 dataGridView.Rows[index].HeaderCell.Value = Content.RowNames.ElementAt(virtualRowIndices[index]); 182 182 else 183 183 dataGridView.Rows[index].HeaderCell.Value = "Row " + (index + 1); … … 273 273 if (!dataGridView.ReadOnly) { 274 274 string value = e.Value.ToString(); 275 int rowIndex = virtualRowIndi zes[e.RowIndex];275 int rowIndex = virtualRowIndices[e.RowIndex]; 276 276 e.ParsingApplied = Content.SetValue(value, rowIndex, e.ColumnIndex); 277 277 if (e.ParsingApplied) e.Value = Content.GetValue(rowIndex, e.ColumnIndex); … … 283 283 private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { 284 284 if (Content != null && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) { 285 int rowIndex = virtualRowIndi zes[e.RowIndex];285 int rowIndex = virtualRowIndices[e.RowIndex]; 286 286 e.Value = Content.GetValue(rowIndex, e.ColumnIndex); 287 287 } … … 340 340 341 341 for (int i = minRowIndex; i <= maxRowIndex; i++) { 342 int rowIndex = this.virtualRowIndi zes[i];342 int rowIndex = this.virtualRowIndices[i]; 343 343 if (addRowNames) { 344 344 s.Append(Content.RowNames.ElementAt(rowIndex)); … … 399 399 if (Content != null) { 400 400 if (e.Button == MouseButtons.Left && Content.SortableView) { 401 bool addToSortedIndi zes = (Control.ModifierKeys & Keys.Control) == Keys.Control;401 bool addToSortedIndices = (Control.ModifierKeys & Keys.Control) == Keys.Control; 402 402 SortOrder newSortOrder = SortOrder.Ascending; 403 if (sortedColumnIndi zes.Any(x => x.Key == e.ColumnIndex)) {404 SortOrder oldSortOrder = sortedColumnIndi zes.Where(x => x.Key == e.ColumnIndex).First().Value;403 if (sortedColumnIndices.Any(x => x.Key == e.ColumnIndex)) { 404 SortOrder oldSortOrder = sortedColumnIndices.Where(x => x.Key == e.ColumnIndex).First().Value; 405 405 int enumLength = Enum.GetValues(typeof(SortOrder)).Length; 406 406 newSortOrder = oldSortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), ((((int)oldSortOrder) + 1) % enumLength).ToString()); 407 407 } 408 408 409 if (!addToSortedIndi zes)410 sortedColumnIndi zes.Clear();411 412 if (sortedColumnIndi zes.Any(x => x.Key == e.ColumnIndex)) {413 int sortedIndex = sortedColumnIndi zes.FindIndex(x => x.Key == e.ColumnIndex);409 if (!addToSortedIndices) 410 sortedColumnIndices.Clear(); 411 412 if (sortedColumnIndices.Any(x => x.Key == e.ColumnIndex)) { 413 int sortedIndex = sortedColumnIndices.FindIndex(x => x.Key == e.ColumnIndex); 414 414 if (newSortOrder != SortOrder.None) 415 sortedColumnIndi zes[sortedIndex] = new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder);415 sortedColumnIndices[sortedIndex] = new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder); 416 416 else 417 sortedColumnIndi zes.RemoveAt(sortedIndex);417 sortedColumnIndices.RemoveAt(sortedIndex); 418 418 } else 419 419 if (newSortOrder != SortOrder.None) 420 sortedColumnIndi zes.Add(new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder));420 sortedColumnIndices.Add(new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder)); 421 421 Sort(); 422 422 } … … 425 425 426 426 protected virtual void ClearSorting() { 427 virtualRowIndi zes = Enumerable.Range(0, Content.Rows).ToArray();428 sortedColumnIndi zes.Clear();427 virtualRowIndices = Enumerable.Range(0, Content.Rows).ToArray(); 428 sortedColumnIndices.Clear(); 429 429 UpdateSortGlyph(); 430 430 } 431 431 432 432 private void Sort() { 433 virtualRowIndi zes = Sort(sortedColumnIndizes);433 virtualRowIndices = Sort(sortedColumnIndices); 434 434 UpdateSortGlyph(); 435 435 UpdateRowHeaders(); … … 439 439 int[] newSortedIndex = Enumerable.Range(0, Content.Rows).ToArray(); 440 440 if (sortedColumns.Count() != 0) { 441 rowComparer.SortedIndi zes = sortedColumns;441 rowComparer.SortedIndices = sortedColumns; 442 442 rowComparer.Matrix = Content; 443 443 Array.Sort(newSortedIndex, rowComparer); … … 448 448 foreach (DataGridViewColumn col in this.dataGridView.Columns) 449 449 col.HeaderCell.SortGlyphDirection = SortOrder.None; 450 foreach (KeyValuePair<int, SortOrder> p in sortedColumnIndi zes)450 foreach (KeyValuePair<int, SortOrder> p in sortedColumnIndices) 451 451 this.dataGridView.Columns[p.Key].HeaderCell.SortGlyphDirection = p.Value; 452 452 } … … 457 457 } 458 458 459 private List<KeyValuePair<int, SortOrder>> sortedIndi zes;460 public IEnumerable<KeyValuePair<int, SortOrder>> SortedIndi zes {461 get { return this.sortedIndi zes; }462 set { sortedIndi zes = new List<KeyValuePair<int, SortOrder>>(value); }459 private List<KeyValuePair<int, SortOrder>> sortedIndices; 460 public IEnumerable<KeyValuePair<int, SortOrder>> SortedIndices { 461 get { return this.sortedIndices; } 462 set { sortedIndices = new List<KeyValuePair<int, SortOrder>>(value); } 463 463 } 464 464 private IStringConvertibleMatrix matrix; … … 477 477 if (matrix == null) 478 478 throw new InvalidOperationException("Could not sort IStringConvertibleMatrix if the matrix member is null."); 479 if (sortedIndi zes == null)479 if (sortedIndices == null) 480 480 return 0; 481 481 482 foreach (KeyValuePair<int, SortOrder> pair in sortedIndi zes.Where(p => p.Value != SortOrder.None)) {482 foreach (KeyValuePair<int, SortOrder> pair in sortedIndices.Where(p => p.Value != SortOrder.None)) { 483 483 string1 = matrix.GetValue(x, pair.Key); 484 484 string2 = matrix.GetValue(y, pair.Key); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTabularView.cs
r7469 r8139 164 164 RunCollectionRowComparer rowComparer = new RunCollectionRowComparer(); 165 165 if (sortedColumns.Count() != 0) { 166 rowComparer.SortedIndi zes = sortedColumns;166 rowComparer.SortedIndices = sortedColumns; 167 167 rowComparer.Matrix = Content; 168 168 Array.Sort(newSortedIndex, rowComparer); … … 194 194 } 195 195 196 private List<KeyValuePair<int, SortOrder>> sortedIndi zes;197 public IEnumerable<KeyValuePair<int, SortOrder>> SortedIndi zes {198 get { return this.sortedIndi zes; }199 set { sortedIndi zes = new List<KeyValuePair<int, SortOrder>>(value); }196 private List<KeyValuePair<int, SortOrder>> sortedIndices; 197 public IEnumerable<KeyValuePair<int, SortOrder>> SortedIndices { 198 get { return this.sortedIndices; } 199 set { sortedIndices = new List<KeyValuePair<int, SortOrder>>(value); } 200 200 } 201 201 private RunCollection matrix; … … 212 212 if (matrix == null) 213 213 throw new InvalidOperationException("Could not sort IStringConvertibleMatrix if the matrix member is null."); 214 if (sortedIndi zes == null)214 if (sortedIndices == null) 215 215 return 0; 216 216 217 foreach (KeyValuePair<int, SortOrder> pair in sortedIndi zes.Where(p => p.Value != SortOrder.None)) {217 foreach (KeyValuePair<int, SortOrder> pair in sortedIndices.Where(p => p.Value != SortOrder.None)) { 218 218 value1 = matrix.GetValue(x, pair.Key); 219 219 value2 = matrix.GetValue(y, pair.Key); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs
r7259 r8139 69 69 var interpreter = Content.Model.Interpreter; 70 70 var dataset = Content.ProblemData.Dataset; 71 var rows = Content.ProblemData.TrainingIndi zes;71 var rows = Content.ProblemData.TrainingIndices; 72 72 string targetVariable = Content.ProblemData.TargetVariable; 73 73 Dictionary<ISymbolicExpressionTreeNode, double> impactValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); … … 113 113 start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone()); 114 114 var interpreter = Content.Model.Interpreter; 115 var rows = Content.ProblemData.TrainingIndi zes;115 var rows = Content.ProblemData.TrainingIndices; 116 116 return interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows).Median(); 117 117 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r7823 r8139 81 81 82 82 private void UpdateEstimationLimits() { 83 if (ProblemData.TrainingIndi zes.Any()) {84 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).ToList();83 if (ProblemData.TrainingIndices.Any()) { 84 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToList(); 85 85 var mean = targetValues.Average(); 86 86 var range = targetValues.Max() - targetValues.Min(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r8130 r8139 97 97 98 98 private void UpdateEstimationLimits() { 99 if (ProblemData.TrainingIndi zes.Any()) {100 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).ToList();99 if (ProblemData.TrainingIndices.Any()) { 100 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToList(); 101 101 var mean = targetValues.Average(); 102 102 var range = targetValues.Max() - targetValues.Min(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
r8030 r8139 125 125 var dataset = problemData.Dataset; 126 126 var targetVariable = problemData.TargetVariable; 127 var rows = problemData.TrainingIndi zes;127 var rows = problemData.TrainingIndices; 128 128 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows); 129 129 var targetValues = dataset.GetDoubleValues(targetVariable, rows); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
r7259 r8139 66 66 var interpreter = Content.Model.Interpreter; 67 67 var dataset = Content.ProblemData.Dataset; 68 var rows = Content.ProblemData.TrainingIndi zes;68 var rows = Content.ProblemData.TrainingIndices; 69 69 string targetVariable = Content.ProblemData.TargetVariable; 70 70 Dictionary<ISymbolicExpressionTreeNode, double> impactValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); … … 106 106 start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone()); 107 107 var interpreter = Content.Model.Interpreter; 108 var rows = Content.ProblemData.TrainingIndi zes;108 var rows = Content.ProblemData.TrainingIndices; 109 109 return interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows).Median(); 110 110 } … … 122 122 123 123 protected override void btnOptimizeConstants_Click(object sender, EventArgs e) { 124 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(Content.Model.Interpreter, Content.Model.SymbolicExpressionTree, Content.ProblemData, Content.ProblemData.TrainingIndi zes, 0.001, 0, 0.0001);124 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(Content.Model.Interpreter, Content.Model.SymbolicExpressionTree, Content.ProblemData, Content.ProblemData.TrainingIndices, 0.001, 0, 0.0001); 125 125 UpdateModel(Content.Model.SymbolicExpressionTree); 126 126 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionResponseFunctionView.cs
r7259 r8139 142 142 }; 143 143 144 var mainTrainingIndi zes = (from row in Content.ProblemData.TrainingIndizes144 var mainTrainingIndices = (from row in Content.ProblemData.TrainingIndices 145 145 where NearMedianValue(row) 146 146 select row) 147 147 .ToArray(); 148 var mainTestIndi zes = (from row in Content.ProblemData.TestIndizes148 var mainTestIndices = (from row in Content.ProblemData.TestIndices 149 149 where NearMedianValue(row) 150 150 select row) 151 151 .ToArray(); 152 152 153 var freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, mainTrainingIndi zes).ToArray();153 var freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, mainTrainingIndices).ToArray(); 154 154 var trainingValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable, 155 mainTrainingIndi zes).ToArray();155 mainTrainingIndices).ToArray(); 156 156 Array.Sort(freeVariableValues, trainingValues); 157 157 responseChart.Series["Training Data"].Points.DataBindXY(freeVariableValues, trainingValues); 158 158 159 freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, mainTestIndi zes).ToArray();159 freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, mainTestIndices).ToArray(); 160 160 var testValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable, 161 mainTestIndi zes).ToArray();161 mainTestIndices).ToArray(); 162 162 Array.Sort(freeVariableValues, testValues); 163 163 responseChart.Series["Test Data"].Points.DataBindXY(freeVariableValues, testValues); 164 164 165 165 // draw scatter plots of remaining values 166 freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, Content.ProblemData.TrainingIndi zes).ToArray();166 freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, Content.ProblemData.TrainingIndices).ToArray(); 167 167 trainingValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable, 168 Content.ProblemData.TrainingIndi zes).ToArray();168 Content.ProblemData.TrainingIndices).ToArray(); 169 169 Array.Sort(freeVariableValues, trainingValues); 170 170 responseChart.Series["Training Data (edge)"].Points.DataBindXY(freeVariableValues, trainingValues); 171 171 172 freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, Content.ProblemData.TestIndi zes).ToArray();172 freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, Content.ProblemData.TestIndices).ToArray(); 173 173 testValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable, 174 Content.ProblemData.TestIndi zes).ToArray();174 Content.ProblemData.TestIndices).ToArray(); 175 175 Array.Sort(freeVariableValues, testValues); 176 176 responseChart.Series["Test Data (edge)"].Points.DataBindXY(freeVariableValues, testValues); … … 187 187 string freeVariable = (string)comboBox.SelectedItem; 188 188 189 var freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, Content.ProblemData.TrainingIndi zes).ToArray();189 var freeVariableValues = Content.ProblemData.Dataset.GetDoubleValues(freeVariable, Content.ProblemData.TrainingIndices).ToArray(); 190 190 var responseValues = Content.Model.Interpreter.GetSymbolicExpressionTreeValues(clonedTree, 191 191 Content.ProblemData.Dataset, 192 Content.ProblemData.TrainingIndi zes)192 Content.ProblemData.TrainingIndices) 193 193 .ToArray(); 194 194 Array.Sort(freeVariableValues, responseValues); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs
r7823 r8139 85 85 86 86 private void UpdateEstimationLimits() { 87 if (ProblemData.TrainingIndi zes.Any()) {88 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).ToList();87 if (ProblemData.TrainingIndices.Any()) { 88 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToList(); 89 89 var mean = targetValues.Average(); 90 90 var range = targetValues.Max() - targetValues.Min(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
r8130 r8139 102 102 103 103 private void UpdateEstimationLimits() { 104 if (ProblemData.TrainingIndi zes.Any()) {105 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).ToList();104 if (ProblemData.TrainingIndices.Any()) { 105 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToList(); 106 106 var mean = targetValues.Average(); 107 107 var range = targetValues.Max() - targetValues.Min(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs
r8030 r8139 73 73 var dataset = problemData.Dataset; 74 74 var targetVariable = problemData.TargetVariable; 75 var rows = problemData.TrainingIndi zes;75 var rows = problemData.TrainingIndices; 76 76 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows); 77 77 var targetValues = dataset.GetDoubleValues(targetVariable, rows); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r7259 r8139 73 73 } 74 74 75 int[] indi zes;75 int[] indices; 76 76 double[] estimatedClassValues; 77 77 78 78 switch (SamplesComboBox.SelectedItem.ToString()) { 79 79 case SamplesComboBoxAllSamples: { 80 indi zes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray();80 indices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(); 81 81 estimatedClassValues = Content.EstimatedClassValues.ToArray(); 82 82 break; 83 83 } 84 84 case SamplesComboBoxTrainingSamples: { 85 indi zes = Content.ProblemData.TrainingIndizes.ToArray();85 indices = Content.ProblemData.TrainingIndices.ToArray(); 86 86 estimatedClassValues = Content.EstimatedTrainingClassValues.ToArray(); 87 87 break; 88 88 } 89 89 case SamplesComboBoxTestSamples: { 90 indi zes = Content.ProblemData.TestIndizes.ToArray();90 indices = Content.ProblemData.TestIndices.ToArray(); 91 91 estimatedClassValues = Content.EstimatedTestClassValues.ToArray(); 92 92 break; … … 98 98 int classValuesCount = Content.ProblemData.ClassValues.Count; 99 99 int solutionsCount = Content.ClassificationSolutions.Count(); 100 string[,] values = new string[indi zes.Length, 5 + classValuesCount + solutionsCount];100 string[,] values = new string[indices.Length, 5 + classValuesCount + solutionsCount]; 101 101 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 102 List<List<double?>> estimatedValuesVector = GetEstimatedValues(SamplesComboBox.SelectedItem.ToString(), indi zes,102 List<List<double?>> estimatedValuesVector = GetEstimatedValues(SamplesComboBox.SelectedItem.ToString(), indices, 103 103 Content.ClassificationSolutions); 104 104 105 for (int i = 0; i < indi zes.Length; i++) {106 int row = indi zes[i];105 for (int i = 0; i < indices.Length; i++) { 106 int row = indices[i]; 107 107 values[i, 0] = row.ToString(); 108 108 values[i, 1] = target[i].ToString(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs
r7259 r8139 107 107 double[] predictedValues; 108 108 if (cmbSamples.SelectedItem.ToString() == TrainingSamples) { 109 rows = Content.ProblemData.TrainingIndi zes;109 rows = Content.ProblemData.TrainingIndices; 110 110 predictedValues = Content.EstimatedTrainingClassValues.ToArray(); 111 111 } else if (cmbSamples.SelectedItem.ToString() == TestSamples) { 112 rows = Content.ProblemData.TestIndi zes;112 rows = Content.ProblemData.TestIndices; 113 113 predictedValues = Content.EstimatedTestClassValues.ToArray(); 114 114 } else throw new InvalidOperationException(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs
r7259 r8139 96 96 var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator(); 97 97 estimatedTraining.MoveNext(); 98 foreach (var trainingRow in Content.ProblemData.TrainingIndi zes) {98 foreach (var trainingRow in Content.ProblemData.TrainingIndices) { 99 99 values[trainingRow, 3] = estimatedTraining.Current.ToString(); 100 100 estimatedTraining.MoveNext(); … … 102 102 var estimatedTest = Content.EstimatedTestClassValues.GetEnumerator(); 103 103 estimatedTest.MoveNext(); 104 foreach (var testRow in Content.ProblemData.TestIndi zes) {104 foreach (var testRow in Content.ProblemData.TestIndices) { 105 105 values[testRow, 4] = estimatedTest.Current.ToString(); 106 106 estimatedTest.MoveNext(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.cs
r7259 r8139 101 101 102 102 if (cmbSamples.SelectedItem.ToString() == TrainingSamples) { 103 rows = Content.ProblemData.TrainingIndi zes;103 rows = Content.ProblemData.TrainingIndices; 104 104 } else if (cmbSamples.SelectedItem.ToString() == TestSamples) { 105 rows = Content.ProblemData.TestIndi zes;105 rows = Content.ProblemData.TestIndices; 106 106 } else throw new InvalidOperationException(); 107 107 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.cs
r7259 r8139 137 137 var targetValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToList(); 138 138 139 foreach (int row in Content.ProblemData.TrainingIndi zes) {139 foreach (int row in Content.ProblemData.TrainingIndices) { 140 140 double estimatedValue = estimatedValues[row]; 141 141 double targetValue = targetValues[row]; … … 150 150 } 151 151 152 foreach (int row in Content.ProblemData.TestIndi zes) {152 foreach (int row in Content.ProblemData.TestIndices) { 153 153 double estimatedValue = estimatedValues[row]; 154 154 double targetValue = targetValues[row]; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r8105 r8139 169 169 switch (cmbSamples.SelectedItem.ToString()) { 170 170 case TrainingSamples: 171 originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes);171 originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices); 172 172 break; 173 173 case TestSamples: 174 originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndi zes);174 originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices); 175 175 break; 176 176 case AllSamples: … … 234 234 235 235 private IRegressionSolution CreateConstantModel() { 236 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).Average();236 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average(); 237 237 var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData); 238 238 solution.Name = "Baseline"; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
r7259 r8139 93 93 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); 94 94 95 foreach (var row in Content.ProblemData.TrainingIndi zes) {95 foreach (var row in Content.ProblemData.TrainingIndices) { 96 96 estimated_training.MoveNext(); 97 97 values[row, 3] = estimated_training.Current.ToString(); 98 98 } 99 99 100 foreach (var row in Content.ProblemData.TestIndi zes) {100 foreach (var row in Content.ProblemData.TestIndices) { 101 101 estimated_test.MoveNext(); 102 102 values[row, 4] = estimated_test.Current.ToString(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r7406 r8139 72 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 73 73 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color; 74 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndi zes.ToArray(), Content.EstimatedTrainingValues.ToArray());74 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), Content.EstimatedTrainingValues.ToArray()); 75 75 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]); 76 76 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; … … 79 79 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 80 80 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 81 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndi zes.ToArray(), Content.EstimatedTestValues.ToArray());81 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndices.ToArray(), Content.EstimatedTestValues.ToArray()); 82 82 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]); 83 83 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 84 84 // series of remaining points 85 int[] allIndi zes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray();85 int[] allIndices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray(); 86 86 var estimatedValues = Content.EstimatedValues.ToArray(); 87 List<double> allEstimatedValues = allIndi zes.Select(index => estimatedValues[index]).ToList();87 List<double> allEstimatedValues = allIndices.Select(index => estimatedValues[index]).ToList(); 88 88 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 89 89 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 90 90 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 91 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndi zes, allEstimatedValues);91 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues); 92 92 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 93 93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; … … 170 170 171 171 int[] attr = new int[Content.ProblemData.Dataset.Rows + 1]; // add a virtual last row that is again empty to simplify loop further down 172 foreach (var row in Content.ProblemData.TrainingIndi zes) {172 foreach (var row in Content.ProblemData.TrainingIndices) { 173 173 attr[row] += 1; 174 174 } 175 foreach (var row in Content.ProblemData.TestIndi zes) {175 foreach (var row in Content.ProblemData.TestIndices) { 176 176 attr[row] += 2; 177 177 } … … 223 223 string targetVariableName = Content.ProblemData.TargetVariable; 224 224 225 IEnumerable<int> indi zes = null;225 IEnumerable<int> indices = null; 226 226 IEnumerable<double> predictedValues = null; 227 227 switch (series.Name) { 228 228 case ESTIMATEDVALUES_ALL_SERIES_NAME: 229 indi zes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray();229 indices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray(); 230 230 var estimatedValues = Content.EstimatedValues.ToArray(); 231 predictedValues = indi zes.Select(index => estimatedValues[index]).ToList();231 predictedValues = indices.Select(index => estimatedValues[index]).ToList(); 232 232 break; 233 233 case ESTIMATEDVALUES_TRAINING_SERIES_NAME: 234 indi zes = Content.ProblemData.TrainingIndizes.ToArray();234 indices = Content.ProblemData.TrainingIndices.ToArray(); 235 235 predictedValues = Content.EstimatedTrainingValues.ToArray(); 236 236 break; 237 237 case ESTIMATEDVALUES_TEST_SERIES_NAME: 238 indi zes = Content.ProblemData.TestIndizes.ToArray();238 indices = Content.ProblemData.TestIndices.ToArray(); 239 239 predictedValues = Content.EstimatedTestValues.ToArray(); 240 240 break; 241 241 } 242 series.Points.DataBindXY(indi zes, predictedValues);242 series.Points.DataBindXY(indices, predictedValues); 243 243 this.InsertEmptyPoints(series); 244 244 chart.Legends[series.Legend].ForeColor = Color.Black; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs
r7990 r8139 148 148 if (this.chart.Series[TRAINING_SERIES].Points.Count > 0) 149 149 this.chart.Series[TRAINING_SERIES].Points.DataBindXY(Content.EstimatedTrainingValues.ToArray(), "", 150 dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndi zes).ToArray(), "");150 dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndices).ToArray(), ""); 151 151 if (this.chart.Series[TEST_SERIES].Points.Count > 0) 152 152 this.chart.Series[TEST_SERIES].Points.DataBindXY(Content.EstimatedTestValues.ToArray(), "", 153 dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndi zes).ToArray(), "");153 dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndices).ToArray(), ""); 154 154 155 155 double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Max(); … … 196 196 case TRAINING_SERIES: 197 197 predictedValues = Content.EstimatedTrainingValues.ToArray(); 198 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndi zes).ToArray();198 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndices).ToArray(); 199 199 break; 200 200 case TEST_SERIES: 201 201 predictedValues = Content.EstimatedTestValues.ToArray(); 202 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndi zes).ToArray();202 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndices).ToArray(); 203 203 break; 204 204 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
r7259 r8139 148 148 public override IEnumerable<double> EstimatedTrainingClassValues { 149 149 get { 150 var rows = ProblemData.TrainingIndi zes;150 var rows = ProblemData.TrainingIndices; 151 151 var estimatedValuesEnumerators = (from model in Model.Models 152 152 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedClassValues(ProblemData.Dataset, rows).GetEnumerator() }) … … 167 167 public override IEnumerable<double> EstimatedTestClassValues { 168 168 get { 169 var rows = ProblemData.TestIndi zes;169 var rows = ProblemData.TestIndices; 170 170 var estimatedValuesEnumerators = (from model in Model.Models 171 171 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedClassValues(ProblemData.Dataset, rows).GetEnumerator() }) 172 172 .ToList(); 173 var rowsEnumerator = ProblemData.TestIndi zes.GetEnumerator();173 var rowsEnumerator = ProblemData.TestIndices.GetEnumerator(); 174 174 // aggregate to make sure that MoveNext is called for all enumerators 175 175 while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) { -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolution.cs
r7259 r8139 51 51 } 52 52 public override IEnumerable<double> EstimatedTrainingClassValues { 53 get { return GetEstimatedClassValues(ProblemData.TrainingIndi zes); }53 get { return GetEstimatedClassValues(ProblemData.TrainingIndices); } 54 54 } 55 55 public override IEnumerable<double> EstimatedTestClassValues { 56 get { return GetEstimatedClassValues(ProblemData.TestIndi zes); }56 get { return GetEstimatedClassValues(ProblemData.TestIndices); } 57 57 } 58 58 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs
r7259 r8139 87 87 protected void CalculateResults() { 88 88 double[] estimatedTrainingClassValues = EstimatedTrainingClassValues.ToArray(); // cache values 89 double[] originalTrainingClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).ToArray();89 double[] originalTrainingClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToArray(); 90 90 double[] estimatedTestClassValues = EstimatedTestClassValues.ToArray(); // cache values 91 double[] originalTestClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndi zes).ToArray();91 double[] originalTestClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices).ToArray(); 92 92 93 93 OnlineCalculatorError errorState; -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolution.cs
r7259 r8139 59 59 } 60 60 public override IEnumerable<double> EstimatedTrainingClassValues { 61 get { return GetEstimatedClassValues(ProblemData.TrainingIndi zes); }61 get { return GetEstimatedClassValues(ProblemData.TrainingIndices); } 62 62 } 63 63 public override IEnumerable<double> EstimatedTestClassValues { 64 get { return GetEstimatedClassValues(ProblemData.TestIndi zes); }64 get { return GetEstimatedClassValues(ProblemData.TestIndices); } 65 65 } 66 66 … … 82 82 } 83 83 public override IEnumerable<double> EstimatedTrainingValues { 84 get { return GetEstimatedValues(ProblemData.TrainingIndi zes); }84 get { return GetEstimatedValues(ProblemData.TrainingIndices); } 85 85 } 86 86 public override IEnumerable<double> EstimatedTestValues { 87 get { return GetEstimatedValues(ProblemData.TestIndi zes); }87 get { return GetEstimatedValues(ProblemData.TestIndices); } 88 88 } 89 89 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolutionBase.cs
r7259 r8139 103 103 protected void CalculateRegressionResults() { 104 104 double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values 105 double[] originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes).ToArray();105 double[] originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToArray(); 106 106 double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values 107 double[] originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndi zes).ToArray();107 double[] originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices).ToArray(); 108 108 109 109 OnlineCalculatorError errorState; … … 140 140 double[] classValues; 141 141 double[] thresholds; 142 var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes);142 var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices); 143 143 AccuracyMaximizationThresholdCalculator.CalculateThresholds(ProblemData, EstimatedTrainingValues, targetClassValues, out classValues, out thresholds); 144 144 … … 149 149 double[] classValues; 150 150 double[] thresholds; 151 var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes);151 var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices); 152 152 NormalDistributionCutPointsThresholdCalculator.CalculateThresholds(ProblemData, EstimatedTrainingValues, targetClassValues, out classValues, out thresholds); 153 153 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringSolution.cs
r7259 r8139 68 68 public virtual IEnumerable<int> TrainingClusterValues { 69 69 get { 70 return GetClusterValues(ProblemData.TrainingIndi zes);70 return GetClusterValues(ProblemData.TrainingIndices); 71 71 } 72 72 } … … 74 74 public virtual IEnumerable<int> TestClusterValues { 75 75 get { 76 return GetClusterValues(ProblemData.TestIndi zes);76 return GetClusterValues(ProblemData.TestIndices); 77 77 } 78 78 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r7265 r8139 75 75 } 76 76 77 public virtual IEnumerable<int> TrainingIndi zes {77 public virtual IEnumerable<int> TrainingIndices { 78 78 get { 79 79 return Enumerable.Range(TrainingPartition.Start, Math.Max(0, TrainingPartition.End - TrainingPartition.Start)) … … 81 81 } 82 82 } 83 public virtual IEnumerable<int> TestIndi zes {83 public virtual IEnumerable<int> TestIndices { 84 84 get { 85 85 return Enumerable.Range(TestPartition.Start, Math.Max(0, TestPartition.End - TestPartition.Start)) -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r7738 r8139 153 153 public override IEnumerable<double> EstimatedTrainingValues { 154 154 get { 155 var rows = ProblemData.TrainingIndi zes;155 var rows = ProblemData.TrainingIndices; 156 156 var estimatedValuesEnumerators = (from model in Model.Models 157 157 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() }) … … 172 172 public override IEnumerable<double> EstimatedTestValues { 173 173 get { 174 var rows = ProblemData.TestIndi zes;174 var rows = ProblemData.TestIndices; 175 175 var estimatedValuesEnumerators = (from model in Model.Models 176 176 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() }) 177 177 .ToList(); 178 var rowsEnumerator = ProblemData.TestIndi zes.GetEnumerator();178 var rowsEnumerator = ProblemData.TestIndices.GetEnumerator(); 179 179 // aggregate to make sure that MoveNext is called for all enumerators 180 180 while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) { -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r7735 r8139 55 55 } 56 56 public override IEnumerable<double> EstimatedTrainingValues { 57 get { return GetEstimatedValues(ProblemData.TrainingIndi zes); }57 get { return GetEstimatedValues(ProblemData.TrainingIndices); } 58 58 } 59 59 public override IEnumerable<double> EstimatedTestValues { 60 get { return GetEstimatedValues(ProblemData.TestIndi zes); }60 get { return GetEstimatedValues(ProblemData.TestIndices); } 61 61 } 62 62 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs
r7735 r8139 138 138 OnlineCalculatorError errorState; 139 139 Add(new Result(TrainingMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the training partition", new DoubleValue())); 140 double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes), out errorState);140 double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices), out errorState); 141 141 TrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMAE : double.NaN; 142 142 } … … 145 145 OnlineCalculatorError errorState; 146 146 Add(new Result(TestMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the test partition", new DoubleValue())); 147 double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndi zes), out errorState);147 double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices), out errorState); 148 148 TestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN; 149 149 } … … 152 152 OnlineCalculatorError errorState; 153 153 Add(new Result(TrainingMeanErrorResultName, "Mean of errors of the model on the training partition", new DoubleValue())); 154 double trainingME = OnlineMeanErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes), out errorState);154 double trainingME = OnlineMeanErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices), out errorState); 155 155 TrainingMeanError = errorState == OnlineCalculatorError.None ? trainingME : double.NaN; 156 156 } … … 158 158 OnlineCalculatorError errorState; 159 159 Add(new Result(TestMeanErrorResultName, "Mean of errors of the model on the test partition", new DoubleValue())); 160 double testME = OnlineMeanErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndi zes), out errorState);160 double testME = OnlineMeanErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices), out errorState); 161 161 TestMeanError = errorState == OnlineCalculatorError.None ? testME : double.NaN; 162 162 } … … 166 166 protected void CalculateResults() { 167 167 IEnumerable<double> estimatedTrainingValues = EstimatedTrainingValues; // cache values 168 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndi zes);168 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices); 169 169 IEnumerable<double> estimatedTestValues = EstimatedTestValues; // cache values 170 IEnumerable<double> originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndi zes);170 IEnumerable<double> originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices); 171 171 172 172 OnlineCalculatorError errorState; -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs
r7259 r8139 36 36 IntRange TestPartition { get; } 37 37 38 IEnumerable<int> TrainingIndi zes { get; }39 IEnumerable<int> TestIndi zes { get; }38 IEnumerable<int> TrainingIndices { get; } 39 IEnumerable<int> TestIndices { get; } 40 40 41 41 bool IsTrainingSample(int index);
Note: See TracChangeset
for help on using the changeset viewer.