Changeset 9451 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 05/06/13 17:18:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Nca/Initialization/LdaInitializer.cs
r9272 r9451 48 48 data.TrainingIndices); 49 49 50 var uniqueClasses = data.Dataset.GetDoubleValues(data.TargetVariable, data.TrainingIndices).Distinct().Count(); 50 // map class values to sequential natural numbers (required by alglib) 51 var uniqueClasses = data.Dataset.GetDoubleValues(data.TargetVariable, data.TrainingIndices) 52 .Distinct() 53 .Select((v, i) => new { v, i }) 54 .ToDictionary(x => x.v, x => x.i); 55 56 for (int row = 0; row < instances; row++) 57 ldaDs[row, attributes] = uniqueClasses[ldaDs[row, attributes]]; 51 58 52 59 int info; 53 60 double[,] matrix; 54 alglib.fisherldan(ldaDs, instances, attributes, uniqueClasses , out info, out matrix);61 alglib.fisherldan(ldaDs, instances, attributes, uniqueClasses.Count, out info, out matrix); 55 62 56 63 return matrix;
Note: See TracChangeset
for help on using the changeset viewer.