---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.3
alternate:
  - https://catboost.ai/docs/en/concepts/java-reference_catboostmodel__predict.md
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# predict

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

{% note info %}

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.

{% endnote %}

## Batch of objects, matrix of numerical features, matrix of hashes of categorical features, new object with model predictions {#batch-of-object-matrix-of-numerical-features-matrix-of-hashes-of-catfeatures-new-object}

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

#### Modifier and type

[CatBoostPredictions](https://catboost.ai/docs/en/concepts/java-reference_catboostpredictions.md)

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeaturehashes.md -->
Apply the model to a batch of objects. Uses a matrix of numerical features and a matrix of hashes of categorical features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeaturehashes.md -->


#### 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

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->
`CatBoostPredictions` with predictions for a batch of objects.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Batch of objects, matrix of numerical features, matrix of hashes of categorical features, specified object with model predictions {#batch-of-object-matrix-of-numerical-features-matrix-of-hashes-of-catfeatures-object-from-the-constructor}

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

#### Modifier and type

void

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeaturehashessprediction.md -->
Apply the model to a batch of objects. Uses a matrix of numerical features and a matrix of hashes of categorical features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeaturehashessprediction.md -->


#### 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

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->
`CatBoostPredictions` with predictions for a batch of objects.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Batch of objects, matrix of numerical features, matrix of categorical features, new object with model predictions {#batch-of-objects-matrixnumfeatures-matrixcatfeatures-newobject}

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

#### Modifier and type

[CatBoostPredictions](https://catboost.ai/docs/en/concepts/java-reference_catboostpredictions.md)

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeatures.md -->
Apply the model to a batch of objects. Uses a matrix of numerical features and a matrix of categorical features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeatures.md -->


#### Parameters

**numericFeatures**

An array of input numerical features.

**catFeatures**

A matrix of input categorical features.


#### Returns

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->
`CatBoostPredictions` with predictions for a batch of objects.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Batch of objects, matrix of numerical features, matrix of categorical features, specified object with model predictions {#batch-of-objects-matrixnumfeatures-matrixcatfeatures-objectfromconstructor}

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

#### Modifier and type

void

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeaturesprediction__desc.md -->
Apply the model to a batch of objects. Uses a matrix of numerical features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeaturesprediction__desc.md -->


#### Parameters

**numericFeatures**

A matrix of input numerical features.

**catFeatures**

A matrix of input categorical features.

**prediction**

The model's predictions.


#### Returns

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->
`CatBoostPredictions` with predictions for a batch of objects.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__batch-of-objects.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Object, array of numerical features, array of hashes of categorical features, new object with model predictions {#object-numfeaturesarray-catfeatureshashesarray-newobject}

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

#### Modifier and type

[CatBoostPredictions](https://catboost.ai/docs/en/concepts/java-reference_catboostpredictions.md)

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeatureshashes.dita.md -->
Apply the model to an object defined by features. Uses an array of numerical features and an array of hashes of categorical features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeatureshashes.dita.md -->


#### 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

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->
`CatBoostPredictions` with the prediction for the specified object.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Object, array of numerical features, array of hashes of categorical features, specified object with model predictions {#object-numfeaturesarray-catfeatureshashesarray-objectfromconstructor}

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

#### Modifier and type

void

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeatureshashesprediction__desc.md -->
Apply the model to an object defined by features. Uses an array of hashes of categorical features computed by the hashCategoricalFeature(String) function.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturescatfeatureshashesprediction__desc.md -->


#### 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

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->
`CatBoostPredictions` with the prediction for the specified object.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Object, array of numerical features, array of categorical features, new object with model predictions {#object-numfeaturesarray-catfeaturesarray-newobject}

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

#### Modifier and type

[CatBoostPredictions](https://catboost.ai/docs/en/concepts/java-reference_catboostpredictions.md)

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturesjlcatfeatures.md -->
Apply the model to an object defined by features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturesjlcatfeatures.md -->


#### Parameters

**numericFeatures**

An array of input numerical features.

**catFeatures**

An array of input categorical features.


#### Returns

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->
`CatBoostPredictions` with the prediction for the specified object.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->


## Object, array of numerical features, array of categorical features, specified object with model predictions {#object-numfeaturesarray-catfeaturesarray-objectfromconstructor}

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

#### Modifier and type
void

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturesjlcatfeaturesprediction__desc.md -->
Apply the model to an object defined by features.
<!-- endsource: en/_includes/work_src/reusage-java/java-reference_catboostmodel__predictnumericfeaturesjlcatfeaturesprediction__desc.md -->


#### Parameters

**numericFeatures**

An array of input numerical features.

**catFeatures**

An array of input categorical features.

**prediction**

The model's predictions.


#### Returns

<!-- source: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->
`CatBoostPredictions` with the prediction for the specified object.
<!-- endsource: en/_includes/work_src/reusage-java/returns__catboost-predictions__one-object.md -->


#### Throws

<!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->
`CatBoostError` — In case of errors in the native library.
<!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__in-case-of-native-lib-errors.md -->

