问题:
代码
python
# CatBoost Regression Model
from catboost import CatBoostRegressor
model = CatBoostRegressor(
iterations = 2000,
learning_rate = 0.1,
l2_leaf_reg = 3,
depth = 9,
rsm = 1,
border_count=128,
bagging_temperature= 10,
verbose=False,
loss_function='MultiRMSE',
)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
报错
bash
Currently only multi-regression, multilabel and survival objectives work with multidimensional target
原因
Catboost 默认用的回归的损失是RMSE,所以针对多变量的回归任务/分类任务需要更改损失函数
解决方法
python
model = CatBoostRegressor(
iterations = 2000,
learning_rate = 0.1,
l2_leaf_reg = 3,
depth = 9,
rsm = 1,
border_count=128,
bagging_temperature= 10,
verbose=False,
loss_function='MultiRMSE', ## 针对多变量任务更改损失函数改成MultiRMSE 或者 MultiLogit
)