code: def make_keras_model(categorical_map):
      """Simple feedforward model.
  
      Uses embedding representation for categorical variables.
      """
      n_features = 41
      n_labels = 23
      # Make all placeholders
      inputs = []
      models = []
  
      input_layer = tf.keras.layers.Input(
          shape=(n_features,), name="input"
      )
      inputs.append(input_layer)
  
      # Splits the input vector into multiple variables
      deconcat = tf.split(
          input_layer, [1 for i in range(n_features)], 1
      )
  
      for index in range(n_features):
          # For categorical variables, we create embedding layers
          if index in categorical_map.keys():
              vocab_size = categorical_map[index]
              inpt = deconcat[index]
              inputs.append(inpt)
              embed = tf.keras.layers.Embedding(
                  vocab_size,
                  200,
                  trainable=True,
                  embeddings_initializer=tf.compat.v1.initializers.random_normal(),
              )(inpt)
  
              embed_reshaped = tf.keras.layers.Reshape(
                  target_shape=(200,)
              )(embed)
              models.append(embed_reshaped)
          else:
              # Else, create a simple input for numerical features
              inpt = deconcat[index]
              inputs.append(inpt)
              models.append(inpt)
  
      # Concatenate them into a single vector
      merge_models = tf.keras.layers.concatenate(models)
  
      # Plug them into the DNN
      net = tf.keras.layers.Dense(1000)(merge_models)
      net = tf.keras.layers.BatchNormalization()(net)
      net = tf.keras.layers.Dense(256)(net)
      net = tf.keras.layers.BatchNormalization()(net)
  
      pred = tf.keras.layers.Dense(n_labels, activation="sigmoid")(net)
      model_full = tf.keras.models.Model(
          inputs=input_layer, outputs=pred
      )
      model_full.compile(
          loss=tf.keras.losses.SparseCategoricalCrossentropy(
              from_logits=True
          ),
          metrics=["accuracy"],
          optimizer="adam",
      )
      return model_full
  
file_path: tcav/tcav/tcav_examples/discrete/kdd99_model.py
imports: from __future__ import division
  from __future__ import print_function
  import os
  import tensorflow
  import argparse
  import numpy
  from sklearn.model_selection import train_test_split
  import sklearn.datasets
  from sklearn.preprocessing import OrdinalEncoder
label_desc: Use image node_id 1 for calling a global function with example usage: make_keras_model(categorical_map) and returns: model_full