plot_alignment_matrix_topk

class plot_alignment_matrix_topk(P: Tensor | ndarray, k: int = 1000, title: str = 'Top-k Alignment Scores', figsize: tuple[int, int] = (8, 6), save_path: str | None = None)[source]

Bases:

Visualizes an alignment matrix as a scatter plot of the top-k largest entries.

Parameters:
  • P (Union[torch.Tensor, np.ndarray]) – The alignment matrix to visualize.

  • k (int, optional) – Number of top entries to plot. Default is 1000.

  • title (str, optional) – Title of the plot. Default is “Top-k Alignment Scores”.

  • figsize (tuple[int, int], optional) – Size of the figure. Default is (8, 6).

  • save_path (Optional[str], optional) – Path to save the plot image. Default is None (not saving).