class_docstr: Extract model data and port a MLPClassifier classifier.
class_docstr_tok: ["Extract","model","data","and","port","a","MLPClassifier","classifier","."]
code: def __init__(self, estimator: MLPClassifierClass):
      super().__init__(estimator)
      L.info("Create specific estimator `%s`.", self.estimator_name)
      est = self.estimator  # alias
  
      # Check output function:
      try:
          est.out_activation_
      except AttributeError:
          raise exception.NotFittedEstimatorError(self.estimator_name)
  
      # Architecture:
      n_inputs = len(est.coefs_[0])
      n_outputs = est.n_outputs_
      n_hidden_layers = est.hidden_layer_sizes
      if isinstance(n_hidden_layers, int):
          n_hidden_layers = [n_hidden_layers]
      n_hidden_layers = list(n_hidden_layers)
      layers = [n_inputs] + n_hidden_layers + [n_outputs]
  
      self.meta_info = dict(
          n_features=n_inputs,
      )
      L.info("Meta info (keys): {}".format(self.meta_info.keys()))
      L.opt(lazy=True).debug("Meta info: {}".format(self.meta_info))
  
      self.model_data = dict(
          layers=list(map(int, layers[1:])),
          weights=list(map(np.ndarray.tolist, est.coefs_)),
          bias=list(map(np.ndarray.tolist, est.intercepts_)),
          hidden_activation=est.activation,
      )
      if self.estimator_name == "MLPClassifier":
          self.model_data["output_activation"] = est.out_activation_
  
      L.info("Model data (keys): {}".format(self.model_data.keys()))
      L.opt(lazy=True).debug("Model data: {}".format(self.model_data))
  
file_path: sklearn-porter/sklearn_porter/estimator/MLPClassifier/__init__.py
imports: from copy import deepcopy
  from json import dumps, encoder
  from typing import Tuple, Union, Callable
  import numpy
  from loguru import logger
  from sklearn.neural_network.multilayer_perceptron import MLPClassifier
  from sklearn_porter import enums
  from sklearn_porter import exceptions
  from sklearn_porter.estimator.EstimatorApiABC import EstimatorApiABC
  from sklearn_porter.estimator.EstimatorBase import EstimatorBase
label_desc: Use image node_id 1 to create a new MLPClassifier object from inherited base classes: EstimatorBase, EstimatorApiABC with example: obj = MLPClassifier(estimator)