src.lscd.permutation#

Module Contents#

Classes#

Permutation

class src.lscd.permutation.Permutation#

Bases: src.lscd.model.GradedLSCDModel

wic: src.wic.ContextualEmbedder#
n_perms: int#
whiten: bool#
k: int | None#
static compute_kernel_bias(vecs: numpy.typing.NDArray[numpy.float32], k: int | None = None) tuple[numpy.typing.NDArray[numpy.float32], numpy.typing.NDArray[numpy.float32]]#

vecs = matrix (n x 768) with the sentence representations of your whole dataset (in the paper they use train, val and test sets)

static transform_and_normalize(vecs: numpy.typing.NDArray[numpy.float32], kernel: numpy.typing.NDArray[numpy.float32] | None = None, bias: numpy.typing.NDArray[numpy.float32] | None = None) numpy.typing.NDArray[numpy.float32]#

Kernel and bias are W and -mu from previous function. They’re passed to this function when inputing vecs vecs = vectors we need to whiten.

static euclidean_dist(m0: numpy.typing.NDArray[numpy.float32], m1: numpy.typing.NDArray[numpy.float32]) numpy.typing.NDArray[numpy.float32]#
get_n_rows(len_m0: int, len_m1: int) int#
permute_indices(len_m0: int, len_m1: int) tuple[list[int], list[int]]#
predict(lemma: src.lemma.Lemma) float#
predict_all(lemmas: list[src.lemma.Lemma]) list[float]#