Skip to content

UFM_OT_

UFM_OT_(dist, times, net, interp=None, growth_model=None, bs=None, fac=1, n_epochs=2000, lr=0.001, alpha_ann=0.5, scheduler_factory=None, paths=None, n_rounds=1, push_steps=8, verbose=True, generator=None)

Two-phase FM: optimize growth first, then drift with learned masses.

Parameters:

  • dist (list of torch.Tensor) –

    Snapshot list where dist[k] has shape (n_k, ndim).

  • times (torch.Tensor of shape (n_snaps,)) –

    Snapshot times.

  • net (Module) –

    Drift model receiving (x, t) as input.

  • interp (object or None, default: None ) –

    Interpolant implementing fit and predict. If None, LinearInterpolant() is used.

  • growth_model (Module or None, default: None ) –

    Optional growth model receiving spatial coordinates only.

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

    Number of sampled trajectories per optimization step. If None, use all sampled trajectories.

  • fac (int, default: 1 ) –

    Number of interpolation nodes per snapshot interval multiplier.

  • n_epochs (int, default: 2000 ) –

    Number of optimizer iterations for each phase.

  • lr (float, default: 1e-3 ) –

    Learning rate for Adam optimizers.

  • alpha_ann (float, default: 0.5 ) –

    Unused placeholder kept for API stability.

  • scheduler_factory (callable or None, default: None ) –

    Callable (optimizer) -> scheduler. If None, uses MultiStepLR with milestones=[1000, 1500, 8000, 15000], gamma=0.1.

  • paths (PathEnsemble or None, default: None ) –

    Path ensemble providing the trajectories (fit(dist, push) then sample()). If None, ExactOT().

  • n_rounds (int, default: 1 ) –

    Number of rounds of the iterated coupling: every round after the first builds the paths again with the current model as reference dynamics (see pfi.flow.paths) and repeats the training. 1: no iteration.

  • push_steps (int, default: 8 ) –

    Runge-Kutta 4 steps per snapshot interval when pushing with the model.

  • verbose (bool, default: True ) –

    If True, display progress bars.

Returns:

  • drift_net ( Module ) –

    Trained drift model.

  • growth_model ( Module or None ) –

    Trained growth model, or None.

  • loss_hist ( list ) –

    Two-list history [drift_loss_hist, growth_loss_hist].