public class GradientBoostingModelObject extends Object implements Serializable
This class extracts the decision trees and other necessary parameters from a trained gradient boosting model for the purpose of predicting a new data set separately from the original training data.
| Constructor and Description |
|---|
GradientBoostingModelObject(GradientBoosting gbm)
Constructs the GradientBoostingModelObject.
|
| Modifier and Type | Method and Description |
|---|---|
double[][] |
getClassPredictorValues()
Returns the predictor function values \(\{f(x_i)\}\) on the test data for a
categorical (binomial or multinomial) response variable.
|
double[][] |
getClassProbabilities()
Returns the predicted probabilities on the test data for a categorical
response variable.
|
double[] |
getContinuousPredictorValues()
Returns the predictor function values \(\{f(x_i)\}\) for a continuous
response variable on the test data.
|
int |
getPrintLevel()
Returns the current print level.
|
double |
getTestLossValue()
Returns the value of the loss function on the test data.
|
double[] |
predict(double[][] testData)
Returns the predictions on the test data.
|
double[] |
predict(double[][] testData,
double[] testDataWeights)
Returns the predictions on the test data using data weights.
|
void |
setMissingTestYFlag(boolean missingTestY)
Sets the flag for whether or not the test data has missing response
values.
|
void |
setPrintLevel(int printLevel)
Sets the print level.
|
public GradientBoostingModelObject(GradientBoosting gbm)
gbm - a previously trained GradientBoosting modelpublic double[] predict(double[][] testData)
throws PredictiveModel.PredictiveModelException
testData - a double matrix containing the data. It must
be compatible with the original training data (it must have the same
variable types and column orders).double array containing the predictionsPredictiveModel.PredictiveModelExceptionpublic double[] predict(double[][] testData,
double[] testDataWeights)
throws PredictiveModel.PredictiveModelException
testData - a double matrix containing the data. It must
be compatible with the original training data (it must have the same
variable types and column orders).testDataWeights - a double array containing weights for
each row of testData. The weights must be non-negative.double array containing the predictionsPredictiveModel.PredictiveModelExceptionpublic double getTestLossValue()
The result will be NaN if the test data response variable is
missing (the default).
double, the value of the loss function.public double[][] getClassPredictorValues()
double matrix containing the predictor function
valuespublic double[] getContinuousPredictorValues()
double array containing the predictor function
valuespublic double[][] getClassProbabilities()
double matrix containing the class probabilities
on the test data. The i,k-th element of the matrix is the
estimated probability that the observation at row index i
belongs to the k+1-st class, where k=0,...,
nClasses-1.public void setMissingTestYFlag(boolean missingTestY)
true (the methods will assume the
response values are not present). If the response variable is not
missing, the value of the loss function on the test data can be
calculated.missingTestY - a boolean indicating whether or not the
test data response variable is missingpublic int getPrintLevel()
int, the current print levelpublic void setPrintLevel(int printLevel)
When printLevel>0 and the response values are non-missing,
the loss function values for each iteration are printed. The default is
printLevel=0.
printLevel - an int specifying the print levelCopyright © 2022 Rogue Wave Software. All rights reserved.