Changeset 6740 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 09/12/11 13:48:31 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs
r6002 r6740 31 31 32 32 double[,] matrix = new double[rowsList.Count, variablesList.Count]; 33 for (int row = 0; row < rowsList.Count; row++) { 34 int col = 0; 35 foreach (string column in variables) { 36 matrix[row, col] = dataset[column, rowsList[row]]; 37 col++; 33 34 int col = 0; 35 foreach (string column in variables) { 36 var values = dataset.GetDoubleValues(column, rows); 37 int row = 0; 38 foreach (var value in values) { 39 matrix[row, col] = value; 40 row++; 38 41 } 42 col++; 39 43 } 44 40 45 return matrix; 41 46 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs
r6649 r6740 78 78 int nRows = inputMatrix.GetLength(0); 79 79 int nFeatures = inputMatrix.GetLength(1) - 1; 80 double[] classValues = dataset.Get VariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();80 double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray(); 81 81 int nClasses = classValues.Count(); 82 82 // map original class values to values [0..nClasses-1] -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs
r6649 r6740 96 96 int nRows = inputMatrix.GetLength(0); 97 97 int nFeatures = inputMatrix.GetLength(1) - 1; 98 double[] classValues = dataset.Get VariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();98 double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray(); 99 99 int nClasses = classValues.Count(); 100 100 // map original class values to values [0..nClasses-1] -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs
r6720 r6740 192 192 int nRows = inputMatrix.GetLength(0); 193 193 int nFeatures = inputMatrix.GetLength(1) - 1; 194 double[] classValues = dataset.Get VariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();194 double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray(); 195 195 int nClasses = classValues.Count(); 196 196 // map original class values to values [0..nClasses-1] -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs
r6720 r6740 178 178 int nRows = inputMatrix.GetLength(0); 179 179 int nFeatures = inputMatrix.GetLength(1) - 1; 180 double[] classValues = dataset.Get VariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();180 double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray(); 181 181 int nClasses = classValues.Count(); 182 182 // map original class values to values [0..nClasses-1] -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs
r6649 r6740 108 108 int nCols = inputMatrix.GetLength(1); 109 109 int info; 110 double[] classValues = dataset.Get VariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();110 double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray(); 111 111 int nClasses = classValues.Count(); 112 112 // map original class values to values [0..nClasses-1] -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs
r6002 r6740 34 34 public static SVM.Problem CreateSvmProblem(Dataset dataset, string targetVariable, IEnumerable<string> inputVariables, IEnumerable<int> rowIndices) { 35 35 double[] targetVector = 36 dataset.GetEnumeratedVariableValues(targetVariable, rowIndices) 37 .ToArray(); 36 dataset.GetDoubleValues(targetVariable, rowIndices).ToArray(); 38 37 39 38 SVM.Node[][] nodes = new SVM.Node[targetVector.Length][]; … … 46 45 int colIndex = 1; // make sure the smallest node index for SVM = 1 47 46 foreach (var inputVariable in inputVariablesList) { 48 double value = dataset [row, dataset.GetVariableIndex(inputVariable)];47 double value = dataset.GetDoubleValue(inputVariable, row); 49 48 // SVM also works with missing values 50 49 // => don't add NaN values in the dataset to the sparse SVM matrix representation -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringUtil.cs
r5809 r6740 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using HeuristicLab.Problems.DataAnalysis; 25 using System;26 26 27 27 namespace HeuristicLab.Algorithms.DataAnalysis { … … 42 42 int col = 0; 43 43 foreach (var inputVariable in allowedInputVariables) { 44 double d = center[col++] - dataset [inputVariable, row];44 double d = center[col++] - dataset.GetDoubleValue(inputVariable, row); 45 45 d = d * d; // square; 46 46 centerDistance += d; … … 73 73 double[] p = new double[allowedInputVariables.Count]; 74 74 for (int i = 0; i < nCols; i++) { 75 p[i] = dataset [allowedInputVariables[i], row];75 p[i] = dataset.GetDoubleValue(allowedInputVariables[i], row); 76 76 } 77 77 clusterPoints[clusterValues[clusterValueIndex++]].Add(p);
Note: See TracChangeset
for help on using the changeset viewer.