MetricWrapper#
- class MetricWrapper(name: str, func: Callable, display_name: str, abbr: str | None = None, **default_params: Any)#
A wrapper for metric functions with default parameters and metadata.
Wraps metric functions and provides methods to update parameters and retrieve the metric function with applied parameters. Also handles display names and abbreviations for reporting.
- Parameters:
- namestr
Name of the metric
- funccallable
Metric function to wrap
- display_namestr
Human-readable name for display
- abbrstr, optional
Abbreviation for the metric, by default None
- **default_paramsAny
Default parameters for the metric function
- Attributes:
- namestr
Name of the metric
- funccallable
The wrapped metric function
- display_namestr
Human-readable display name
- abbrstr
Abbreviation (defaults to name if not provided)
- paramsdict
Current parameters for the metric
- _func_with_paramscallable
Metric function with parameters applied
- scorercallable
Scikit-learn scorer created from the metric
- get_func_with_params() Callable#
Get the metric function with current parameters applied.
- Returns:
- callable
Deep copy of the metric function with parameters
- set_params(**params: Any)#
Update parameters for the metric function and scorer.
- Parameters:
- **paramsAny
New parameters to update or add