code: def _sampling_strategy_float(sampling_strategy, y, sampling_type):
      """Take a proportion of the majority (over-sampling) or minority
      (under-sampling) class in binary classification."""
      type_y = type_of_target(y)
      if type_y != "binary":
          raise ValueError(
              '"sampling_strategy" can be a float only when the type '
              "of target is binary. For multi-class, use a dict."
          )
      target_stats = _count_class_sample(y)
      if sampling_type == "over-sampling":
          n_sample_majority = max(target_stats.values())
          class_majority = max(target_stats, key=target_stats.get)
          sampling_strategy_ = {
              key: int(n_sample_majority * sampling_strategy - value)
              for (key, value) in target_stats.items()
              if key != class_majority
          }
          if any(
              [
                  n_samples <= 0
                  for n_samples in sampling_strategy_.values()
              ]
          ):
              raise ValueError(
                  "The specified ratio required to remove samples "
                  "from the minority class while trying to "
                  "generate new samples. Please increase the "
                  "ratio."
              )
      elif sampling_type == "under-sampling":
          n_sample_minority = min(target_stats.values())
          class_minority = min(target_stats, key=target_stats.get)
          sampling_strategy_ = {
              key: int(n_sample_minority / sampling_strategy)
              for (key, value) in target_stats.items()
              if key != class_minority
          }
          if any(
              [
                  n_samples > target_stats[target]
                  for target, n_samples in sampling_strategy_.items()
              ]
          ):
              raise ValueError(
                  "The specified ratio required to generate new "
                  "sample in the majority class while trying to "
                  "remove samples. Please increase the ratio."
              )
      else:
          raise ValueError(
              "'clean-sampling' methods do let the user specify the sampling ratio."
          )
      return sampling_strategy_
  
imports: import warnings
  from collections import OrderedDict
  from functools import wraps
  from inspect import Parameter, signature
  from numbers import Integral, Real
  import numpy
  from sklearn.base import clone
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils import check_array, column_or_1d
  from sklearn.utils.multiclass import type_of_target
  from sklearn.utils.validation import _num_samples
  from .fixes import _is_pandas_df
label_desc: Use image node_id 13 for calling a global function with example usage: _sampling_strategy_float(sampling_strategy, y, sampling_type) and returns: sampling_strategy_