code: def train_model(model, data, batch_size=128, epochs=20):
      num_classes = 10
  
      x_train, y_train, x_test, y_test = data
      # convert class vectors to binary class matrices
      y_train = keras.utils.to_categorical(y_train, num_classes)
      y_test = keras.utils.to_categorical(y_test, num_classes)
  
      model.compile(
          loss="categorical_crossentropy",
          optimizer="adam",
          metrics=["accuracy"],
      )
      model.fit(
          x_train,
          y_train,
          batch_size=batch_size,
          epochs=epochs,
          verbose=1,
      )
      score = model.evaluate(x_test, y_test, verbose=0)
      return score
  
file_path: innvestigate/examples/utils/mnist.py
imports: from __future__ import annotations
  import numpy
  import tensorflow.keras
  from tensorflow.keras.backend import image_data_format
  from tensorflow.keras.datasets import mnist
  import innvestigate.utils
  import innvestigate.utils.visualizations
label_desc: Use image node_id 3 for calling a global function with example usage: train_model(model, data, batch_size, epochs) and returns: score