---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.5
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_virtual_ensemblesranker_predict.md
  - href: en/concepts/python-reference_virtual_ensemblesranker_predict.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

<!-- source: en/concepts/python-reference_virtual_ensembles_predict.md -->
# virtual_ensembles_predict

<!-- source: en/_includes/work_src/reusage/predict__purpose__full-with-note__div.md -->
Apply the model to the given dataset.

{% note info %}

<!-- source: en/_includes/work_src/reusage-common-phrases/python__note__predict_note_for_packages_must-contain-all-features__python.md -->
The model prediction results will be correct only if the `data` parameter with feature values contains all the features used in the model. Typically, the order of these features must match the order of the corresponding columns that is provided during the training. But if feature names are provided both during the training and when applying the model, they can be matched by names instead of columns order. Feature names can be specified if the `data` parameter has one of the following types:
- [FeaturesData](https://catboost.ai/docs/en/concepts/python-features-data__desc.md)
- [catboost.Pool](https://catboost.ai/docs/en/concepts/python-reference_pool.md)
- [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/frame.html) (in this case, feature names are taken from column names)
- [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html) (in this case, feature names are taken from column names)
<!-- endsource: en/_includes/work_src/reusage-common-phrases/python__note__predict_note_for_packages_must-contain-all-features__python.md -->

{% endnote %}
<!-- endsource: en/_includes/work_src/reusage/predict__purpose__full-with-note__div.md -->


## Method call format {#call-format}

```python
virtual_ensembles_predict(data,
                          prediction_type='VirtEnsembles',
                          ntree_end=0,
                          virtual_ensembles_count=10,
                          thread_count=-1 (the number of threads is equal to the number of processor cores),
                          verbose=None)
```

## Parameters {#parameters}

### data

#### Description

Feature values data.

The format depends on the number of input objects:

- Multiple — Matrix-like data of shape `(object_count, feature_count)`
- Single — An array

**Possible types**

For multiple objects:

- catboost.Pool
- list of lists
- numpy.ndarray of shape `(object_count, feature_count)`
- pandas.DataFrame
- pandas.SparseDataFrame
- pandas.Series
- [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html)
- [catboost.FeaturesData](https://catboost.ai/docs/en/concepts/python-features-data__desc.md)
- <!-- source: en/_includes/work_src/reusage-formats/scipy-except-dia.md -->
  scipy.sparse.spmatrix (all subclasses except dia_matrix)
  <!-- endsource: en/_includes/work_src/reusage-formats/scipy-except-dia.md -->


For a single object:

- list of feature values
- one-dimensional numpy.ndarray with feature values

**Default value**

Required parameter


### prediction_type

#### Description

Required prediction type. Supported prediction types: VirtEnsembles, TotalUncertainty

**Possible types**

string

**Default value**

VirtEnsembles


### ntree_end

#### Description

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the range of the tree indices to `[ntree_start; ntree_end)` and the step of the trees to use to eval_period.

This parameter defines the index of the first tree not to be used when applying the model or calculating the metrics (the exclusive right border of the range). Indices are zero-based.

**Possible types**

int

**Default value**

0 (the index of the last tree to use equals to the number of trees in the model minus one)

### virtual_ensembles_count

#### Description

Number of tree ensembles to use. Each virtual ensemble can be considered as a truncated model.

**Possible types**

int

**Default value**

0 (the index of the last tree to use equals to the number of trees in the model minus one)


### thread_count

#### Description

The number of threads to use during the training.

Optimizes the speed of execution. This parameter doesn't affect results.

**Possible types**

int

**Default value**

-1 (the number of threads is equal to the number of processor cores)

### verbose

#### Description

Output the measured evaluation metric to stderr.

**Possible types**

bool

**Default value**

None



## Return value {#output-format}

**prediction_type VirtEnsembles**

Each virtual ensemble can be considered as truncated model. Returns virtual_ensembles_count predictions from each virtual ensemble. The return value type depends on the number of input objects and model type:

- Single object — Return numpy.ndarray one-dimensional or two-dimensional numpy.ndarray of shape (virtual_ensembles_count) or (virtual_ensembles_count, single document predict size) of virtual_ensemble.predict(document, prediction_type='RawFormulaVal') results. For model learned with RMSEWithUncertainty for virtual ensembles predictions used prediction_type='RMSEWithUncertainty' instead of prediction_type='RawFormulaVal'.
- Multiple objects — two-dimensional or three-dimensional numpy.ndarray of shape (number_of_objects, virtual_ensembles_count) or (number_of_objects, virtual_ensembles_count, single document predict size) similarly to Single object predict type.

**prediction_type TotalUncertainty**

- Single object
    - Regression (not RMSEWithUncertainty): one-dimensional numpy.ndarray [Mean Predictions, Knowledge Uncertainty]
    - RMSEWithUncertainty: one-dimensional numpy.ndarray [Mean Predictions, Knowledge Uncertainty, Data Uncertainty]
    - Classification: one-dimensional numpy.ndarray [Data Uncertainty, Total Uncertainty]

- Multiple objects

    Return two-dimensional numpy.ndarray of shape (number_of_objects, 2) or (number_of_objects, 3) similarly to single object return type.prediction_type VirtEnsembles:


Additional information is available in the [article](https://towardsdatascience.com/tutorial-uncertainty-estimation-with-catboost-255805ff217e).
<!-- endsource: en/concepts/python-reference_virtual_ensembles_predict.md -->
