Changeset 8139 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 06/27/12 17:34:17 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 15 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)));
Note: See TracChangeset
for help on using the changeset viewer.