是否可以知道MLPClassifier的迭代数量?
我尝试使用 GeneticSelectionCV 和 sklearn 构建 mlp 分类器。我将 max_iter 固定为 25000。现在我想知道确切的迭代次数。我使用的代码如下。
from genetic_selection import GeneticSelectionCV
import pandas as pds
import numpy as num
from sklearn.neural_network import MLPClassifier
X = X_train
y = y_train
estimators = MLPClassifier(solver='lbfgs', alpha=1e-5, random_state=1, max_iter=25000)
mlp = GeneticSelectionCV(
estimators, cv=5, verbose=0,
scoring="accuracy", max_features=24,
n_population=50, crossover_proba=0.5,
mutation_proba=0.2, n_generations=100,
crossover_independent_proba=0.5,
mutation_independent_proba=0.04,
tournament_size=3, n_gen_no_change=10,
caching=True, n_jobs=-1)
mlp = mlp.fit(X, y)
I tried to build a mlp classifier using GeneticSelectionCV and sklearn. I fixed the max_iter to 25000. Now I would like to know the exact number of iterations. The code I used is given below.
from genetic_selection import GeneticSelectionCV
import pandas as pds
import numpy as num
from sklearn.neural_network import MLPClassifier
X = X_train
y = y_train
estimators = MLPClassifier(solver='lbfgs', alpha=1e-5, random_state=1, max_iter=25000)
mlp = GeneticSelectionCV(
estimators, cv=5, verbose=0,
scoring="accuracy", max_features=24,
n_population=50, crossover_proba=0.5,
mutation_proba=0.2, n_generations=100,
crossover_independent_proba=0.5,
mutation_independent_proba=0.04,
tournament_size=3, n_gen_no_change=10,
caching=True, n_jobs=-1)
mlp = mlp.fit(X, y)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如文档中列出的,实际数量求解器运行的迭代存储在估计器的 n_iter_ 属性中。
As listed in the documentation, the actual number of iterations the solver has run is stored in the estimator's
n_iter_
attribute.