PHATE#
Use PHATE for a small branching or trajectory dataset where diffusion-potential distances should emphasize progression. Neighbor count, decay, diffusion time, and the explicit probability floor define the result.
import numpy as np
from believe14.nonlinear import PHATE
from _example_data import branching
X, branches = branching()
model = PHATE(
n_components=2, n_neighbors=6, decay=5, diffusion_time=5,
mds_max_iter=150, mds_tol=1e-5,
)
embedding = model.fit_transform(X)
assert embedding.shape == (42, 2)
assert not hasattr(model, "transform")
{
"shape": embedding.shape,
"potential_distances": model.potential_distances_.shape,
"stress": round(model.stress_, 4),
"converged": model.diagnostics_.converged,
"warnings": model.diagnostics_.warnings,
}
{'shape': (42, 2),
'potential_distances': (42, 42),
'stress': 69264.5583,
'converged': True,
'warnings': ('Diffusion probabilities below potential_floor were explicitly regularized before the log transform.',)}
affinity_matrix_, diffusion_potential_, potential_distances_, and stress_
expose each composite stage. Diagnostics report the final metric-MDS stopping rule
and any explicit floor regularization. Zero adaptive bandwidth or disconnected
numerical affinity fails, and transform is intentionally absent.
Use diffusion_time="auto" to select the bend in the diffusion entropy curve.
Inspect diffusion_time_ for the selected time. Set n_landmarks to fit
diffusion and metric MDS on a smaller set of states. In this mode
landmark_transitions_ maps the landmark coordinates back to all samples.
The reported stress measures the landmark fit. The full sample affinity still
requires quadratic memory.
Primary reference: [Moon et al., 2019].