predict

The CatBoost Java package provides several methods for applying a model to different types of objects and input features.

Note

The model prediction results will be correct only if the numeric and categorical features parameters contain all the features used in the model in the same order.

Batch of objects, matrix of numerical features, matrix of hashes of categorical features, new object with model predictions

public CatBoostPredictions predict(float[][] numericFeatures,
                                   int[][] catFeatureHashes)

Modifier and type

CatBoostPredictions

Purpose

Apply the model to a batch of objects. Uses a matrix of numerical features and a matrix of hashes of categorical features.

Parameters

numericFeatures

A matrix of input numerical features.

catFeatureHashes

A matrix of hashes of input categorical features. These hashes must be computed by the hashCategoricalFeature(String) function.

Returns

CatBoostPredictions with predictions for a batch of objects.

Throws

CatBoostError — In case of errors in the native library.

Batch of objects, matrix of numerical features, matrix of hashes of categorical features, specified object with model predictions

public void predict(float[][] numericFeatures,
                    int[][] catFeatureHashes,
                    CatBoostPredictions prediction)

Modifier and type

void

Purpose

Apply the model to a batch of objects. Uses a matrix of numerical features and a matrix of hashes of categorical features.

Parameters

numericFeatures

A matrix of input numerical features.

catFeatureHashes

A matrix of hashes of input categorical features. These hashes must be computed by the hashCategoricalFeature(String) function.

prediction

The model's predictions.

Returns

CatBoostPredictions with predictions for a batch of objects.

Throws

CatBoostError — In case of errors in the native library.

Batch of objects, matrix of numerical features, matrix of categorical features, new object with model predictions

public CatBoostPredictions predict(float[][] numericFeatures,
                                   String[][] catFeatures)

Modifier and type

CatBoostPredictions

Purpose

Apply the model to a batch of objects. Uses a matrix of numerical features and a matrix of categorical features.

Parameters

numericFeatures

An array of input numerical features.

catFeatures

A matrix of input categorical features.

Returns

CatBoostPredictions with predictions for a batch of objects.

Throws

CatBoostError — In case of errors in the native library.

Batch of objects, matrix of numerical features, matrix of categorical features, specified object with model predictions

public void predict(float[][] numericFeatures,
                    String[][] catFeatures,
                    CatBoostPredictions prediction)

Modifier and type

void

Purpose

Apply the model to a batch of objects. Uses a matrix of numerical features.

Parameters

numericFeatures

A matrix of input numerical features.

catFeatures

A matrix of input categorical features.

prediction

The model's predictions.

Returns

CatBoostPredictions with predictions for a batch of objects.

Throws

CatBoostError — In case of errors in the native library.

Object, array of numerical features, array of hashes of categorical features, new object with model predictions

public CatBoostPredictions predict(float[] numericFeatures,
                                   int[] catFeatureHashes)

Modifier and type

CatBoostPredictions

Purpose

Apply the model to an object defined by features. Uses an array of numerical features and an array of hashes of categorical features.

Parameters

numericFeatures

An array of input numerical features.

catFeatureHashes

An array of hashes of input categorical features. These hashes must be computed by the hashCategoricalFeature(String) function.

Returns

CatBoostPredictions with the prediction for the specified object.

Throws

CatBoostError — In case of errors in the native library.

Object, array of numerical features, array of hashes of categorical features, specified object with model predictions

public void predict(float[] numericFeatures,
                    int[] catFeatureHashes,
                    CatBoostPredictions prediction)

Modifier and type

void

Purpose

Apply the model to an object defined by features. Uses an array of hashes of categorical features computed by the hashCategoricalFeature(String) function.

Parameters

numericFeatures

An array of input numerical features.

catFeatureHashes

An array of hashes of input categorical features. These hashes must be computed by the hashCategoricalFeature(String) function.

prediction

The model's predictions.

Returns

CatBoostPredictions with the prediction for the specified object.

Throws

CatBoostError — In case of errors in the native library.

Object, array of numerical features, array of categorical features, new object with model predictions

predict(float[] numericFeatures, 
        String[] catFeatures)

Modifier and type

CatBoostPredictions

Purpose

Apply the model to an object defined by features.

Parameters

numericFeatures

An array of input numerical features.

catFeatures

An array of input categorical features.

Returns

CatBoostPredictions with the prediction for the specified object.

Throws

CatBoostError — In case of errors in the native library.

Object, array of numerical features, array of categorical features, specified object with model predictions

predict(float[] numericFeatures, 
        String[] catFeatures, 
        CatBoostPredictions prediction)

Modifier and type

void

Purpose

Apply the model to an object defined by features.

Parameters

numericFeatures

An array of input numerical features.

catFeatures

An array of input categorical features.

prediction

The model's predictions.

Returns

CatBoostPredictions with the prediction for the specified object.

Throws

CatBoostError — In case of errors in the native library.