- Timestamp:
- 06/27/12 17:34:17 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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)))
Note: See TracChangeset
for help on using the changeset viewer.