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

# to_regressor

## Purpose {#purpose}

Convert a model of type [CatBoost](https://catboost.ai/docs/en/concepts/python-reference_catboost.md) to a model of type [CatBoostRegressor](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor.md). The model can be converted if the loss function of the source model is compatible with the one of the resulting model.

## Method call format {#call-format}

```python
to_regressor(model)
```

## Parameters {#parameters}

<!-- source: en/_includes/work_src/reusage-python/to__classifier-regressor__table.md -->
### model

#### Description

The input [CatBoost](https://catboost.ai/docs/en/concepts/python-reference_catboost.md) model for convert.

**Possible types**

 catboost.core.CatBoost

**Default value**

Obligatory parameter
<!-- endsource: en/_includes/work_src/reusage-python/to__classifier-regressor__table.md -->


## Type of return value {#usage-example}

catboost.core.CatBoostRegressor

## Example {#example}

```python
from catboost import Pool, to_regressor, CatBoost

train_data = [[0, 3],
              [4, 1],
              [8, 1],
              [9, 1]]

train_labels = [0, 0, 1, 1]

model = CatBoost(params={'loss_function': 'Logloss'})

model.fit(train_data,
          train_labels,
          verbose=False)

print("Source model type: ", type(model))
converted_model = to_regressor(model)
print("Converted model type: ",  type(converted_model))

```

<!-- source: en/_includes/work_src/reusage-common-phrases/example-output.md -->
The output of this example:
<!-- endsource: en/_includes/work_src/reusage-common-phrases/example-output.md -->


```bash
('Source model type: ', <class 'catboost.core.CatBoost'>)
('Converted model type: ', <class 'catboost.core.CatBoostRegressor'>)
```

