code: def train_and_eval():
      """Runs training and evaluation with the `RankingPipeline`."""
      # The below contains a set of common flags for a TF-Ranking model. You need to
      # include all of them for adopting the `RankingPipeline`.
      hparams = dict(
          train_input_pattern=FLAGS.train_input_pattern,
          eval_input_pattern=FLAGS.eval_input_pattern,
          learning_rate=FLAGS.learning_rate,
          train_batch_size=FLAGS.train_batch_size,
          eval_batch_size=FLAGS.eval_batch_size,
          checkpoint_secs=FLAGS.checkpoint_secs,
          num_checkpoints=FLAGS.num_checkpoints,
          num_train_steps=FLAGS.num_train_steps,
          num_eval_steps=FLAGS.num_eval_steps,
          loss=FLAGS.loss,
          list_size=FLAGS.list_size,
          listwise_inference=FLAGS.listwise_inference,
          convert_labels_to_binary=FLAGS.convert_labels_to_binary,
          model_dir=FLAGS.model_dir,
      )
  
      estimator = tfr.estimator.EstimatorBuilder(
          context_feature_columns=context_feature_columns(),
          example_feature_columns=example_feature_columns(),
          scoring_function=scoring_function,
          hparams=hparams,
      ).make_estimator()
  
      ranking_pipeline = tfr.ext.pipeline.RankingPipeline(
          context_feature_columns=context_feature_columns(),
          example_feature_columns=example_feature_columns(),
          hparams=hparams,
          estimator=estimator,
          label_feature_name="relevance",
          label_feature_type=tf.int64,
          best_exporter_metric="metric/ndcg_5",
      )
  
      ranking_pipeline.train_and_eval()
  
file_path: ranking/tensorflow_ranking/extension/examples/pipeline_example.py
imports: from absl import flags
  import tensorflow
  from tensorflow import estimator
  import tensorflow_ranking
label_desc: Use image node_id 4 for calling a global function with example usage: train_and_eval() without return types