Class GradientBoosting

java.lang.Object
ai.beestream.jitnn.ml.GradientBoosting

public final class GradientBoosting extends Object
Gradient-boosted trees with second-order (Newton) leaves on binned features, after scikit-learn's HistGradientBoosting and XGBoost: squared error for regression, the logistic loss for two classes and the softmax loss (one tree per class and round) for more. Gradients are computed on the device each round; the trees are grown as in RandomForest.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GradientBoosting(boolean classification, int rounds, float learningRate, int maxDepth)
    Boosting with scikit-learn's defaults for the rest: 20 samples per leaf, no L2 penalty, 255 bins.
    GradientBoosting(boolean classification, int rounds, float learningRate, int maxDepth, int minSamplesLeaf, float lambda, int maxBins)
    Boosting for classification or regression: rounds trees of depth at most maxDepth, shrunk by learningRate, with at least minSamplesLeaf samples per leaf, L2 penalty lambda on the leaf values, and features in at most maxBins bins.
  • Method Summary

    Modifier and Type
    Method
    Description
    Raw scores [m, outputs]: the baseline plus every tree.
    fit(Tensor x, int[] y)
    Fits a classifier to samples x [n, features] and labels y.
    fit(Tensor x, Tensor y)
    Regression targets [n].
    int[]
    The most probable label of each sample.
    Class probabilities [n, classes] for samples x.
    Regression predictions [m].

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GradientBoosting

      public GradientBoosting(boolean classification, int rounds, float learningRate, int maxDepth, int minSamplesLeaf, float lambda, int maxBins)
      Boosting for classification or regression: rounds trees of depth at most maxDepth, shrunk by learningRate, with at least minSamplesLeaf samples per leaf, L2 penalty lambda on the leaf values, and features in at most maxBins bins.
    • GradientBoosting

      public GradientBoosting(boolean classification, int rounds, float learningRate, int maxDepth)
      Boosting with scikit-learn's defaults for the rest: 20 samples per leaf, no L2 penalty, 255 bins.
  • Method Details

    • fit

      public GradientBoosting fit(Tensor x, int[] y)
      Fits a classifier to samples x [n, features] and labels y.
    • fit

      public GradientBoosting fit(Tensor x, Tensor y)
      Regression targets [n].
    • decisionFunction

      public Tensor decisionFunction(Tensor x)
      Raw scores [m, outputs]: the baseline plus every tree.
    • predictValues

      public Tensor predictValues(Tensor x)
      Regression predictions [m].
    • predictProba

      public Tensor predictProba(Tensor x)
      Class probabilities [n, classes] for samples x.
    • predict

      public int[] predict(Tensor x)
      The most probable label of each sample.