Skip to content

PlanPaths

PlanPaths(n_batches=1)

Bases: PathEnsemble

Random paths through the observed cells, drawn from plans between snapshots.

On each of n_batches mini-batches, min_k n_k // n_batches cells are sub-sampled in every snapshot, and :meth:plan couples the (pushed) cells of snapshot k with the cells of snapshot k + 1. Paths start uniformly in the first snapshot and draw each next cell from the current cell's row of the plan (Markov gluing).

Parameters:

  • n_batches (int, default: 1 ) –

    Number of mini-batches.

Attributes:

  • batches_ (list of tuple) –

    For every mini-batch, the sub-sampled cells of each snapshot and the plans.

  • batch_size_ (int) –

    Number of cells per snapshot in a mini-batch.

  • masses_ (torch.Tensor of shape (nsnaps,)) –

    Total mass of each snapshot.

moments(n_paths=None, generator=None)

First two moments of the path nodes.

Empirical moments of :meth:sample (normalized by the number of paths). Ensembles fitted on exact laws override this with the exact moments.

Parameters:

  • n_paths (int or None, default: None ) –

    Number of paths passed to :meth:sample.

  • generator (Generator or None, default: None ) –

    Optional RNG for reproducible sampling.

Returns:

  • means ( torch.Tensor of shape (nsnaps, ndim) ) –

    Mean of the nodes at every snapshot time.

  • covs ( torch.Tensor of shape (nsnaps, nsnaps, ndim, ndim) ) –

    covs[j, k] is the covariance between the nodes at times j and k.

plan(src, tgt, mass_src, mass_tgt) abstractmethod

Plan between source and target cells.

Parameters:

  • src (torch.Tensor of shape (n_src, ndim)) –

    Source cells (pushed cells of snapshot k).

  • tgt (torch.Tensor of shape (n_tgt, ndim)) –

    Target cells (cells of snapshot k + 1).

  • mass_src (float or Tensor) –

    Total masses of the source and target snapshots.

  • mass_tgt (float or Tensor) –

    Total masses of the source and target snapshots.

Returns:

  • torch.Tensor of shape (n_src, n_tgt) –

    Plan normalized to sum to one.