tanat.metric.trajectory.type.aggregation package#
Submodules#
tanat.metric.trajectory.type.aggregation.metric module#
AggregationTrajectoryMetric: trajectory distance by per-alias sequence distances with weighted aggregation.
- class tanat.metric.trajectory.type.aggregation.metric.AggregationSettings(*, sequence_metrics: dict[str, SequenceMetric] | None = None, agg_fun: str = 'mean', weights: dict[str, float] | None = None)[source]#
Bases:
objectSettings for
AggregationTrajectoryMetric.agg_funandweightsare orthogonal:"mean"+ weights computes a weighted mean,"sum"+ weights a weighted sum. Aliases absent fromweightsdefault to1.0.- model_dump(*, mode='python', **dump_kwargs)[source]#
Dump settings to a dict via Pydantic serialization.
- sequence_metrics: dict[str, SequenceMetric] | None = None[source]#
- class tanat.metric.trajectory.type.aggregation.metric.AggregationTrajectoryMetric(sequence_metrics: dict[str, SequenceMetric | str] | None = None, static_metric: StaticMetric | Callable | None = None, static_metric_weight: float = 1.0, agg_fun: str = 'mean', weights: dict[str, float] | None = None, *, store_path: str | Path | None = None, chunk_size: int = 500, resume: bool = True, dtype: str = 'float32')[source]#
Bases:
TrajectoryMetricTrajectory distance by per-alias sequence distances, then weighted aggregation.
For each store alias visible on both trajectories, computes the sequence-level distance using the configured
SequenceMetric. The resulting per-alias distances are aggregated (weighted mean/sum) into a scalar trajectory distance.Example:
lp = LinearPairwiseSequenceMetric(entity_metric=hamming) agg = AggregationTrajectoryMetric( sequence_metric={"event": lp; "states": lp}, agg_fun="mean", weights={"events": 1.0, "states": 0.5}, ) dist = agg(traj_a, traj_b) dm = agg.compute_matrix(traj_pool)
- MEMMAP_SUPPORT: bool = True[source]#
Set to
Truein subclasses that implement disk-backed (memmap) computation.
- SETTINGS_CLASS[source]#
alias of
AggregationSettings
- __init__(sequence_metrics: dict[str, SequenceMetric | str] | None = None, static_metric: StaticMetric | Callable | None = None, static_metric_weight: float = 1.0, agg_fun: str = 'mean', weights: dict[str, float] | None = None, *, store_path: str | Path | None = None, chunk_size: int = 500, resume: bool = True, dtype: str = 'float32') None[source]#
Module contents#
Aggregation trajectory metric sub-package.
- class tanat.metric.trajectory.type.aggregation.AggregationSettings(*, sequence_metrics: dict[str, SequenceMetric] | None = None, agg_fun: str = 'mean', weights: dict[str, float] | None = None)[source]#
Bases:
objectSettings for
AggregationTrajectoryMetric.agg_funandweightsare orthogonal:"mean"+ weights computes a weighted mean,"sum"+ weights a weighted sum. Aliases absent fromweightsdefault to1.0.- model_dump(*, mode='python', **dump_kwargs)[source]#
Dump settings to a dict via Pydantic serialization.
- sequence_metrics: dict[str, SequenceMetric] | None = None[source]#
- class tanat.metric.trajectory.type.aggregation.AggregationTrajectoryMetric(sequence_metrics: dict[str, SequenceMetric | str] | None = None, static_metric: StaticMetric | Callable | None = None, static_metric_weight: float = 1.0, agg_fun: str = 'mean', weights: dict[str, float] | None = None, *, store_path: str | Path | None = None, chunk_size: int = 500, resume: bool = True, dtype: str = 'float32')[source]#
Bases:
TrajectoryMetricTrajectory distance by per-alias sequence distances, then weighted aggregation.
For each store alias visible on both trajectories, computes the sequence-level distance using the configured
SequenceMetric. The resulting per-alias distances are aggregated (weighted mean/sum) into a scalar trajectory distance.Example:
lp = LinearPairwiseSequenceMetric(entity_metric=hamming) agg = AggregationTrajectoryMetric( sequence_metric={"event": lp; "states": lp}, agg_fun="mean", weights={"events": 1.0, "states": 0.5}, ) dist = agg(traj_a, traj_b) dm = agg.compute_matrix(traj_pool)
- MEMMAP_SUPPORT: bool = True[source]#
Set to
Truein subclasses that implement disk-backed (memmap) computation.
- SETTINGS_CLASS[source]#
alias of
AggregationSettings
- __init__(sequence_metrics: dict[str, SequenceMetric | str] | None = None, static_metric: StaticMetric | Callable | None = None, static_metric_weight: float = 1.0, agg_fun: str = 'mean', weights: dict[str, float] | None = None, *, store_path: str | Path | None = None, chunk_size: int = 500, resume: bool = True, dtype: str = 'float32') None[source]#