lm_polygraph.estimators.relative_mahalanobis_distance module

class lm_polygraph.estimators.relative_mahalanobis_distance.RelativeMahalanobisDistanceSeq(embeddings_type: str = 'decoder', parameters_path: str = None, normalize: bool = False)[source]

Bases: Estimator

Ren et al. (2023) showed that it might be useful to adjust the Mahalanobis distance score by subtracting from it the other Mahalanobis distance MD_0(x) computed for some large general purpose dataset covering many domain. RMD(x) = MD(x) - MD_0(x)

lm_polygraph.estimators.relative_mahalanobis_distance.load_array(filename)[source]
lm_polygraph.estimators.relative_mahalanobis_distance.save_array(array, filename)[source]