如何解决如何将值传递给 Catboost?
我正在尝试使用 catboost,但我现在遇到了一个问题。我有一个包含 28 列的数据框,其中 2 列是分类的。当数据是数字时,有一些偶数和一些小数,还有一些 0.00 值,这些值不应该代表空值,而是实际的空值(如 1-1=0)。
我正在尝试运行这个:
train_cl = cb.Pool(data=ret_df.iloc[:580000,:-1],label=ret_df.iloc[:580000,-1],cat_features=cats)
evl_cl = cb.Pool(data=ret_df.iloc[580000:,label=ret_df.iloc[580000:,cat_features=cats)
但是我有这个错误
---------------------------------------------------------------------------
CatBoostError Traceback (most recent call last)
<ipython-input-112-a515b0ab357b> in <module>
1 train_cl = cb.Pool(data=ret_df.iloc[:580000,cat_features=cats)
----> 2 evl_cl = cb.Pool(data=ret_df.iloc[580000:,cat_features=cats)
~\AppData\Local\Programs\Python\Python36\lib\site-packages\catboost\core.py in __init__(self,data,label,cat_features,text_features,embedding_features,column_description,pairs,delimiter,has_header,ignore_csv_quoting,weight,group_id,group_weight,subgroup_id,pairs_weight,baseline,feature_names,thread_count,log_cout,log_cerr)
615 )
616
--> 617 self._init(data,thread_count)
618 super(Pool,self).__init__()
619
~\AppData\Local\Programs\Python\Python36\lib\site-packages\catboost\core.py in _init(self,thread_count)
1081 if label is not None:
1082 self._check_label_type(label)
-> 1083 self._check_label_empty(label)
1084 label = self._label_if_pandas_to_numpy(label)
1085 if len(np.shape(label)) == 1:
~\AppData\Local\Programs\Python\Python36\lib\site-packages\catboost\core.py in _check_label_empty(self,label)
723 """
724 if len(label) == 0:
--> 725 raise CatBoostError("Labels variable is empty.")
726
727 def _check_label_shape(self,samples_count):
CatBoostError: Labels variable is empty.
我用谷歌搜索了这个问题,但一无所获。我的假设是 0.00 值存在问题,但我不知道如何解决这个问题,因为我实际上无法用任何东西替换这些值。 请帮帮我!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。