LoginSignup
1
1

More than 5 years have passed since last update.

sklearnのエラー: A column-vector y was passed when a 1d array was expected

Posted at

エラー内容

clf = GridSearchCV(RandomForestClassifier(),param, cv=kfold_cv,verbose=3)
clf.fit(x_train,y_train)

scikitlearnで、Gridsearchを使用したときに、以下のエラーが発生した

A column-vector y was passed when a 1d array was expected

解決法

以下のように修正する

clf.fit(x_train,y_train.values.ravel())

取り急ぎのメモということで。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1