Shape losses#
Shape losses compare predicted positions with target point clouds.
When cell identity is known#
squared_loss applies when each predicted cell has a known target identity
and row order is meaningful: the loss compares cell \(i\) against target
\(i\) directly. Input shapes must match exactly. Use it for experiments
that track cell identities.
When the target is an unordered cloud#
For biological shapes sampled from meshes, the rows of the predicted and target
clouds are unordered, so the loss must be a distributional distance between
point sets. chamfer_distance and make_samples_loss apply here.
chamfer_distance sums the mean nearest-neighbor distance in each direction,
so swapping the two clouds gives the same value even when their point counts
differ:
Both clouds must be nonempty rank-2 arrays with the same feature width.
Training sums the selected distance over supervised frames,
which reduces to \(d(X_T, \tilde{X}_T)\) for a single terminal target.
PyTorch’s GeomLoss-backed make_samples_loss exposes maximum mean
discrepancy, Hausdorff divergence, and debiased Sinkhorn divergence. JAX’s
make_sinkhorn_loss exposes debiased OTT Sinkhorn divergence. Numerical
values follow each backend’s cost, solver, and option contract. In the
PyTorch factory, omitted truncate uses 5 while explicit None is
preserved.
Regularizing the trajectory#
The training regularizer penalizes the learned position head before prescribed mechanics,
lambda_reg supplies its weight, so the optimized loss is
\(L=L_{\mathrm{shape}}+\lambda_{\mathrm{reg}}L_{\mathrm{reg}}\).
This regularizer measures learned displacement; the physics update governs
prescribed mechanical displacement.