att.transitions

class att.transitions.TransitionDetector(window_size=500, step_size=50, max_dim=1, backend='ripser', subsample=None)[source]

Bases: object

Detect topological transitions via sliding-window persistent homology.

Parameters:
  • window_size (int) – Number of points per window.

  • step_size (int) – Step between consecutive windows.

  • max_dim (int) – Maximum homology dimension.

  • backend (str) – PersistenceAnalyzer backend (“ripser” or “gudhi”).

  • subsample (int or None) – Points to subsample per window (None = use all).

fit_transform(X, seed=None, embedding_dim=None, embedding_delay=None)[source]

Run sliding-window PH on input data.

Parameters:
  • X (array) – If 2D (n_points, dim): pre-embedded point cloud. Windows the cloud directly. If 1D (n_samples,): time series. Embeds each window separately (requires embedding_dim and embedding_delay).

  • seed (random seed for subsampling)

  • embedding_dim (embedding dimension (required for 1D input))

  • embedding_delay (embedding delay (required for 1D input))

Returns:

topology_timeseries: list of fit_transform results per window distances: list of bottleneck distances between consecutive windows image_distances: list of L2 distances between consecutive persistence images window_centers: array of center sample indices transition_scores: array (same as image_distances, the default score)

Return type:

dict with keys

detect_changepoints(method='cusum', threshold=None)[source]

Detect changepoints in the transition score series.

Parameters:
  • method ("cusum" or "threshold")

  • threshold (detection threshold. Default: mean + 2*std for cusum,) – mean + 2*std for threshold.

Returns:

List of indices into window_centers[

Return type:

-1] where transitions detected.

plot_timeline(ground_truth=None)[source]

Plot transition timeline. Delegates to viz module.

Parameters:

ground_truth (list[int] | None)

class att.transitions.TransitionDetector(window_size=500, step_size=50, max_dim=1, backend='ripser', subsample=None)[source]

Bases: object

Detect topological transitions via sliding-window persistent homology.

Parameters:
  • window_size (int) – Number of points per window.

  • step_size (int) – Step between consecutive windows.

  • max_dim (int) – Maximum homology dimension.

  • backend (str) – PersistenceAnalyzer backend (“ripser” or “gudhi”).

  • subsample (int or None) – Points to subsample per window (None = use all).

__init__(window_size=500, step_size=50, max_dim=1, backend='ripser', subsample=None)[source]
Parameters:
  • window_size (int)

  • step_size (int)

  • max_dim (int)

  • backend (str)

  • subsample (int | None)

fit_transform(X, seed=None, embedding_dim=None, embedding_delay=None)[source]

Run sliding-window PH on input data.

Parameters:
  • X (array) – If 2D (n_points, dim): pre-embedded point cloud. Windows the cloud directly. If 1D (n_samples,): time series. Embeds each window separately (requires embedding_dim and embedding_delay).

  • seed (random seed for subsampling)

  • embedding_dim (embedding dimension (required for 1D input))

  • embedding_delay (embedding delay (required for 1D input))

Returns:

topology_timeseries: list of fit_transform results per window distances: list of bottleneck distances between consecutive windows image_distances: list of L2 distances between consecutive persistence images window_centers: array of center sample indices transition_scores: array (same as image_distances, the default score)

Return type:

dict with keys

detect_changepoints(method='cusum', threshold=None)[source]

Detect changepoints in the transition score series.

Parameters:
  • method ("cusum" or "threshold")

  • threshold (detection threshold. Default: mean + 2*std for cusum,) – mean + 2*std for threshold.

Returns:

List of indices into window_centers[

Return type:

-1] where transitions detected.

plot_timeline(ground_truth=None)[source]

Plot transition timeline. Delegates to viz module.

Parameters:

ground_truth (list[int] | None)