code: def test_numeric_split_direction(use_missing, zero_as_missing):
      if use_missing and zero_as_missing:
          pytest.skip(
              "use_missing and zero_as_missing both set to True"
          )
      X, y = make_synthetic_regression()
      rng = np.random.RandomState(0)
      zero_mask = rng.rand(X.shape[0]) < 0.05
      X[zero_mask, :] = 0
      if use_missing:
          nan_mask = ~zero_mask & (rng.rand(X.shape[0]) < 0.1)
          X[nan_mask, :] = np.nan
      ds = lgb.Dataset(X, y)
      params = {
          "num_leaves": 127,
          "min_child_samples": 1,
          "use_missing": use_missing,
          "zero_as_missing": zero_as_missing,
      }
      bst = lgb.train(params, ds, num_boost_round=1)
  
      case_with_zero = X[zero_mask][[0]]
      expected_leaf_zero = bst.predict(case_with_zero, pred_leaf=True)[
          0
      ]
      node = bst.dump_model()["tree_info"][0]["tree_structure"]
      while "decision_type" in node:
          direction = (
              lgb.plotting._determine_direction_for_numeric_split(
                  case_with_zero[0][node["split_feature"]],
                  node["threshold"],
                  node["missing_type"],
                  node["default_left"],
              )
          )
          node = (
              node["left_child"]
              if direction == "left"
              else node["right_child"]
          )
      assert node["leaf_index"] == expected_leaf_zero
  
      if use_missing:
          case_with_nan = X[nan_mask][[0]]
          expected_leaf_nan = bst.predict(
              case_with_nan, pred_leaf=True
          )[0]
          node = bst.dump_model()["tree_info"][0]["tree_structure"]
          while "decision_type" in node:
              direction = (
                  lgb.plotting._determine_direction_for_numeric_split(
                      case_with_nan[0][node["split_feature"]],
                      node["threshold"],
                      node["missing_type"],
                      node["default_left"],
                  )
              )
              node = (
                  node["left_child"]
                  if direction == "left"
                  else node["right_child"]
              )
          assert node["leaf_index"] == expected_leaf_nan
          assert expected_leaf_zero != expected_leaf_nan
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.model_selection import train_test_split
  import lightgbm
  from lightgbm.compat import GRAPHVIZ_INSTALLED, MATPLOTLIB_INSTALLED, PANDAS_INSTALLED, pd_DataFrame
  from .utils import load_breast_cancer, make_synthetic_regression
label_desc: Use image node_id 11 for calling a global function with example usage: test_numeric_split_direction(use_missing, zero_as_missing) without return types