code: def train_and_eval():
      """Train and Evaluate."""
  
      hparams = {
          "train_input_pattern": FLAGS.train_input_pattern,
          "eval_input_pattern": FLAGS.eval_input_pattern,
          "learning_rate": FLAGS.learning_rate,
          "train_batch_size": FLAGS.batch_size,
          "eval_batch_size": FLAGS.batch_size,
          "predict_batch_size": FLAGS.batch_size,
          "num_train_steps": FLAGS.num_train_steps,
          "num_eval_steps": FLAGS.num_eval_steps,
          "checkpoint_secs": FLAGS.checkpoint_secs,
          "num_checkpoints": FLAGS.num_checkpoints,
          "loss": FLAGS.loss,
          "list_size": FLAGS.list_size,
          "listwise_inference": True,
          "convert_labels_to_binary": False,
          "model_dir": FLAGS.model_dir,
      }
  
      optimizer = optimizers.get_optimizer_instance(
          "Adam", learning_rate=FLAGS.learning_rate
      )
  
      estimator = tfr.estimator.EstimatorBuilder(
          context_feature_columns=context_feature_columns(),
          example_feature_columns=example_feature_columns(),
          scoring_function=scoring_function,
          transform_function=transform_function,
          optimizer=optimizer,
          loss_reduction=tf.compat.v1.losses.Reduction.MEAN,
          hparams=hparams,
      ).make_estimator()
  
      ranking_pipeline = DASALCPipeline(
          context_feature_columns=context_feature_columns(),
          example_feature_columns=example_feature_columns(),
          hparams=hparams,
          estimator=estimator,
          label_feature_name="utility",
          label_feature_type=tf.int64,
          best_exporter_metric="metric/ndcg_5",
      )
  
      ranking_pipeline.train_and_eval()
  
file_path: ranking/tensorflow_ranking/research/dasalc.py
imports: from absl import flags
  import tensorflow
  from tensorflow import estimator
  from tensorflow.python.estimator.canned import optimizers
  import tensorflow_ranking
label_desc: Use image node_id 5 for calling a global function with example usage: train_and_eval() without return types