tanat.metric.entity.type.combined package#
Submodules#
tanat.metric.entity.type.combined.metric module#
CombinedEntityMetric: a metric that combines several other metrics.
- class tanat.metric.entity.type.combined.metric.CombinedEntityMetric(metrics_config: list[dict[str, Any]], weights: list | None = None, agg: str = 'sum')[source]#
Bases:
EntityMetricMetric between entities that involves several entity metrics to aggregate. The entity metrics can involve several entity features but also combine different manner to compare the same entity feature.
- Parameters:
metrics_config – List of metric configuration (dictionaries). see the example below to define easily the configuration from other existing classes.
agg – Aggregate function name (default: ‘sum’). At the time, we only implemented the sum aggregate function.
weights – List of weights for the aggregation function (optional, default: None). If defined, this list must contains as much real values as the number of metrics
Example:
metric = CombinedEntityMetric( metrics_config=[ L2EntityMetric(entity_feature="value").to_config(), HammingEntityMetric(entity_feature="status").to_config(), ], weights=[0.7, 0.3], ) metric(ent_a, ent_b)
warning:
It is not possible to use the combined entity metric as an element of the metrics to combine. This prevent recursive definition of metrics that may be problematics.
- NUMBA_OPTIM: bool = False[source]#
Subclasses that provide
prepare_batch_data/distance_kernel/ prepare_cross_batch_data set this toTrueto opt into the Numba fast path.
- SETTINGS_CLASS[source]#
alias of
CombinedEntityMetricSettings
- class tanat.metric.entity.type.combined.metric.CombinedEntityMetricSettings(*, metrics_config: list = <factory>, weights: list | None = None, agg: str = 'sum')[source]#
Bases:
EntityMetricSettingsSettings for
CombinedEntityMetric. The settings defines the metrics, their weights and how to aggregate them.- Parameters:
metrics_config – List of metric configuration (dictionaries). see the example below to define easily the configuration from other existing classes.
agg – Aggregate function name (default: ‘sum’). At the time, we only implemented the sum aggregate function.
weights – List of weights for the aggregation function (optional, default: None). If defined, this list must contains as much real values as the number of metrics
Example:
settings = CombinedEntityMetricSettings( metrics_config=[ L2EntityMetric(entity_feature="value").to_config(), HammingEntityMetric(entity_feature="status").to_config(), ], weights=[0.7, 0.3], )
warning:
It is not possible to use the combined entity metric as an element of the metrics to combine. This prevent recursive definition of metrics that may be problematics.
Module contents#
L2EntityMetric package.
- class tanat.metric.entity.type.combined.CombinedEntityMetric(metrics_config: list[dict[str, Any]], weights: list | None = None, agg: str = 'sum')[source]#
Bases:
EntityMetricMetric between entities that involves several entity metrics to aggregate. The entity metrics can involve several entity features but also combine different manner to compare the same entity feature.
- Parameters:
metrics_config – List of metric configuration (dictionaries). see the example below to define easily the configuration from other existing classes.
agg – Aggregate function name (default: ‘sum’). At the time, we only implemented the sum aggregate function.
weights – List of weights for the aggregation function (optional, default: None). If defined, this list must contains as much real values as the number of metrics
Example:
metric = CombinedEntityMetric( metrics_config=[ L2EntityMetric(entity_feature="value").to_config(), HammingEntityMetric(entity_feature="status").to_config(), ], weights=[0.7, 0.3], ) metric(ent_a, ent_b)
warning:
It is not possible to use the combined entity metric as an element of the metrics to combine. This prevent recursive definition of metrics that may be problematics.
- NUMBA_OPTIM: bool = False[source]#
Subclasses that provide
prepare_batch_data/distance_kernel/ prepare_cross_batch_data set this toTrueto opt into the Numba fast path.
- SETTINGS_CLASS[source]#
alias of
CombinedEntityMetricSettings
- class tanat.metric.entity.type.combined.CombinedEntityMetricSettings(*, metrics_config: list = <factory>, weights: list | None = None, agg: str = 'sum')[source]#
Bases:
EntityMetricSettingsSettings for
CombinedEntityMetric. The settings defines the metrics, their weights and how to aggregate them.- Parameters:
metrics_config – List of metric configuration (dictionaries). see the example below to define easily the configuration from other existing classes.
agg – Aggregate function name (default: ‘sum’). At the time, we only implemented the sum aggregate function.
weights – List of weights for the aggregation function (optional, default: None). If defined, this list must contains as much real values as the number of metrics
Example:
settings = CombinedEntityMetricSettings( metrics_config=[ L2EntityMetric(entity_feature="value").to_config(), HammingEntityMetric(entity_feature="status").to_config(), ], weights=[0.7, 0.3], )
warning:
It is not possible to use the combined entity metric as an element of the metrics to combine. This prevent recursive definition of metrics that may be problematics.