估算器MLPClassifier

时间:2016-10-04 07:46:19

标签: python

当我尝试将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_

哪个参数有错误?

1 个答案:

答案 0 :(得分:0)

您正在paramgrid上进行网格搜索,其中包含参数estimator__alpha

然而 MLPClassifier 没有此参数。您应该更改paramgrid