catboostclassifier中class_weights的使用

问题描述 投票:0回答:1

如何在将CatboostClassifier用于多类问题时使用'class_weights'。文档说应该是清单,但是我需要按什么顺序放置砝码?我有一个标签数组,它具有从-2到+2的15个类,包括十进制数字,其中class-0的密度比其他类高得多。请帮忙。谢谢,

我尝试使用易于使用的二进制类,但对多类一无所知。

cb_model_step1 = run_catboost(X_train,y_train_new,X_test,y_test_new,n_estimators = 1000,verbose = 100,eta = 0.3,loss_function ='MultiClassOneVsAll',class_weights = counter_new)

cb = CatBoostClassifier(thread_count = 4,n_estimators = n_estimators,max_depth = 10,class_weights = class_weights,eta = eta,loss_function = loss_function)

catboost catboostregressor
1个回答
0
投票

您需要在游览数据集上拟合模型而没有任何权重,然后运行CatBoostClassifier()。classes_。它将显示您在catboost中的课程顺序:

model_multiclass = CatBoostClassifier(iterations=1000,
                       depth=4,
                       learning_rate=0.05,
                       loss_function='MultiClass',
                       verbose=True,
                       early_stopping_rounds = 200,
                       bagging_temperature = 1,
                       metric_period = 100)

model_multiclass.fit(X_train, Y_train)
model_multiclass.classes_
Result:['35мр', '4мр', 'вывод на ИП', 'вывод на кк', 'вывод на фл', 'транзит']
© www.soinside.com 2019 - 2024. All rights reserved.