Packages

class LightGBMBooster extends Serializable

Represents a LightGBM Booster learner

Annotations
@SerialVersionUID()
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LightGBMBooster
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LightGBMBooster(model: String)

    Represents a LightGBM Booster learner

    Represents a LightGBM Booster learner

    model

    The string serialized representation of the learner

  2. new LightGBMBooster(trainDataset: LightGBMDataset, parameters: String)

    Represents a LightGBM Booster learner

    Represents a LightGBM Booster learner

    trainDataset

    The training dataset

    parameters

    The booster initialization parameters

  3. new LightGBMBooster(trainDataset: Option[LightGBMDataset] = None, parameters: Option[String] = None, modelStr: Option[String] = None)

    trainDataset

    The training dataset

    parameters

    The booster initialization parameters

    modelStr

    Optional parameter with the string serialized representation of the learner

Value Members

  1. def addValidationDataset(dataset: LightGBMDataset): Unit

    Adds the specified LightGBMDataset to be the validation dataset.

    Adds the specified LightGBMDataset to be the validation dataset.

    dataset

    The LightGBMDataset to add as the validation dataset.

  2. var bestIteration: Int
  3. lazy val boosterHandler: BoosterHandler
    Annotations
    @transient()
  4. def dumpModel(session: SparkSession, filename: String, overwrite: Boolean): Unit

    Dumps the native model pointer to file.

    Dumps the native model pointer to file.

    session

    The spark session

    filename

    The name of the file to save the model to

    overwrite

    Whether to overwrite if the file already exists

  5. def featuresShap(features: Vector): Array[Double]
  6. def freeNativeMemory(): Unit

    Frees any native memory held by the underlying booster pointer.

  7. def getEvalNames: Array[String]

    Get the evaluation dataset column names from the native booster.

    Get the evaluation dataset column names from the native booster.

    returns

    The evaluation dataset column names.

  8. def getEvalResults(evalNames: Array[String], dataIndex: Int): Array[(String, Double)]

    Get the evaluation for the training data and validation data.

    Get the evaluation for the training data and validation data.

    evalNames

    The names of the evaluation metrics.

    dataIndex

    Index of data, 0: training data, 1: 1st validation data, 2: 2nd validation data and so on.

    returns

    Array of tuples containing the evaluation metric name and metric value.

  9. def getFeatureImportances(importanceType: String): Array[Double]

    Calls into LightGBM to retrieve the feature importances.

    Calls into LightGBM to retrieve the feature importances.

    importanceType

    Can be "split" or "gain"

    returns

    The feature importance values as an array.

  10. def getNativeModel(): String

    Gets the native model serialized representation as a string.

  11. def innerPredict(dataIndex: Int, classification: Boolean): Array[Array[Double]]

    Get predictions for the training and evaluation data on the booster.

    Get predictions for the training and evaluation data on the booster.

    dataIndex

    Index of data, 0: training data, 1: 1st validation data, 2: 2nd validation data and so on.

    classification

    Whether this is a classification scenario or not.

    returns

    The predictions as a 2D array where first level is for row index and second level is optional if there are classes.

  12. def mergeBooster(model: String): Unit

    Merges this Booster with the specified model.

    Merges this Booster with the specified model.

    model

    The string serialized representation of the learner to merge.

  13. val modelStr: Option[String]
  14. lazy val numClasses: Int
  15. lazy val numFeatures: Int
  16. lazy val numModelPerIteration: Int
  17. lazy val numTotalIterations: Int
  18. lazy val numTotalModel: Int
  19. val parameters: Option[String]
  20. def predictLeaf(features: Vector): Array[Double]
  21. def resetParameter(newParameters: String): Unit

    Reset the specified parameters on the native booster.

    Reset the specified parameters on the native booster.

    newParameters

    The new parameters to set.

  22. def saveNativeModel(session: SparkSession, filename: String, overwrite: Boolean): Unit

    Saves the native model serialized representation to file.

    Saves the native model serialized representation to file.

    session

    The spark session

    filename

    The name of the file to save the model to

    overwrite

    Whether to overwrite if the file already exists

  23. def saveToString(upToIteration: Option[Int] = None): String

    Saves the booster to string representation.

    Saves the booster to string representation.

    upToIteration

    The zero-based index of the iteration to save as the last one (ignoring the rest).

    returns

    The serialized string representation of the Booster.

  24. def score(features: Vector, raw: Boolean, classification: Boolean, disableShapeCheck: Boolean): Array[Double]
  25. def setBestIteration(bestIteration: Int): Unit

    Sets the best iteration and also the numIterations to be the best iteration.

    Sets the best iteration and also the numIterations to be the best iteration.

    bestIteration

    The best iteration computed by early stopping.

  26. def setNumIterations(numIterations: Int): Unit

    Sets the total number of iterations used in the prediction.

    Sets the total number of iterations used in the prediction. If <= 0, all iterations from start_iteration are used (no limits).

    numIterations

    The total number of iterations used in the prediction.

  27. def setStartIteration(startIteration: Int): Unit

    Sets the start index of the iteration to predict.

    Sets the start index of the iteration to predict. If <= 0, starts from the first iteration.

    startIteration

    The start index of the iteration to predict.

  28. val trainDataset: Option[LightGBMDataset]
  29. def updateOneIteration(): Boolean

    Updates the booster for one iteration.

    Updates the booster for one iteration.

    returns

    True if terminated training early.

  30. def updateOneIterationCustom(gradient: Array[Float], hessian: Array[Float]): Boolean

    Updates the booster with custom loss function for one iteration.

    Updates the booster with custom loss function for one iteration.

    gradient

    The gradient from custom loss function.

    hessian

    The hessian matrix from custom loss function.

    returns

    True if terminated training early.