code: def run_test_imbalance_local(
      input_df,
      config,
      balance,
  ):
      model = LudwigModel(config)
      _, output_dataset, output_dir = model.train(
          input_df,
          skip_save_model=True,
          skip_save_log=True,
          skip_save_progress=True,
          skip_save_processed_input=True,
          skip_save_training_description=True,
          skip_save_training_statistics=True,
      )
  
      input_train_set = input_df.sample(frac=0.7, replace=False)
      processed_len = output_dataset[0].size
      processed_target_pos = sum(
          output_dataset[0].dataset["Label_2Xl8CP"]
      )
      processed_target_neg = (
          len(output_dataset[0].dataset["Label_2Xl8CP"])
          - processed_target_pos
      )
      assert len(input_train_set) == 140
      assert (
          0.05
          <= len(input_train_set[input_train_set["Label"] == 1])
          / len(input_train_set)
          <= 0.15
      )
      assert (
          round(processed_target_pos / processed_target_neg, 1) == 0.5
      )
      assert isinstance(model.backend, LocalBackend)
  
      if balance == "oversample_minority":
          assert len(input_train_set) < processed_len
          assert 55 <= processed_target_pos <= 75
          assert 110 <= processed_target_neg <= 150
  
      if balance == "undersample_majority":
          assert len(input_train_set) > processed_len
          assert 7 <= processed_target_pos <= 20
          assert 14 <= processed_target_neg <= 40
  
file_path: ludwig/tests/integration_tests/test_class_imbalance_feature.py
imports: import contextlib
  import os
  import shutil
  import numpy
  import pandas
  import pytest
  from ludwig.api import LudwigModel
  from ludwig.backend import LocalBackend
  from tests.integration_tests.utils import create_data_set_to_use, RAY_BACKEND_CONFIG, spawn
label_desc: Use image node_id 3 for calling a global function with example usage: run_test_imbalance_local(input_df, config, balance) without return types