首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CatBoost边界

CatBoost边界
EN

Stack Overflow用户
提问于 2019-03-13 13:11:57
回答 1查看 816关注 0票数 0

由于边界狭小,我无法开始用catboost来学习。

代码语言:javascript
复制
X = pandas.read_csv("../input/x_y_test/X.csv")
X_test = pandas.read_csv("../input/x_y_test/X_test.csv")
y = pandas.read_csv("../input/y-data/y.csv")

X = X.reset_index(drop = True)
X_test = X_test.reset_index(drop = True)
y = y.reset_index(drop = True)

X_train, X_val, y_train, y_val = train_test_split(X, y, test_size = .3, random_state = 1337)

X_train = X_train.reset_index(drop = True) 
X_val = X_val.reset_index(drop = True)
y_train = y_train.reset_index(drop = True)
y_val = y_val.reset_index(drop = True)

model_cb = CatBoostClassifier(eval_metric = "Accuracy", n_estimators = 1200, random_seed = 70)
model_cb.fit(X_train, y_train, eval_set = (X_val, y_val), use_best_model = True)

所以我得到了

代码语言:javascript
复制
CatboostError: catboost/libs/metrics/metric.cpp:3929: All train targets are greater than border 0.5

数据

https://drive.google.com/drive/folders/1m7bNIs0mZQQkAsvkETB3n6j62p9QJX39?usp=sharing

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-03-13 13:44:30

您的主要错误是将y_train添加到您的algo中,如下所示:

代码语言:javascript
复制
    id  skilled
0   138177  0
1   36214   0
2   103206  1
3   22699   1
4   96145   1

我相信你真正想要的只是y_train.skilled

在试衣前,像下面这样进行重新分配,你就可以去了:

代码语言:javascript
复制
y_train = y_train.skilled # just skill is enough 
y_val = y_val.skilled # just skill is enough

model_cb = CatBoostClassifier(eval_metric = "Accuracy", n_estimators = 1200, random_seed = 70)
model_cb.fit(X_train, y_train, eval_set = (X_val, y_val), use_best_model = True)

顺便提一句,你真的相信id in X_train具有任何预测能力吗?为什么不把它也从功能中删除呢?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55142717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档