code: def score_models(clf, X, y, encoder, runs=1):
      """
      Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score.
  
      """
  
      scores = []
  
      X_test = None
      for _ in range(runs):
          X_test = encoder().fit_transform(X, y)
  
          # Some models, like logistic regression, like normalized features otherwise they underperform and/or take a long time to converge.
          # To be rigorous, we should have trained the normalization on each fold individually via pipelines.
          # See grid_search_example to learn how to do it.
          X_test = StandardScaler().fit_transform(X_test)
  
          scores.append(
              cross_validate(clf, X_test, y, n_jobs=1, cv=5)[
                  "test_score"
              ]
          )
          gc.collect()
  
      scores = [y for z in [x for x in scores] for y in z]
  
      return (
          float(np.mean(scores)),
          float(np.std(scores)),
          scores,
          X_test.shape[1],
      )
  
file_path: category_encoders/examples/encoding_examples.py
imports: import gc
  import time
  import warnings
  import matplotlib.pyplot
  import numpy
  import pandas
  from sklearn import linear_model
  from sklearn.exceptions import DataConversionWarning
  from sklearn.model_selection import cross_validate
  from sklearn.preprocessing import StandardScaler
  import category_encoders
  from examples.source_data.loaders import get_cars_data
label_desc: Use image node_id 1 for calling a global function with example usage: score_models(clf, X, y, encoder, runs) and returns: float,  float,  scores,  X_test