code: def load_mlsr_10k(data_path: str, cache_path: str) -> RelDataCV:
      """Load the MSLR10k dataset from data_path and cache a pickle object in cache_path.
  
      Returns
      -------
  
      A list of tuples [(X, y, qid), ...].
  
      """
      root_path = os.path.expanduser(args.data)
      cacheroot_path = os.path.expanduser(args.cache)
      cache_path = os.path.join(cacheroot_path, "MSLR_10K_LETOR.pkl")
  
      # Use only the Fold1 for demo:
      # Train,      Valid, Test
      # {S1,S2,S3}, S4,    S5
      fold = 1
  
      if not os.path.exists(cache_path):
          fold_path = os.path.join(root_path, f"Fold{fold}")
          train_path = os.path.join(fold_path, "train.txt")
          valid_path = os.path.join(fold_path, "vali.txt")
          test_path = os.path.join(fold_path, "test.txt")
          X_train, y_train, qid_train = load_svmlight_file(
              train_path, query_id=True, dtype=np.float32
          )
          y_train = y_train.astype(np.int32)
          qid_train = qid_train.astype(np.int32)
  
          X_valid, y_valid, qid_valid = load_svmlight_file(
              valid_path, query_id=True, dtype=np.float32
          )
          y_valid = y_valid.astype(np.int32)
          qid_valid = qid_valid.astype(np.int32)
  
          X_test, y_test, qid_test = load_svmlight_file(
              test_path, query_id=True, dtype=np.float32
          )
          y_test = y_test.astype(np.int32)
          qid_test = qid_test.astype(np.int32)
  
          data = RelDataCV(
              train=(X_train, y_train, qid_train),
              test=(X_test, y_test, qid_test),
              max_rel=4,
          )
  
          with open(cache_path, "wb") as fd:
              pkl.dump(data, fd)
  
      with open(cache_path, "rb") as fd:
          data = pkl.load(fd)
  
      return data
  
file_path: xgboost/demo/guide-python/learning_to_rank.py
imports: from __future__ import annotations
  import argparse
  import json
  import os
  import pickle
  import numpy
  import pandas
  from sklearn.datasets import load_svmlight_file
  import xgboost
  from xgboost.testing.data import RelDataCV, simulate_clicks, sort_ltr_samples
label_desc: Use image node_id 1 for calling a global function with example usage: load_mlsr_10k(data_path, cache_path) and returns: data