code: def test_sparse(self, dataset):
      param = {"tree_method": "hist", "max_bin": 64}
      hist_result = train_result(param, dataset.get_dmat(), 16)
      note(str(hist_result))
      assert tm.non_increasing(hist_result["train"][dataset.metric])
  
      param = {"tree_method": "approx", "max_bin": 64}
      approx_result = train_result(param, dataset.get_dmat(), 16)
      note(str(approx_result))
      assert tm.non_increasing(approx_result["train"][dataset.metric])
  
      np.testing.assert_allclose(
          hist_result["train"]["rmse"], approx_result["train"]["rmse"]
      )
  
imports: import json
  from string import ascii_lowercase
  from typing import Any, Dict
  import numpy
  import pytest
  from hypothesis import given, note, settings, strategies
  import xgboost
  from xgboost import testing
  from xgboost.testing.params import cat_parameter_strategy, exact_parameter_strategy, hist_cache_strategy, hist_parameter_strategy
  from xgboost.testing.updater import check_categorical_missing, check_categorical_ohe, check_get_quantile_cut, check_init_estimation, check_quantile_loss, train_result
label_desc: Use image node_id 7 for calling the TestTreeMethod obj's underlying member method code with example usage: obj.test_sparse(dataset) without return types