class_docstr: Wraps an hyperparameter nested dict or flat dict, and offer a few more functions to process
  all contained HyperparameterDistribution.
  
  This can be set on a Pipeline with the method ``set_hyperparams_space``.
  
  Calling ``.rvs()`` on an ``HyperparameterSpace`` results in ``HyperparameterSamples``.
class_docstr_tok: ["Wraps","an","hyperparameter","nested","dict","or","flat","dict",",","and","offer","a","few","more","functions","to","process","all","contained","HyperparameterDistribution",".","This","can","be","set","on","a","Pipeline","with","the","method","``","set_hyperparams_space","``",".","Calling","``",".rvs","(",")","``","on","an","``","HyperparameterSpace","``","results","in","``","HyperparameterSamples","``","."]
docstr: Override of the RecursiveDict's default _patch_arg(arg) method.
  
  :param arg: arg to patch if needed.
  :return: (patched_arg, did_patch)
docstr_tok: ["Override","of","the","RecursiveDict","'s","default","_patch_arg","(","arg",")","method",".",":","param","arg",":","arg","to","patch","if","needed",".",":","return",":","(","patched_arg",",","did_patch",")"]
code: def _patch_arg(self, arg):
      """
      Override of the RecursiveDict's default _patch_arg(arg) method.
  
      :param arg: arg to patch if needed.
      :return: (patched_arg, did_patch)
      """
      did_patch = False
      if hasattr(arg, "dist") and isinstance(arg.dist, rv_generic):
          if isinstance(arg.dist, rv_continuous):
              arg, did_patch = (
                  ScipyContinuousDistributionWrapper(arg),
                  True,
              )
          elif isinstance(arg.dist, rv_discrete):
              arg, did_patch = (
                  ScipyDiscreteDistributionWrapper(arg),
                  True,
              )
      assert isinstance(arg, HyperparameterDistribution), (
          f"Hyperparameter space's distributions must be a dict of `HyperparameterDistributions`. "
          f"got `{arg}` of type `{type(arg)}` instead. You might consider using a "
          f"{FixedHyperparameter.__name__} class like {FixedHyperparameter}({arg}) to have a fixed value."
      )
      return arg, did_patch
  
imports: import typing
  from collections import Counter, OrderedDict, defaultdict
  from copy import copy
  from typing import Any, Dict, Iterable, List, Set, Union
  from neuraxle.hyperparams.distributions import FixedHyperparameter, HPSampledValue, HyperparameterDistribution
  from neuraxle.hyperparams.scipy_distributions import ScipyContinuousDistributionWrapper, ScipyDiscreteDistributionWrapper
  from scipy.stats import rv_continuous, rv_discrete
  from scipy.stats._distn_infrastructure import rv_generic
label_desc: Use image node_id 2 for calling the HyperparameterSpace obj's underlying member method code with example usage: obj._patch_arg(arg) and returns: arg,  did_patch