问题遇到的现象和发生背景
clf.fit(X,y)报错
问题相关代码,请勿粘贴截图
X_features=['FOC_RA', 'FOC_DEC', 'FOC_ROLL', 'SAT_ALT', 'EULER1', 'EULER2','EULER3', 'SUN_ALT']
y_feature=['DIST_PCU_IN_I']
X=data_2009_target_down[X_features]
y=data_2009_target_down[y_feature]
import lightgbm as lgb
clf = lgb.LGBMClassifier(
boosting_type='gbdt', num_leaves=55, reg_alpha=0.0, reg_lambda=1,
max_depth=15, n_estimators=6000, objective='binary',
subsample=0.8, colsample_bytree=0.8, subsample_freq=1,
learning_rate=0.06, min_child_weight=1, random_state=20, n_jobs=4
)
clf.fit(X,y)
clf.predict(X)
运行结果及报错内容
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_668/1162132886.py in
6 learning_rate=0.06, min_child_weight=1, random_state=20, n_jobs=4
7 )
----> 8 clf.fit(X,y)
9 clf.predict(X)
D:\anaconda\envs\py37\lib\site-packages\lightgbm\sklearn.py in fit(self, X, y, sample_weight, init_score, eval_set, eval_names, eval_sample_weight, eval_class_weight, eval_init_score, eval_metric, early_stopping_rounds, verbose, feature_name, categorical_feature, callbacks, init_model)
921 "Docstring is inherited from the LGBMModel."
922 _LGBMAssertAllFinite(y)
--> 923 _LGBMCheckClassificationTargets(y)
924 self._le = _LGBMLabelEncoder().fit(y)
925 _y = self._le.transform(y)
D:\anaconda\envs\py37\lib\site-packages\sklearn\utils\multiclass.py in check_classification_targets(y)
196 "multilabel-sequences",
197 ]:
--> 198 raise ValueError("Unknown label type: %r" % y_type)
199
200
ValueError: Unknown label type: 'unknown'
我想要达到的结果
想明白问题出在哪里以及如何修改