前提・実現したいこと
グリッドサーチを使い、SGD(確率的勾配降下法)のモデルを動かそう
としています。
グリッドサーチの部分で以下のエラーメッセージが発生しました。
■■な機能を実装中に以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
Fitting 5 folds for each of 18 candidates, totalling 90 fits [Parallel(n_jobs=-1)]: Using backend LokyBackend with 2 concurrent workers. --------------------------------------------------------------------------- _RemoteTraceback Traceback (most recent call last) _RemoteTraceback: """ Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker r = call_item() File "/usr/local/lib/python3.6/dist-packages/joblib/externals/loky/process_executor.py", line 285, in __call__ return self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.6/dist-packages/joblib/_parallel_backends.py", line 593, in __call__ return self.func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/joblib/parallel.py", line 253, in __call__ for func, args, kwargs in self.items] File "/usr/local/lib/python3.6/dist-packages/joblib/parallel.py", line 253, in <listcomp> for func, args, kwargs in self.items] File "/usr/local/lib/python3.6/dist-packages/sklearn/model_selection/_validation.py", line 504, in _fit_and_score estimator = estimator.set_params(**cloned_parameters) File "/usr/local/lib/python3.6/dist-packages/sklearn/linear_model/_stochastic_gradient.py", line 114, in set_params super().set_params(**kwargs) File "/usr/local/lib/python3.6/dist-packages/sklearn/base.py", line 236, in set_params (key, self)) ValueError: Invalid parameter maxiter for estimator SGDRegressor(alpha=0.0001, average=False, early_stopping=False, epsilon=0.1, eta0=0.1, fit_intercept=True, l1_ratio=0.15, learning_rate='invscaling', loss='squared_loss', max_iter=1000, n_iter_no_change=5, penalty='l2', power_t=0.25, random_state=None, shuffle=True, tol=0.001, validation_fraction=0.1, verbose=0, warm_start=False). Check the list of available parameters with `estimator.get_params().keys()`. """ The above exception was the direct cause of the following exception: ValueError Traceback (most recent call last) <ipython-input-64-9c4b90a758bc> in <module>() 10 11 grid_search = GridSearchCV(model, param_grid, cv=5, scoring='neg_mean_squared_error', verbose=2, n_jobs=-1) ---> 12 grid_search.fit(X_train_std, y_train) 7 frames /usr/lib/python3.6/concurrent/futures/_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result ValueError: Invalid parameter maxiter for estimator SGDRegressor(alpha=0.0001, average=False, early_stopping=False, epsilon=0.1, eta0=0.1, fit_intercept=True, l1_ratio=0.15, learning_rate='invscaling', loss='squared_loss', max_iter=1000, n_iter_no_change=5, penalty='l2', power_t=0.25, random_state=None, shuffle=True, tol=0.001, validation_fraction=0.1, verbose=0, warm_start=False). Check the list of available parameters with `estimator.get_params().keys()`.
該当のソースコード
#言語名:python3 # グリッドサーチの実行 param_grid = [ {'maxiter':[10.,100.,1000], 'eta0': [0.1,0.01,0.001], 'alpha': [1e-04,1e-09] } ] model = SGDRegressor() grid_search = GridSearchCV(model, param_grid, cv=5, scoring='neg_mean_squared_error', verbose=2, n_jobs=-1) grid_search.fit(X_train_std, y_train)
試したこと
「grid_search valueError」で検索し、解決法を調査したが、
解決にいたりませんでした。
補足情報(FW/ツールのバージョンなど)
開発環境:Google Colaboratory
バージョン:python3
OS:windows10 Home
CPU:Intel(R) Core(TM) i7-7500U CPU@2.70GHz 2.90GHz
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/07/07 03:42