code: def test_checkpoint_freq(ray_start_4_cpus, freq_end_expected):
      freq, end, expected = freq_end_expected
  
      train_dataset = ray.data.from_pandas(train_df)
      valid_dataset = ray.data.from_pandas(test_df)
      trainer = XGBoostTrainer(
          run_config=ray.train.RunConfig(
              checkpoint_config=ray.train.CheckpointConfig(
                  checkpoint_frequency=freq, checkpoint_at_end=end
              )
          ),
          scaling_config=scale_config,
          label_column="target",
          params=params,
          num_boost_round=25,
          datasets={
              TRAIN_DATASET_KEY: train_dataset,
              "valid": valid_dataset,
          },
      )
      result = trainer.fit()
  
      # Assert number of checkpoints
      assert len(result.best_checkpoints) == expected, str(
          [
              (metrics["training_iteration"], cp)
              for cp, metrics in result.best_checkpoints
          ]
      )
  
      # Assert checkpoint numbers are increasing
      cp_paths = [cp.path for cp, _ in result.best_checkpoints]
      assert cp_paths == sorted(cp_paths), str(cp_paths)
  
imports: import json
  import pandas
  import pytest
  import xgboost
  from sklearn.datasets import load_breast_cancer
  from sklearn.model_selection import train_test_split
  import ray
  from ray import train, tune
  from ray.train import ScalingConfig
  from ray.train.constants import TRAIN_DATASET_KEY
  from ray.train.xgboost import XGBoostTrainer
label_desc: Use image node_id 7 for calling a global function with example usage: test_checkpoint_freq(ray_start_4_cpus, freq_end_expected) without return types