Skip to content

Commit dd89efd

Browse files
Remove rbf kernel from MMD file
1 parent 31579ce commit dd89efd

File tree

1 file changed

+1
-18
lines changed
  • frouros/detectors/data_drift/batch/distance_based

1 file changed

+1
-18
lines changed

frouros/detectors/data_drift/batch/distance_based/mmd.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,14 @@
66

77
import numpy as np # type: ignore
88
import tqdm # type: ignore
9-
from scipy.spatial.distance import cdist # type: ignore
109

1110
from frouros.callbacks.batch.base import BaseCallbackBatch
1211
from frouros.detectors.data_drift.base import MultivariateData
1312
from frouros.detectors.data_drift.batch.distance_based.base import (
1413
BaseDistanceBased,
1514
DistanceResult,
1615
)
17-
18-
19-
def rbf_kernel(
20-
X: np.ndarray, Y: np.ndarray, std: float = 1.0 # noqa: N803
21-
) -> np.ndarray:
22-
"""Radial basis function kernel between X and Y matrices.
23-
24-
:param X: X matrix
25-
:type X: numpy.ndarray
26-
:param Y: Y matrix
27-
:type Y: numpy.ndarray
28-
:param std: standard deviation value
29-
:type std: float
30-
:return: Radial basis kernel matrix
31-
:rtype: numpy.ndarray
32-
"""
33-
return np.exp(-cdist(X, Y, "sqeuclidean") / 2 * std**2)
16+
from frouros.utils.kernels import rbf_kernel
3417

3518

3619
class MMD(BaseDistanceBased):

0 commit comments

Comments
 (0)