我刚刚安装了scikit-learn v0.18开发包。
当我在iPython上调用以下内容时;
>>> from sklearn.neural_network import MLPClassifier
>>> clf = MLPClassifier(algorithm='l-bfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1)
没有错误。但是当我编写一个python脚本文件并在其上运行代码时,我收到以下错误:
clf = MLPClassifier(algorithm='l-bfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1, warm_start=True)
TypeError: MLPClassifier() got an unexpected keyword argument 'algorithm'
我不知道问题出在哪里。我该如何修复这个错误?
答案 0 :(得分:1)
您要将algorithm
参数更改为solver
。请参阅documentation for that estimator和repo for dev。
答案 1 :(得分:1)
bSet.removeAll(A);
bSet.forEach(this::operationY);
B.forEach(this::operationZ);
只需将from sklearn.neural_network import MLPClassifier
clf = MLPClassifier(solver='l-bfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1, warm_start=True)
替换为algorithm
但是当您将数据放在一行中时:
solver
将X,y = make_moons(n_samples=100, noise=0.25, random_state=3)
X_trian, X_test, y_train, y_test = train_test_split(X,y, stratify=y, random_state=42)
mlpc = MLPClassifier(solver='lbfgs', random_state=0).fit(X_train, y_train)
替换为l-bfgs