我设置了以下参数:
parameter_space = {
'hidden_layer_sizes': [(sp_randint(100,600),sp_randint(100,600),), (sp_randint(100,600),)],
'activation': ['tanh', 'relu', 'logistic'],
'solver': ['sgd', 'adam', 'lbfgs'],
'alpha': stats.uniform(0.0001, 0.9),
'learning_rate': ['constant','adaptive']}
Run Code Online (Sandbox Code Playgroud)
除了 hidden_layer_sizes 之外的所有参数都按预期工作。但是,拟合这个 RandomizedSearchCV 模型并显示它的详细文本表明它将 hidden_layer_sizes 视为:
hidden_layer_sizes=(<scipy.stats._distn_infrastructure.rv_frozen object
然后继续抛出: TypeError: '<=' not supported between instances of 'rv_frozen' and 'int'
这个结果是获得的,而不是预期的 1 层或 2 层 MLP,隐藏层神经元在 100 到 600 之间。任何想法/其他相关提示?