mlnext.anomaly.hit_rate_at_p¶
- mlnext.anomaly.hit_rate_at_p(dims: List[float] | ndarray[Any, dtype[_ScalarType_co]], ranking: List[float] | ndarray[Any, dtype[_ScalarType_co]], *, p: Literal[100, 150] = 100) float[source]¶
Equals the percentage of overlapping dimensions between
dimsand the top contributing dimensions in therankingsuggested by OmniAnomaly.- Parameters:
dims (T.List[float]) – (Ground truth) Array which contains the dimensions indeed contributing to a given anomaly.
ranking (T.List[float]) – Array of all dimensions ordered by their contributions.
p (literal) – Number of dimensions (
len(dims) * p/100) looked up inranking.
- Returns:
Returns the HitRate@P.
- Return type:
float
Example
>>> import mlnext >>> mlnext.hit_rate_at_p([6, 2], [6, 5, 1, 4, 3, 2], p=100) 0.5