code: def build_model(
      num_users,
      num_items,
      class_num,
      layers=[20, 10],
      include_mf=True,
      mf_embed=20,
  ):
      import tensorflow as tf
      from tensorflow.keras.layers import (
          Input,
          Embedding,
          Dense,
          Flatten,
          concatenate,
          multiply,
      )
  
      num_layer = len(layers)
      user_input = Input(shape=(1,), dtype="int32", name="user_input")
      item_input = Input(shape=(1,), dtype="int32", name="item_input")
  
      mlp_embed_user = Embedding(
          input_dim=num_users,
          output_dim=int(layers[0] / 2),
          input_length=1,
      )(user_input)
      mlp_embed_item = Embedding(
          input_dim=num_items,
          output_dim=int(layers[0] / 2),
          input_length=1,
      )(item_input)
  
      user_latent = Flatten()(mlp_embed_user)
      item_latent = Flatten()(mlp_embed_item)
  
      mlp_latent = concatenate([user_latent, item_latent], axis=1)
      for idx in range(1, num_layer):
          layer = Dense(
              layers[idx], activation="relu", name="layer%d" % idx
          )
          mlp_latent = layer(mlp_latent)
  
      if include_mf:
          mf_embed_user = Embedding(
              input_dim=num_users, output_dim=mf_embed, input_length=1
          )(user_input)
          mf_embed_item = Embedding(
              input_dim=num_items, output_dim=mf_embed, input_length=1
          )(item_input)
          mf_user_flatten = Flatten()(mf_embed_user)
          mf_item_flatten = Flatten()(mf_embed_item)
  
          mf_latent = multiply([mf_user_flatten, mf_item_flatten])
          concated_model = concatenate([mlp_latent, mf_latent], axis=1)
          prediction = Dense(
              class_num, activation="softmax", name="prediction"
          )(concated_model)
      else:
          prediction = Dense(
              class_num, activation="softmax", name="prediction"
          )(mlp_latent)
  
      model = tf.keras.Model([user_input, item_input], prediction)
      return model
  
file_path: BigDL/python/friesian/example/ncf/ncf_train.py
imports: import math
  import argparse
  import pandas
  from bigdl.dllib.utils.log4Error import *
  from bigdl.dllib.feature.dataset import movielens
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.learn.tf2.estimator import Estimator
  from bigdl.friesian.feature import FeatureTable
label_desc: Use image node_id 1 for calling a global function with example usage: build_model(num_users, num_items, class_num, layers, include_mf, mf_embed) and returns: model