Changeset 14844


Ignore:
Timestamp:
04/11/17 16:13:16 (4 months ago)
Author:
gkronber
Message:

#745 ordered rows for coefficients in data-table by total absolute value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/ElasticNetLinearRegression.cs

    r14674 r14844  
    145145        var path = Enumerable.Range(0, nLambdas).Select(r => Tuple.Create(lambda[r], coeff[r, i] * sigma)).ToArray();
    146146        dataRows[i] = new IndexedDataRow<double>(coeffId, coeffId, path);
    147         coeffTable.Rows.Add(dataRows[i]);
    148       }
     147      }
     148      // add to coeffTable by total weight (larger area under the curve => more important);
     149      foreach (var r in dataRows.OrderByDescending(r => r.Values.Select(t => t.Item2).Sum(x => Math.Abs(x)))) {
     150        coeffTable.Rows.Add(r);
     151      }
     152
    149153      for (int i = 0; i < coeff.GetLength(0); i++) {
    150154        for (int j = 0; j < coeff.GetLength(1); j++) {
Note: See TracChangeset for help on using the changeset viewer.