- Timestamp:
- 04/15/11 14:54:43 (14 years ago)
- Location:
- branches/histogram
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/histogram
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 5962-5963,5971-5972,5975-5976,5983-5984,5987,5993,5997-5998,6002-6003,6009
- Property svn:mergeinfo changed
-
branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs
r5809 r6011 41 41 int maxNodeIndex = 0; 42 42 int svmProblemRowIndex = 0; 43 List<string> inputVariablesList = inputVariables.ToList(); 43 44 foreach (int row in rowIndices) { 44 45 tempRow = new List<SVM.Node>(); 45 foreach (var inputVariable in inputVariables) { 46 int col = dataset.GetVariableIndex(inputVariable); 47 double value = dataset[row, col]; 46 int colIndex = 1; // make sure the smallest node index for SVM = 1 47 foreach (var inputVariable in inputVariablesList) { 48 double value = dataset[row, dataset.GetVariableIndex(inputVariable)]; 49 // SVM also works with missing values 50 // => don't add NaN values in the dataset to the sparse SVM matrix representation 48 51 if (!double.IsNaN(value)) { 49 int nodeIndex = col + 1; // make sure the smallest nodeIndex is 1 (libSVM convention) 50 tempRow.Add(new SVM.Node(nodeIndex, value)); 51 if (nodeIndex > maxNodeIndex) maxNodeIndex = nodeIndex; 52 tempRow.Add(new SVM.Node(colIndex, value)); // nodes must be sorted in ascending ordered by column index 53 if (colIndex > maxNodeIndex) maxNodeIndex = colIndex; 52 54 } 55 colIndex++; 53 56 } 54 nodes[svmProblemRowIndex++] = tempRow. OrderBy(x => x.Index).ToArray(); // make sure the values are sorted by node index57 nodes[svmProblemRowIndex++] = tempRow.ToArray(); 55 58 } 56 59
Note: See TracChangeset
for help on using the changeset viewer.