API Reference

pppca.core.load_pppca_features(path: str | Path) Dict[str, object][source]

Load a PPPCA state dict and rebuild the eigenfunction evaluator.

pppca.core.plot_eigenfunctions(eigenfun: callable, *, d: int, Jmax: int = 3, grid_size: int = 100, cmap: str = 'RdBu') None[source]

Visualize eigenfunctions for low-dimensional domains (d=1,2,3).

pppca.core.pppca(point_processes: List[Tensor], Jmax: int, *, return_state: bool = False) Dict[str, object][source]

PCA for multivariate point processes on [0,1]^d.

Input:
  • point_processes: list length n, each is a tensor of shape (k_i, d) with entries in [0,1]

  • Jmax: number of leading components

Output:
  • ‘eigenval’: list[float], operator eigenvalues λ (length Jmax)

  • ‘scores’: DataFrame (n x Jmax), scores s_{iℓ} = sqrt(nλ_ℓ) c_i^{(ℓ)}

  • ‘coeff’: ndarray (n x Jmax), Gram eigenvectors c^{(ℓ)} (columns)

  • ‘eigenfun’: a callable eval(x) returning η at x, where x is (m_eval, d)

    Note: evaluation is on demand via cumulative counts relative to x

Shapes in a small 2D example:
  • Suppose n=2 processes:

    P1 = tensor([[0.2, 0.5], [0.7, 0.1]]) shape (2,2) P2 = tensor([[0.1, 0.4], [0.6, 0.8], [0.3, 0.2]]) shape (3,2)

    S is (2,2); K is (2,2); eigenval length Jmax; coeff is (2, Jmax); scores is (2, Jmax)

pppca.core.project_pppca(point_processes: List[Tensor], *, state: Dict[str, object], block_cols: int = 8192, device: device | None = None, work_dtype: dtype = torch.float32) DataFrame[source]

Project new point processes onto an existing PPPCA model.

Uses kernel PCA projection: score_ℓ = (k_c @ c^{(ℓ)}) / sqrt(n λ_ℓ).

pppca.core.save_pppca_features(path: str | Path, *, state: Dict[str, object]) Path[source]

Save a PPPCA state dict to disk for reuse.

The state should come from pppca(…, return_state=True)[“state”].