質問編集履歴

2

ソースコードの入力位置を間違えた

2022/06/29 06:44

投稿

glacier_gg
glacier_gg

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,5 @@
1
1
  Pythonではじめる機械学習の演習で以下のようなコードを書きました。
2
+ ```
2
3
  from sklearn.model_selection import GridSearchCV
3
4
  from sklearn.pipeline import Pipeline
4
5
  from sklearn.svm import SVC
@@ -12,7 +13,9 @@
12
13
  print("Best score :{:.2f}".format(grid.score(X_test,y_test)))
13
14
  print("Best parameters:{}".format(grid.best_params_))
14
15
 
16
+ ```
17
+
15
18
  #実行結果
16
- ValueError: Invalid parameter svm_C for estimator Pipeline(steps=[('scaler', MinMaxScaler()), ('svm', SVC())]). Check the list of available parameters with `estimator.get_params().keys()`.
19
+ """ValueError: Invalid parameter svm_C for estimator Pipeline(steps=[('scaler', MinMaxScaler()), ('svm', SVC())]). Check the list of available parameters with `estimator.get_params().keys()`."""
17
20
 
18
21
  このエラーが起こってしまう原因と解決方法をお願いします。必要なライブラリはインポートしているつもりです

1

importの追加

2022/06/29 05:59

投稿

glacier_gg
glacier_gg

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,5 @@
1
1
  Pythonではじめる機械学習の演習で以下のようなコードを書きました。
2
+ from sklearn.model_selection import GridSearchCV
2
3
  from sklearn.pipeline import Pipeline
3
4
  from sklearn.svm import SVC
4
5
  from sklearn.preprocessing import MinMaxScaler