Changeset 14240 for branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs
- Timestamp:
- 08/05/16 18:44:51 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs
r14237 r14240 75 75 var doubleVariables = allowedInputVariables.Where(dataset.VariableHasType<double>); 76 76 var factorVariableNames = allowedInputVariables.Where(dataset.VariableHasType<string>); 77 var factorVariables = from factor in factorVariableNames 78 let distinctValues = dataset.GetStringValues(factor, rows).Distinct().ToArray() 79 // 1 distinct value => skip (constant) 80 // 2 distinct values => only take one of the two values 81 // >=3 distinct values => create a binary value for each value 82 let reducedValues = distinctValues.Length <= 2 83 ? distinctValues.Take(distinctValues.Length - 1) 84 : distinctValues 85 select new KeyValuePair<string, IEnumerable<string>>(factor, reducedValues); 77 var factorVariables = AlglibUtil.GetFactorVariableValues(dataset, factorVariableNames, rows); 86 78 double[,] binaryMatrix = AlglibUtil.PrepareInputMatrix(dataset, factorVariables, rows); 87 79 double[,] doubleVarMatrix = AlglibUtil.PrepareInputMatrix(dataset, doubleVariables.Concat(new string[] { targetVariable }), rows);
Note: See TracChangeset
for help on using the changeset viewer.