Quick start

To apply a previously trained CatBoost model in Java:

  1. Install the package using a package manager.

    Note that the package contains native code shared libraries inside. The supported platforms are:

    Operating system CPU architectures GPU support using CUDA
    macOS (versions currently supported by Apple) x86_64 and arm64 no
    Linux (compatible with manylinux2014 platform tag ) x86_64 and aarch64 yes
    Windows 10 and 11 x86_64 yes


    Release binaries for x86_64 CPU architectures are built with SIMD extensions SSE2, SSE3, SSSE3, SSE4 enabled. If you need to run CatBoost on older CPUs that do not support these instruction sets build CatBoost artifacts yourself

    Add the following block to the dependencies section of the pom.xml file for Maven:

    <!-- -->

    source_version should be set to one of the main CatBoost releases. Available versions can also be checked on the Maven repository site.

  2. Load the trained model:

    import ai.catboost.CatBoostModel;
    import ai.catboost.CatBoostPredictions;
    CatBoostModel model = CatBoostModel.loadModel("model.cbm");
  3. Apply the model:

    CatBoostPredictions prediction = model.predict(new float[]{0.1f, 0.3f, 0.2f}, new String[]{"foo", "bar", "baz"});
    // assuming that this is a regression task
    System.out.print("model value is " + String.valueOf(prediction.get(0, 0));

Provided classes

Class Description
CatBoostModel Basic model application methods.
CatBoostPredictions A wrapper that provides methods for making convenient predictions for certain classes.

Build from source