打印CatBoost超参数 [英] Print CatBoost hyperparameters
本文介绍了打印CatBoost超参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
训练模型后如何打印CatBoost超参数?
How to print CatBoost hyperparameters after training a model?
在 sklearn
中,我们可以打印出模型对象它会显示所有参数,但在 catboost
中,它仅打印对象的引用:< catboost.core.CatBoostRegressor object at 0x7fd441e5f6d8>
。
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)
推荐答案
print(model.get_params())应该做
print(model.get_params()) should do
这篇关于打印CatBoost超参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文