当我尝试将GridSearchCV用于MLPClassifier时,我收到了以下消息:
ValueError:估算器的无效参数估算器
检查可用参数列表
MLPClassifier(激活=' relu',alpha = 0.0001,batch_size =' auto',beta_1 = 0.9, beta_2 = 0.999,early_stopping = False,epsilon = 1e-08,
hidden_layer_sizes =(100,),learning_rate ='常数',
learning_rate_init = 0.001,max_iter = 200,动量= 0.9,
nesterovs_momentum = True,power_t = 0.5,random_state = 1,shuffle = True,
solver =' lbfgs',tol = 0.0001,validation_fraction = 0.1,verbose = False,
warm_start =假)。使用estimator.get_params()。keys()。
from sklearn.neural_network import *
mlp = MLPClassifier(solver='lbfgs', hidden_layer_sizes=(100, ), random_state=1)
paramgrid = {'estimator__alpha':logspace(-3,2,20),}
mlpcv = grid_search.GridSearchCV(mlp, paramgrid, cv = 5)
mlpcv.fit(trainXtf, trainY)
print mlpcv.best_params_
哪个参数有错误?
答案 0 :(得分:0)
您正在paramgrid
上进行网格搜索,其中包含参数estimator__alpha
。
然而 MLPClassifier 没有此参数。您应该更改paramgrid
。