code: def runtime(X, y, model_generator, method_name):
      """Runtime (sec / 1k samples)
      transform = "negate_log"
      sort_order = 2
      """
  
      old_seed = np.random.seed()
      np.random.seed(3293)
  
      # average the method scores over several train/test splits
      method_reps = []
      for i in range(3):
          X_train, X_test, y_train, _ = train_test_split(
              __toarray(X), y, test_size=100, random_state=i
          )
  
          # define the model we are going to explain
          model = model_generator()
          model.fit(X_train, y_train)
  
          # evaluate each method
          start = time.time()
          explainer = getattr(methods, method_name)(model, X_train)
          build_time = time.time() - start
  
          start = time.time()
          explainer(X_test)
          explain_time = time.time() - start
  
          # we always normalize the explain time as though we were explaining 1000 samples
          # even if to reduce the runtime of the benchmark we do less (like just 100)
          method_reps.append(
              build_time + explain_time * 1000.0 / X_test.shape[0]
          )
      np.random.seed(old_seed)
  
      return None, np.mean(method_reps)
  
imports: import hashlib
  import os
  import time
  import numpy
  import sklearn
  from ..None import __version__
  from .None import measures, methods
label_desc: Use image node_id 1 for calling a global function with example usage: runtime(X, y, model_generator, method_name) and returns: None,  np