Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/16 17:45:45 (8 years ago)
Author:
pfleck
Message:

#2631

  • Added an additional function to ALGLIB that returns the prediction for each tree of a decision forest.
  • Implemented IConfidenceRegression/Solution for RandomForestModel/Solution using the variance of the predictions from the trees.
Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IRandomForestModel.cs

    r12012 r14107  
    2929  /// Interface to represent a random forest model for either regression or classification
    3030  /// </summary>
    31   public interface IRandomForestModel : IRegressionModel, IClassificationModel {
     31  public interface IRandomForestModel : IConfidenceRegressionModel, IClassificationModel {
    3232  }
    3333}
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IRandomForestRegressionSolution.cs

    r12012 r14107  
    2828  /// Interface to represent a random forest regression solution
    2929  /// </summary>
    30   public interface IRandomForestRegressionSolution : IRegressionSolution {
     30  public interface IRandomForestRegressionSolution : IConfidenceRegressionSolution {
    3131    new IRandomForestModel Model { get; }
    3232  }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModel.cs

    r13941 r14107  
    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[columns];
     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);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegressionSolution.cs

    r13941 r14107  
    3131  [Item("RandomForestRegressionSolution", "Represents a random forest solution for a regression problem which can be visualized in the GUI.")]
    3232  [StorableClass]
    33   public sealed class RandomForestRegressionSolution : RegressionSolution, IRandomForestRegressionSolution {
     33  public sealed class RandomForestRegressionSolution : ConfidenceRegressionSolution, IRandomForestRegressionSolution {
    3434
    3535    public new IRandomForestModel Model {
Note: See TracChangeset for help on using the changeset viewer.