class LightGBMBooster extends Serializable
Represents a LightGBM Booster learner
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- LightGBMBooster
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
LightGBMBooster(model: String)
Represents a LightGBM Booster learner
Represents a LightGBM Booster learner
- model
The string serialized representation of the learner
-
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
-
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
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- var bestIteration: Int
-
lazy val
boosterHandler: BoosterHandler
- Annotations
- @transient()
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
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
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def featuresShap(features: Vector): Array[Double]
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
freeNativeMemory(): Unit
Frees any native memory held by the underlying booster pointer.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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.
-
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.
-
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.
-
def
getNativeModel(): String
Gets the native model serialized representation as a string.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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.
- val modelStr: Option[String]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- lazy val numClasses: Int
- lazy val numFeatures: Int
- lazy val numModelPerIteration: Int
- lazy val numTotalIterations: Int
- lazy val numTotalModel: Int
- val parameters: Option[String]
-
def
predictForCSR(sparseVector: SparseVector, kind: Int, disableShapeCheck: Boolean, dataLengthLongPtr: SWIGTYPE_p_long_long, dataOutPtr: SWIGTYPE_p_double): Unit
- Attributes
- protected
-
def
predictForMat(row: Array[Double], kind: Int, disableShapeCheck: Boolean, dataLengthLongPtr: SWIGTYPE_p_long_long, dataOutPtr: SWIGTYPE_p_double): Unit
- Attributes
- protected
- def predictLeaf(features: Vector): Array[Double]
-
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.
-
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
-
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.
- def score(features: Vector, raw: Boolean, classification: Boolean, disableShapeCheck: Boolean): Array[Double]
-
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.
-
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
are used (no limits).start_iteration
- numIterations
The total number of iterations used in the prediction.
-
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.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- val trainDataset: Option[LightGBMDataset]
-
def
updateOneIteration(): Boolean
Updates the booster for one iteration.
Updates the booster for one iteration.
- returns
True if terminated training early.
-
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.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()