打印CatBoost超参数

时间:2019-03-31 11:45:28

标签: python catboost

训练模型后如何打印CatBoost超参数?

sklearn中,我们只能打印将显示所有参数的模型对象,但是在catboost中,它仅打印对象的引用:<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)

2 个答案:

答案 0 :(得分:1)

print(model.get_params())应该做的

答案 1 :(得分:0)

使用 print(model.get_all_params()) 打印所有默认参数。