Changeset 12660


Ignore:
Timestamp:
07/07/15 17:46:58 (4 years ago)
Author:
gkronber
Message:

#2261: minor change if(!rows.Any()) return ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs

    r12591 r12660  
    6363    public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
    6464      // allocate target array go over all models and add up weighted estimation for each row
     65      if (!rows.Any()) return Enumerable.Empty<double>(); // return immediately if rows is empty. This prevents multiple iteration over lazy rows enumerable.
     66                                                          // (which essentially looks up indexes in a dictionary)
    6567      var res = new double[rows.Count()];
    66       if (res.Length == 0) return res; // return immediately if rows is empty. This prevents multiple iteration over lazy rows enumerable.
    67                                        // (which essentially looks up indexes in a dictionary)
    6868      for (int i = 0; i < models.Count; i++) {
    6969        var w = weights[i];
Note: See TracChangeset for help on using the changeset viewer.