class_docstr: Wrapper to run an algorithm with multiple dataset sizes
  and compute accuracy and speedup of cuml relative to sklearn
  baseline.
class_docstr_tok: ["Wrapper","to","run","an","algorithm","with","multiple","dataset","sizes","and","compute","accuracy","and","speedup","of","cuml","relative","to","sklearn","baseline","."]
code: def _run_one_size(
      self,
      algo_pair,
      n_samples,
      n_features,
      param_overrides={},
      cuml_param_overrides={},
      cpu_param_overrides={},
      dataset_param_overrides={},
      dtype=np.float32,
      run_cpu=True,
      device="gpu",
      verbose=False,
  ):
      data = datagen.gen_data(
          self.dataset_name,
          self.input_type,
          n_samples,
          n_features,
          dtype=dtype,
          test_fraction=self.test_fraction,
          **dataset_param_overrides,
      )
  
      setup_override = algo_pair.setup_cuml(
          data, **{**param_overrides, **cuml_param_overrides}
      )
  
      with using_device_type(device):
          cuml_timer = BenchmarkTimer(self.n_reps)
          for _ in cuml_timer.benchmark_runs():
              cuml_model = algo_pair.run_cuml(
                  data,
                  **{
                      **param_overrides,
                      **cuml_param_overrides,
                      **setup_override,
                  },
              )
          cu_elapsed = np.min(cuml_timer.timings)
  
      if algo_pair.accuracy_function:
          if algo_pair.cuml_data_prep_hook is not None:
              X_test, y_test = algo_pair.cuml_data_prep_hook(data[2:])
          else:
              X_test, y_test = data[2:]
  
          if hasattr(cuml_model, "predict"):
              y_pred_cuml = cuml_model.predict(X_test)
          else:
              y_pred_cuml = cuml_model.transform(X_test)
          if isinstance(y_pred_cuml, Series):
              y_pred_cuml = y_pred_cuml.to_numpy()
          cuml_accuracy = algo_pair.accuracy_function(
              y_test, y_pred_cuml
          )
      else:
          cuml_accuracy = 0.0
  
      cpu_accuracy = 0.0
      if run_cpu and algo_pair.cpu_class is not None:
          setup_override = algo_pair.setup_cpu(
              data, **param_overrides, **cpu_param_overrides
          )
  
          cpu_timer = BenchmarkTimer(self.n_reps)
          for rep in cpu_timer.benchmark_runs():
              cpu_model = algo_pair.run_cpu(
                  data,
                  **setup_override,
              )
          cpu_elapsed = np.min(cpu_timer.timings)
  
          if algo_pair.accuracy_function:
              if algo_pair.cpu_data_prep_hook is not None:
                  X_test, y_test = algo_pair.cpu_data_prep_hook(
                      data[2:]
                  )
              else:
                  X_test, y_test = data[2:]
              if hasattr(cpu_model, "predict"):
                  y_pred_cpu = cpu_model.predict(X_test)
              else:
                  y_pred_cpu = cpu_model.transform(X_test)
              cpu_accuracy = algo_pair.accuracy_function(
                  y_test, np.asarray(y_pred_cpu)
              )
      else:
          cpu_elapsed = 0.0
  
      if n_samples == 0:
          # Update n_samples = training samples + testing samples
          n_samples = data[0].shape[0] + data[2].shape[0]
  
      if n_features == 0:
          # Update n_features
          n_features = data[0].shape[1]
  
      return dict(
          cuml_time=cu_elapsed,
          cpu_time=cpu_elapsed,
          cuml_acc=cuml_accuracy,
          cpu_acc=cpu_accuracy,
          speedup=cpu_elapsed / float(cu_elapsed),
          n_samples=n_samples,
          n_features=n_features,
          **param_overrides,
          **cuml_param_overrides,
          **cpu_param_overrides,
          **dataset_param_overrides,
      )
  
file_path: cuml/python/cuml/benchmark/runners.py
imports: from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.benchmark import datagen
  from cuml.common.device_selection import using_device_type
  import warnings
  import time
  import itertools
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 2 for calling the AccuracyComparisonRunner obj's underlying member method code with example usage: obj._run_one_size(algo_pair, n_samples, n_features, param_overrides, cuml_param_overrides, cpu_param_overrides, dataset_param_overrides, dtype, run_cpu, device, verbose) and returns: dict