@tensorleap_custom_metric
code_loader.inner_leap_binder.leapbinder_decorators.tensorleap_preprocess.tensorleap_custom_metric
The purpose of the tensorleap_custom_metric decorator is to add a custom metric suited to your needs to the tensorleap platform.
@tensorleap_custom_metric(name='metrics',
direction=MetricDirection.Downward,
compute_insights=None)
def metrics(
tensor_1: npt.NDArray[np.float32],
tensor_2: npt.NDArray[np.float32],
...
) -> Union[npt.NDArray[np.float32], Dict[str, npt.NDArray[np.float32]]]:
passname
The name of the the metric
direction
(optional, defaults toMetricDirection.Downward)
For a metric where lower values are better use
MetricDirection.DownwardFor a metric where higher values are better use
MetricDirection.Upwards
compute_insights
(optional, defaults to None). Specify metrics that should not have insights computed on them:
in case the metric function returns a dictionary, compute_insights should return a dictionary as well, mapping metric names to booleans.
otherwise, compute_insights=False if this metric should be ommited when computing insights
Metric Function inputs:
np.ndarray tensors with a batch dimension
Metric Function outputs:
np.ndarray batched metric values
Examples
Basic Usage
Full script usage can be found at Integration Script.
Last updated
Was this helpful?

