docstr: Fit the imputer on `X` and return the transformed `X`.
  
  Parameters
  ----------
  X : array-like, shape (n_samples, n_features)
      Input data, where `n_samples` is the number of samples and
      `n_features` is the number of features.
  
  y : Ignored
      Not used, present for API consistency by convention.
  
  Returns
  -------
  Xt : array-like, shape (n_samples, n_features)
      The imputed input data.
docstr_tok: ["Fit","the","imputer","on","`","X","`","and","return","the","transformed","`","X","`",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","(","n_samples",",","n_features",")","Input","data",",","where","`","n_samples","`","is","the","number","of","samples","and","`","n_features","`","is","the","number","of","features",".","y",":","Ignored","Not","used",",","present","for","API","consistency","by","convention",".","Returns","--","--","--","-","Xt",":","array-like",",","shape","(","n_samples",",","n_features",")","The","imputed","input","data","."]
code: def fit_transform(self, X, y=None):
      """Fit the imputer on `X` and return the transformed `X`.
  
      Parameters
      ----------
      X : array-like, shape (n_samples, n_features)
          Input data, where `n_samples` is the number of samples and
          `n_features` is the number of features.
  
      y : Ignored
          Not used, present for API consistency by convention.
  
      Returns
      -------
      Xt : array-like, shape (n_samples, n_features)
          The imputed input data.
      """
      if self.n_nearest_features is not None:
          raise NotImplementedError(
              "n_nearest_features is not implemented"
          )
  
      if self.add_indicator:
          raise NotImplementedError("add_indicator is not implemented")
  
      self.random_state_ = getattr(
          self, "random_state_", check_random_state(self.random_state)
      )
  
      if self.max_iter < 0:
          raise ValueError(
              "'max_iter' should be a positive integer. Got {} instead.".format(
                  self.max_iter
              )
          )
  
      if self.tol < 0:
          raise ValueError(
              "'tol' should be a non-negative float. Got {} instead.".format(
                  self.tol
              )
          )
  
      if self.num_estimator is None:
          from sklearn.linear_model import BayesianRidge
  
          self._num_estimator = BayesianRidge()
      else:
          self._num_estimator = clone(self.num_estimator)
  
      if self.cat_estimator is None:
          from sklearn.ensemble import RandomForestClassifier
  
          self._cat_estimator = RandomForestClassifier()
      else:
          self._cat_estimator = clone(self.cat_estimator)
  
      index = getattr(X, "index", None)
  
      self.mappings_ = {}
      if isinstance(X, pd.DataFrame):
          cat_indices = self.categorical_indices or []
          columns_to_encode = [
              col for i, col in enumerate(X.columns) if i in cat_indices
          ]
          X = X.astype({col: "category" for col in columns_to_encode})
          for col in X.select_dtypes("category").columns:
              self.mappings_[col] = {
                  k: i for i, k in enumerate(X[col].cat.categories)
              }
              X[col] = X[col].cat.rename_categories(self.mappings_[col])
  
      self.imputation_sequence_ = []
  
      self.initial_imputer_ = None
  
      (
          X,
          Xt,
          mask_missing_values,
          complete_mask,
      ) = self._initial_imputation(X, in_fit=True)
  
      super()._fit_indicator(complete_mask)
      X_indicator = super()._transform_indicator(complete_mask)
  
      if self.max_iter == 0 or np.all(mask_missing_values):
          self.n_iter_ = 0
          return super()._concatenate_indicator(Xt, X_indicator)
  
      # Edge case: a single feature. We return the initial ...
      if Xt.shape[1] == 1:
          self.n_iter_ = 0
          return super()._concatenate_indicator(Xt, X_indicator)
  
      self._min_value = self._validate_limit(
          self.min_value, "min", X.shape[1]
      )
      self._max_value = self._validate_limit(
          self.max_value, "max", X.shape[1]
      )
  
      if not np.all(np.greater(self._max_value, self._min_value)):
          raise ValueError(
              "One (or more) features have min_value >= max_value."
          )
  
      # order in which to impute
      # note this is probably too slow for large feature data (d > 100000)
      # and a better way would be good.
      # see: https://goo.gl/KyCNwj and subsequent comments
      ordered_idx = self._get_ordered_idx(mask_missing_values)
      self.n_features_with_missing_ = len(ordered_idx)
  
      abs_corr_mat = self._get_abs_corr_mat(Xt)
  
      n_samples, n_features = Xt.shape
      if self.verbose > 0:
          print(
              "[IterativeImputer] Completing matrix with shape %s"
              % (X.shape,)
          )
      start_t = time()
      if not self.sample_posterior:
          Xt_previous = Xt.copy()
          normalized_tol = self.tol * np.max(
              np.abs(X[~mask_missing_values])
          )
      for self.n_iter_ in range(1, self.max_iter + 1):
          if self.imputation_order == "random":
              ordered_idx = self._get_ordered_idx(mask_missing_values)
  
          for feat_idx in ordered_idx:
              neighbor_feat_idx = self._get_neighbor_feat_idx(
                  n_features, feat_idx, abs_corr_mat
              )
              Xt, estimator = self._impute_one_feature(
                  Xt,
                  mask_missing_values,
                  feat_idx,
                  neighbor_feat_idx,
                  estimator=None,
                  fit_mode=True,
              )
              estimator_triplet = _ImputerTriplet(
                  feat_idx, neighbor_feat_idx, estimator
              )
              self.imputation_sequence_.append(estimator_triplet)
  
          if self.verbose > 1:
              print(
                  "[IterativeImputer] Ending imputation round "
                  "%d/%d, elapsed time %0.2f"
                  % (self.n_iter_, self.max_iter, time() - start_t)
              )
  
          if not self.sample_posterior:
              inf_norm = np.linalg.norm(
                  Xt - Xt_previous, ord=np.inf, axis=None
              )
              if self.verbose > 0:
                  print(
                      "[IterativeImputer] Change: {}, scaled tolerance: {} ".format(
                          inf_norm, normalized_tol
                      )
                  )
              if inf_norm < normalized_tol:
                  if self.verbose > 0:
                      print(
                          "[IterativeImputer] Early stopping criterion reached."
                      )
                  break
              Xt_previous = Xt.copy()
      else:
          if not self.sample_posterior:
              warnings.warn(
                  "[IterativeImputer] Early stopping criterion not reached.",
                  ConvergenceWarning,
              )
      Xt[~mask_missing_values] = X[~mask_missing_values]
      if self.mappings_:
          Xt = _inverse_map_pd(
              Xt, self.mappings_, self.feature_names_in_, index
          )
  
      return Xt
  
imports: from __future__ import annotations
  import warnings
  from time import time
  from typing import List, Optional
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, clone
  from sklearn.compose import ColumnTransformer
  from sklearn.dummy import DummyClassifier
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.experimental import enable_iterative_imputer
  from sklearn.impute import IterativeImputer
  from sklearn.impute import SimpleImputer
  from sklearn.impute._iterative import FLOAT_DTYPES, _check_inputs_dtype, _get_mask, _ImputerTriplet, _safe_indexing, is_scalar_nan, stats
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import OneHotEncoder
  from sklearn.preprocessing import OrdinalEncoder
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 3 for calling the IterativeImputer obj's underlying member method code with example usage: obj.fit_transform(X, y) and returns: Xt, super, super