Ejemplo n.º 1
0
    def __init__(
        self,
        name: str,
        f: Callable[[TParameterization], float],
        noise_sd: Optional[float] = 0.0,
        lower_is_better: Optional[bool] = None,
    ) -> None:
        """
        Metric is computed by evaluating a deterministic function, implemented in f.

        Args:
            name: Name of the metric.
            f: A callable accepting a dictionary from parameter names to
                values and returning a float metric value.
            noise_sd: Scale of normal noise added to the function result. If
                None, interpret the function as nosiy with unknown noise level.
            lower_is_better: Flag for metrics which should be minimized.

        Note: Since this metric setup uses a generic callable it cannot be serialized
        and will not play well with storage.
        """
        self._f = f
        self.noise_sd = noise_sd
        Metric.__init__(self, name=name, lower_is_better=lower_is_better)