是否可以知道MLPClassifier的迭代数量?

发布于 2025-01-18 21:16:16 字数 730 浏览 3 评论 0原文

我尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2025-01-25 21:16:16

文档中列出的,实际数量求解器运行的迭代存储在估计器的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文