Catboost calc_feature_statistics not plotting

543 Views Asked by At

When running the example script that is given on the catboost website (https://catboost.ai/docs/concepts/python-reference_catboost_calc_feature_statistics.html), no plot appears at the end, but only empty space. Any suggestions what could be the cause for this?

from catboost import CatBoost
import numpy as np

train_data = np.random.rand(200, 10)
label_values = np.random.rand(200)

model = CatBoost()
model.fit(train_data, label_values)

res = model.calc_feature_statistics(train_data,
                                    label_values,
                                    feature=2,
                                    plot=True)
1

There are 1 best solutions below

0
On

If you are not using jupyter the plot will not render by default in your console.
In my case, I use spyder and stumbled with the same issue.
The easiest is to save the plot to disk instead of trying to show it in the terminal.

Just add the plot_file argument instead:

res = model.calc_feature_statistics(train_data,
                                    label_values,
                                    feature=2,
                                    plot_file="nameofyourplot.html)