x_train, x_test, y_train, y_test =
sklearn.model_selection.train_test_split(X, y, test_size=0.2,
shuffle=False)
return(x_train, x_test, y_train, y_test)
logisticR = LogisticRegression(random_state=0, max_iter = '800',
solver='saga', multi_class='multinomial')
logisticR.fit(x_train, encoded_ytrain)
acc = logisticR.score(x_test, encoded_ytest)
print(acc)
运行时会出现以下错误:ValueError:最大迭代次数必须为正;got(max_iter='800')
由于max_iter默认为100,是否有其他方法更改迭代的大小?在
实际上
max_iter
应该是int
,而不是str
你能试试下列方法吗:
为什么要将max_iter对象值放在“”中。你正在创建一个Str。你需要输入一个int。把它等于800。在
相关问题 更多 >
编程相关推荐