Home > Enterprise >  Is it possible to know number of iteration of MLPClassifier?
Is it possible to know number of iteration of MLPClassifier?

Time:04-06

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)

CodePudding user response:

As listed in the documentation, the actual number of iterations the solver has run is stored in the estimator's n_iter_ attribute.

  • Related