code: def test_defaults_numpy():
      iris_np = iris.copy()
      iris_np["sp"] = iris_np["sp"].cat.codes
      iris_np = iris_np.values
      iris_np_amp = mf.ampute_data(iris_np, perc=0.25)
      new_data = iris_np_amp[range(10), :].copy()
  
      s = datetime.now()
      kernel = mf.ImputationKernel(
          data=iris_np_amp,
          datasets=3,
          categorical_feature=[4],
          mean_match_scheme=mean_match_fast_cat,
      )
      kernel.mice(iterations=1, verbose=True)
      kernel.compile_candidate_preds()
  
      # Complete data with copy.
      comp_dat = kernel.complete_data(0, inplace=False)
  
      # We didn't complete data in place. Make sure we created
      # a copy, and did not affect internal data or original data.
      assert all(np.isnan(comp_dat).sum(0) == 0)
      assert all(np.isnan(kernel.working_data).sum(0) > 0)
      assert all(np.isnan(iris_np_amp).sum(0) > 0)
  
      # Complete data in place
      kernel.complete_data(0, inplace=True)
  
      # We completed data in place. Make sure we only affected
      # the kernel.working_data and not the original data.
      assert all(np.isnan(kernel.working_data).sum(0) == 0)
      assert all(np.isnan(iris_np_amp).sum(0) > 0)
  
      imp_ds = kernel.impute_new_data(new_data)
      imp_ds.complete_data(0, inplace=True)
      assert all(np.isnan(imp_ds.working_data).sum(0) == 0)
      assert np.isnan(new_data).sum() > 0
  
      # Make sure fully-recognized data can be passed through with no changes
      imp_fr = kernel.impute_new_data(iris_np)
      comp_fr = imp_fr.complete_data(0)
      assert np.all(
          comp_fr == iris_np
      ), "values of fully-recognized data were modified"
      assert imp_fr.iteration_count() == -1
  
file_path: miceforest/tests/test_ImputationKernel.py
imports: from sklearn.datasets import load_iris
  import pandas
  import numpy
  import miceforest
  from datetime import datetime
  from miceforest import mean_match_fast_cat, mean_match_shap
  from matplotlib.pyplot import close
  from tempfile import mkstemp
label_desc: Use image node_id 3 for calling a global function with example usage: test_defaults_numpy() without return types