bencher.variables.parametrised_sweep ==================================== .. py:module:: bencher.variables.parametrised_sweep Attributes ---------- .. autoapisummary:: bencher.variables.parametrised_sweep._input_result_cache Classes ------- .. autoapisummary:: bencher.variables.parametrised_sweep._InputResult bencher.variables.parametrised_sweep.ParametrizedSweep Module Contents --------------- .. py:class:: _InputResult Bases: :py:obj:`tuple` .. py:attribute:: inputs .. py:attribute:: results .. py:data:: _input_result_cache :type: dict[tuple, _InputResult] .. py:class:: ParametrizedSweep(**params) Bases: :py:obj:`param.Parameterized` Parent class for all Sweep types that need a custom hash .. py:method:: param_hash(param_type: param.Parameterized, hash_value: bool = True) -> int :staticmethod: A custom hash function for parametrised types with options for hashing the value of the type and hashing metadata :param param_type: A parameter :type param_type: Parameterized :param hash_value: use the value as part of the hash. Defaults to True. :type hash_value: bool, optional :param # hash_meta: use metadata as part of the hash. Defaults to False. :type # hash_meta: bool, optional :returns: a hash :rtype: int .. py:method:: hash_persistent() -> str A hash function that avoids the PYTHONHASHSEED 'feature' which returns a different hash value each time the program is run .. py:method:: update_params_from_kwargs(**kwargs) -> None Given a dictionary of kwargs, set the parameters of the passed class 'self' to the values in the dictionary. .. py:method:: get_input_and_results(include_name: bool = False) -> tuple[dict, dict] :classmethod: Get dictionaries of input parameters and result parameters :param cls: A parametrised class :param include_name: Include the name parameter that all parametrised classes have. Default False :type include_name: bool :returns: A tuple containing the inputs and result parameters as dictionaries :rtype: tuple[dict, dict] .. py:method:: get_inputs_as_dict() -> dict Get the key:value pairs for all the input variables .. py:method:: get_results_values_as_dict(holomap=None) -> dict Get a dictionary of result variables with the name and the current value .. py:method:: get_inputs_only() -> list[param.Parameter] :classmethod: Return a list of input parameters :returns: A list of input parameters :rtype: list[param.Parameter] .. py:method:: filter_fn(item, p_name) :staticmethod: .. py:method:: get_input_defaults(override_defaults: list | None = None) -> list[tuple[param.Parameter, Any]] :classmethod: .. py:method:: get_input_defaults_override(**kwargs) -> dict[str, Any] :classmethod: .. py:method:: get_results_only() -> list[param.Parameter] :classmethod: Return a list of result parameters :returns: A list of result parameters :rtype: list[param.Parameter] .. py:method:: get_inputs_as_dims(compute_values=False, remove_dims: str | list[str] | None = None) -> list[holoviews.Dimension] :classmethod: .. py:method:: to_dynamic_map(callback=None, name=None, remove_dims: str | list[str] | None = None, result_var: str | None = None) -> holoviews.DynamicMap .. py:method:: to_gui(result_var: str | None = None, **kwargs) .. py:method:: to_holomap(callback, remove_dims: str | list[str] | None = None) -> holoviews.DynamicMap .. py:method:: __call__(**kwargs) -> dict Dispatch to benchmark() if overridden, otherwise use legacy path. :returns: a dictionary with all the result variables as named key value pairs. :rtype: dict .. py:method:: benchmark() Override this with your benchmark logic. When called, all sweep parameters (self.x, etc.) are already set. Set result variables (self.result, etc.) directly on self. No need to call update_params_from_kwargs or super().__call__(). .. py:method:: plot_hmap(**kwargs) .. py:method:: to_bench(run_cfg=None, report=None, name=None) Create a Bench instance from this ParametrizedSweep. .. py:method:: to_optimize(n_trials=100, run_cfg=None, **kwargs) Create a Bench and run optimization in one call. :param n_trials: Number of optuna trials. :param run_cfg: Optional BenchRunCfg. :param \*\*kwargs: Forwarded to ``Bench.optimize()``. :returns: OptimizeResult wrapping the completed study. .. py:method:: to_bench_runner(run_cfg=None, name=None) Create a BenchRunner instance from this ParametrizedSweep. Enables fluent chaining like: MyConfig().to_bench_runner().add(func).run(subsampling_divisions=2, max_subsampling_divisions=4)