Ignore:
Timestamp:
04/04/17 13:59:42 (2 years ago)
Author:
gkronber
Message:

#2631: merged r14107 and r14230 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModel.cs

    r14186 r14822  
    152152    }
    153153
     154    public IEnumerable<double> GetEstimatedVariances(IDataset dataset, IEnumerable<int> rows) {
     155      double[,] inputData = AlglibUtil.PrepareInputMatrix(dataset, AllowedInputVariables, rows);
     156      AssertInputMatrix(inputData);
     157
     158      int n = inputData.GetLength(0);
     159      int columns = inputData.GetLength(1);
     160      double[] x = new double[columns];
     161      double[] ys = new double[this.RandomForest.innerobj.ntrees];
     162
     163      for (int row = 0; row < n; row++) {
     164        for (int column = 0; column < columns; column++) {
     165          x[column] = inputData[row, column];
     166        }
     167        alglib.dforest.dfprocessraw(RandomForest.innerobj, x, ref ys);
     168        yield return ys.VariancePop();
     169      }
     170    }
     171
    154172    public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
    155173      double[,] inputData = AlglibUtil.PrepareInputMatrix(dataset, AllowedInputVariables, rows);
Note: See TracChangeset for help on using the changeset viewer.