code: def test_imbalanced_dataset(requests_mock: Mocker):
      pd.set_option("display.max_columns", 1000)
      base_dir = os.path.dirname(os.path.realpath(__file__))
      url = "http://fake_url2"
  
      mock_default_requests(requests_mock, url)
      search_task_id = mock_initial_search(requests_mock, url)
      validation_search_task_id = mock_validation_search(
          requests_mock, url, search_task_id
      )
      mock_initial_progress(requests_mock, url, search_task_id)
      mock_validation_progress(
          requests_mock, url, validation_search_task_id
      )
      ads_search_task_id = mock_initial_and_validation_summary(
          requests_mock,
          url,
          search_task_id,
          validation_search_task_id,
      )
      mock_get_metadata(requests_mock, url, search_task_id)
  
      mock_get_task_metadata_v2(
          requests_mock,
          url,
          ads_search_task_id,
          ProviderTaskMetadataV2(
              features=[
                  FeaturesMetadataV2(
                      name="ads_feature",
                      type="numeric",
                      source="ads",
                      hit_rate=100.0,
                      shap_value=0.9,
                  ),
              ],
              hit_rate_metrics=HitRateMetrics(
                  etalon_row_count=8000,
                  max_hit_count=8000,
                  hit_rate=1.0,
                  hit_rate_percent=100.0,
              ),
              eval_set_metrics=[],
          ),
      )
      path_to_mock_features = os.path.join(
          base_dir, "test_data/binary/features_imbalanced.parquet"
      )
  
      mock_raw_features(
          requests_mock, url, search_task_id, path_to_mock_features
      )
      mock_validation_raw_features(
          requests_mock,
          url,
          validation_search_task_id,
          path_to_mock_features,
      )
      mock_validation_raw_features(
          requests_mock,
          url,
          validation_search_task_id,
          path_to_mock_features,
          metrics_calculation=True,
      )
  
      train_path = os.path.join(
          base_dir, "test_data/binary/initial_train_imbalanced.parquet"
      )
      train_df = pd.read_parquet(train_path)
      train_features = train_df.drop(columns="target")
      train_target = train_df["target"]
  
      default_min_sample_threshold = Dataset.MIN_SAMPLE_THRESHOLD
      Dataset.MIN_SAMPLE_THRESHOLD = 7_000
  
      search_keys = {
          "phone_num": SearchKey.PHONE,
          "rep_date": SearchKey.DATE,
      }
      enricher = FeaturesEnricher(
          search_keys=search_keys,
          endpoint=url,
          api_key="fake_api_key",
          date_format="%Y-%m-%d",
          logs_enabled=False,
      )
  
      try:
          enricher.fit(
              train_features, train_target, calculate_metrics=False
          )
  
          metrics = enricher.calculate_metrics()
  
          print(metrics)
  
          assert metrics.loc[0, "Rows"] == 8000
          assert metrics.loc[0, "Mean target"] == 0.125
          assert metrics.loc[0, "Enriched GINI"] == 0.0
      finally:
          Dataset.MIN_SAMPLE_THRESHOLD = default_min_sample_threshold
  
imports: import os
  from datetime import date
  from typing import List, Optional
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from requests_mock.mocker import Mocker
  from upgini import FeaturesEnricher, SearchKey
  from upgini.dataset import Dataset
  from upgini.errors import ValidationError
  from upgini.http import _RestClient
  from upgini.metadata import CVType, FeaturesMetadataV2, HitRateMetrics, ModelEvalSet, ModelTaskType, ProviderTaskMetadataV2, RuntimeParameters
  from upgini.resource_bundle import bundle
  from upgini.search_task import SearchTask
  from upgini.utils.datetime_utils import DateTimeSearchKeyConverter
  from .utils import mock_default_requests, mock_get_metadata, mock_get_task_metadata_v2, mock_initial_and_validation_summary, mock_initial_progress, mock_initial_search, mock_initial_summary, mock_raw_features, mock_validation_progress, mock_validation_raw_features, mock_validation_search, mock_validation_summary
label_desc: Use image node_id 24 for calling a global function with example usage: test_imbalanced_dataset(requests_mock) without return types