class_docstr: Extract model data and port a KNeighborsClassifier classifier.
code: def __init__(self, estimator: KNeighborsClassifierClass):
      super().__init__(estimator)
      L.info("Create specific estimator `%s`.", self.estimator_name)
      est = self.estimator  # alias
  
      # Is the estimator fitted?
      try:
          est.classes_
      except AttributeError:
          raise exception.NotFittedEstimatorError(self.estimator_name)
  
      if est.weights != "uniform":
          msg = "Only `uniform` weights are supported."
          raise exception.NotSupportedYetError(msg)
  
      self.meta_info = dict(
          n_classes=len(est.classes_),
          n_templates=len(est._fit_X),  # pylint: disable=W0212
          n_features=len(est._fit_X[0]),  # pylint: disable=W0212
          metric=est.metric,
      )
      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(
          X=est._fit_X.tolist(),  # pylint: disable=W0212
          y=est._y.astype(int).tolist(),  # pylint: disable=W0212
          k=est.n_neighbors,  # number of relevant neighbors
          n=len(est.classes_),  # number of classes
          power=est.p,
      )
      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/KNeighborsClassifier/__init__.py
imports: from copy import deepcopy
  from json import dumps, encoder
  from typing import Tuple, Union, Callable
  from loguru import logger
  from sklearn.neighbors.classification import KNeighborsClassifier
  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 KNeighborsClassifier object from inherited base classes: EstimatorBase, EstimatorApiABC with example: obj = KNeighborsClassifier(estimator)