combination
combination
#
Several per-dimension metrics over one session, fused as a Euclidean norm.
CombinedDistance
#
Bases: DistanceFunction[Any]
Each term's distance along its own attribute path, combined in L2.
Source code in capturegraph-lib/capturegraph/scheduling/distance/combination.py
__init__(terms)
#
Measure each (attribute path, metric) term and combine them.
extract(values)
#
Each term's features for the value at its own attribute path.
Source code in capturegraph-lib/capturegraph/scheduling/distance/combination.py
pairwise(features_a, features_b)
#
The L2 norm over the terms both sides define (nan when none do).
Source code in capturegraph-lib/capturegraph/scheduling/distance/combination.py
combine(**metrics)
#
Combine per-dimension distance functions into a single session metric.
Each keyword names the session attribute its metric reads, and the combined
distance is the Euclidean norm over those terms:
d = sqrt(d1² + d2² + ... + dn²). A term whose attribute is absent on
either side drops out; a pair with no surviving term has no distance, and
select_sessions never offers such a candidate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**metrics
|
Callable[[Any, Any], float]
|
Named distance functions — |
{}
|
Returns:
| Type | Description |
|---|---|
CombinedDistance
|
A combined metric: |
CombinedDistance
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no distance function is given. |