Documentation
Developer's guide
Command-line version on GPU

Installation

Note. Installation is only supported by the 64-bit version of Python.

Dependencies:

Choose an installation method:

Run the following command:

pip install catboost

The following packages are required for installation:

  • python2.7
  • python2.7-dev

To build the Python package from source:

  1. Clone the repository:

    git clone https://github.com/catboost/catboost.git
  2. Open the catboost/catboost/python-package/catboost catalog from the local copy of the CatBoost repository.
  3. Compile the library:

    • For Python 2:

      ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DPYTHON_CONFIG=python2-config
    • Or for Python 3:

      ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DPYTHON_CONFIG=python3-config
    Note. 

    To build on Windows it is necessary to explicitly specify the PYTHON_INCLUDE and PYTHON_LIBRARIES variables:

    ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DPYTHON_INCLUDE="/I C:/Python27/include/" -DPYTHON_LIBRARIES="C:/Python27/libs/python27.lib"

  4. Add the current catalog to PYTHONPATH to use the built module on macOS or Linux:

    cd ../; export PYTHONPATH=$PYTHONPATH:$(pwd)

To build a self-contained Python Wheel run the catboost/catboost/python-package/mk_wheel.py script.

For example, to build and install a wheel on Windows for Anaconda run:

python.exe mk_wheel.py -DPYTHON_INCLUDE="/I C:\Anaconda2\include" -DPYTHON_LIBRARIES="C:\Anaconda2\libs\python27.lib"
C:\Anaconda2\Scripts\pip.exe install catboost-0.1.0.6-cp27-none-win_amd64.whl

Use the following example to test CatBoost:

import numpy
      from catboost import CatBoostRegressor

dataset = numpy.array([[1,4,5,6],[4,5,6,7],[30,40,50,60],[20,15,85,60]])
train_labels = [1.2,3.4,9.5,24.5]
model = CatBoostRegressor(learning_rate=1, depth=6, loss_function='RMSE')
fit_model = model.fit(dataset, train_labels)

print fit_model.get_params()

Additional packages are required for data visualization support.

Additional packages for data visualization support

Execute the following steps to support the data visualization feature in Jupyter Notebook:

  1. Install the ipywidgets package:

    pip install ipywidgets
  2. Turn on the widgets extension:

    jupyter nbextension enable --py widgetsnbextension