Back to Catboost

Export a model to Python or C++

catboost/docs/en/features/export-model-to-python.md

1.2.102.5 KB
Original Source

Export a model to Python or C++

The {{ product }} model can be saved as standalone Python or C++ code. This solution simplifies the integration of resulting models to Python and C++ applications, allows to port models to architectures that are not directly supported by {{ product }} (such as IBM z/Architecture) and allows advanced users to manually explore or edit the model parameters.

{% include feature-importance-choose-the-required-implementation-for-more-details %}

Depending on the output format the resulting file contains one of the following methods for applying the model:

{% note alert %}

{% endnote %}

{{ python-package }}

The following parameters can be set for the corresponding methods and are used when the model is saved:

{{ features__table__title__python__method }}

{{ features__table__title__python__parameters }}

format

{{ features__table__title__python__description }}

{% include sections-with-methods-desc-python__save__export-format__short_desc %}

Set the value of this parameter to “python” or “cpp”.

{{ title__implementation__cli }}

The following command keys can be specified for the corresponding commands and are used when the model is trained:

{{ features__table__title__cli__command }} catboost fit

{{ features__table__title__cli__keys }}

--model-format

{{ features__table__title__cli__key-description }}

{% include reusage-cli__mode-format__short-desc %}

Set the value of this key to “Python” or “CPP”.