code: def test_xgb_model():
      task, inputs, results = get_sample_records(50)
  
      model = auto_scheduler.XGBModel(num_warmup_sample=-1)
      model.update(inputs, results)
      preds = model.predict(task, [x.state for x in inputs])
      assert len(preds) == len(inputs)
  
      costs = [np.mean([x.value for x in res.costs]) for res in results]
      throughputs = np.min(costs) / costs
  
      # test regression quality
      rmse = np.sqrt(
          np.mean(
              [
                  np.square(pred - label)
                  for pred, label in zip(preds, throughputs)
              ]
          )
      )
      assert rmse <= 0.3
  
      # test loading a record file
      tmpdir = tvm.contrib.utils.tempdir()
      tmpfile = tmpdir.relpath("test1")
      auto_scheduler.save_records(tmpfile, inputs, results)
      model.update_from_file(tmpfile)
  
      # test model serialization
      tmpfile = tmpdir.relpath("test2")
      model.save(tmpfile)
      model.load(tmpfile)
  
file_path: tvm/tests/python/auto_scheduler/test_auto_scheduler_cost_model.py
imports: import tempfile
  import numpy
  import tvm
  from tvm import auto_scheduler
  from tvm.testing.auto_scheduler import matmul_auto_scheduler_test
label_desc: Use image node_id 3 for calling a global function with example usage: test_xgb_model() without return types