:py:mod:`src.lscd`
==================

.. py:module:: src.lscd


Submodules
----------
.. toctree::
   :titlesonly:
   :maxdepth: 1

   apd/index.rst
   cluster_jsd/index.rst
   cos/index.rst
   model/index.rst
   permutation/index.rst


Package Contents
----------------

Classes
~~~~~~~

.. autoapisummary::

   src.lscd.APD
   src.lscd.ClusterJSD
   src.lscd.Cos
   src.lscd.BinaryThresholdModel
   src.lscd.GradedLSCDModel
   src.lscd.Permutation




.. py:class:: APD


   Bases: :py:obj:`src.lscd.model.GradedLSCDModel`

   .. py:attribute:: wic
      :type: APD.wic

      

   .. py:attribute:: use_pair_options
      :type: src.lemma.UsePairOptions

      

   .. py:method:: predict(lemma: src.lemma.Lemma) -> float

      Generates predictions for use pair samples for input lemma.

      :param lemma: lemma instance from data set
      :type lemma: Lemma
      :return: mean of pairwise distances
      :rtype: float


   .. py:method:: predict_all(lemmas: list[src.lemma.Lemma]) -> list[float]



.. py:class:: ClusterJSD


   Bases: :py:obj:`src.lscd.model.GradedLSCDModel`

   Helper class that provides a standard way to create an ABC using
   inheritance.

   .. py:attribute:: wsi
      :type: ClusterJSD.wsi

      

   .. py:method:: predict(lemma: src.lemma.Lemma) -> float



.. py:class:: Cos


   Bases: :py:obj:`src.lscd.model.GradedLSCDModel`

   .. py:attribute:: wic
      :type: src.wic.ContextualEmbedder

      

   .. py:method:: predict(lemma: src.lemma.Lemma) -> float


   .. py:method:: predict_all(lemmas: list[src.lemma.Lemma]) -> list[float]



.. py:class:: BinaryThresholdModel


   Bases: :py:obj:`BinaryModel`

   Helper class that provides a standard way to create an ABC using
   inheritance.

   .. py:class:: Config


      .. py:attribute:: json_encoders

         


   .. py:attribute:: threshold_fn
      :type: Callable[[list[float]], list[int]]

      

   .. py:attribute:: graded_model
      :type: GradedLSCDModel

      

   .. py:method:: predict(graded_predictions: list[float]) -> list[int]



.. py:class:: GradedLSCDModel


   Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`abc.ABC`

   Helper class that provides a standard way to create an ABC using
   inheritance.

   .. py:class:: Config


      .. py:attribute:: json_encoders

         


   .. py:method:: predict(lemma: src.lemma.Lemma) -> float
      :abstractmethod:


   .. py:method:: predict_all(lemmas: list[src.lemma.Lemma]) -> list[float]
      :abstractmethod:



.. py:class:: Permutation


   Bases: :py:obj:`src.lscd.model.GradedLSCDModel`

   .. py:attribute:: wic
      :type: src.wic.ContextualEmbedder

      

   .. py:attribute:: n_perms
      :type: int

      

   .. py:attribute:: whiten
      :type: bool

      

   .. py:attribute:: k
      :type: int | None

      

   .. py:method:: compute_kernel_bias(vecs: numpy.typing.NDArray[numpy.float32], k: int | None = None) -> tuple[numpy.typing.NDArray[numpy.float32], numpy.typing.NDArray[numpy.float32]]
      :staticmethod:

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


   .. py:method:: 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]
      :staticmethod:

      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.


   .. py:method:: euclidean_dist(m0: numpy.typing.NDArray[numpy.float32], m1: numpy.typing.NDArray[numpy.float32]) -> numpy.typing.NDArray[numpy.float32]
      :staticmethod:


   .. py:method:: get_n_rows(len_m0: int, len_m1: int) -> int


   .. py:method:: permute_indices(len_m0: int, len_m1: int) -> tuple[list[int], list[int]]


   .. py:method:: predict(lemma: src.lemma.Lemma) -> float


   .. py:method:: predict_all(lemmas: list[src.lemma.Lemma]) -> list[float]



