-->

Print CatBoost hyperparameters

2019-07-24 20:59发布

问题:

How to print CatBoost hyperparameters after training a model?

In sklearn we can just print model object that it will show all parameters but in catboost it only print object's reference: <catboost.core.CatBoostRegressor object at 0x7fd441e5f6d8>.

from catboost import CatBoostRegressor
# Initialize data

train_data = [[1, 4, 5, 6],
              [4, 5, 6, 7],
              [30, 40, 50, 60]]

eval_data = [[2, 4, 6, 8],
             [1, 4, 50, 60]]

train_labels = [10, 20, 30]
# Initialize CatBoostRegressor
model = CatBoostRegressor(iterations=2,
                          learning_rate=1,
                          depth=2)
# Fit model
model.fit(train_data, train_labels)
# Get predictions
preds = model.predict(eval_data)
print (model)

回答1:

print(model.get_params()) should do