Changeset 8139 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs
- Timestamp:
- 06/27/12 17:34:17 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.