langspace.probe.interpolation package

Module contents

class langspace.probe.interpolation.InterpolationProbe(model: LangVAE, data: List[Tuple[Sentence, Sentence]], eval: List[InterpolationMetric], annotations: Dict[str, List[str]] = None)[source]

Bases: LatentSpaceProbe

A probe for evaluating interpolation in the latent space of an LM-VAE.

This class facilitates the exploration of latent space by interpolating between pairs of sentence encodings.

model

The language VAE model to be probed.

Type:

LangVAE

data

A list of sentence pairs (source and target) for interpolation.

Type:

List[Tuple[Sentence, Sentence]]

eval

A list of evaluation metrics used to assess the interpolation quality.

Type:

List[InterpolationMetric]

annotations

Optional dictionary of annotation types to be processed and all their

Type:

Dict[str, List[str]]

possible values, for conditional encoding.
report() DataFrame[source]

Generate a detailed report of the interpolation results across the latent space.

Returns:

A report containing the interpolation results. Each row corresponds to a sentence pair with:
  • ’source’: Surface text of the source sentence.

  • ’target’: Surface text of the target sentence.

  • ’distance’: The computed smoothness (or distance) metric.

  • ’generate’: A newline-separated string of the generated interpolation sentences.

Return type:

DataFrame