Metric Generators
- class stonesoup.metricgenerator.base.MetricGenerator[source]
Bases:
Base
Metric Generator base class
Generates
Metric
objects used to assess the performance of a tracker using data held in aMetricManager
object- abstract compute_metric(manager, **kwargs)[source]
Compute metric
- Parameters:
manager (MetricManager) – containing the data to be used to create the metric(s)
- Returns:
Generated metrics
- Return type:
list of
Metric
objects
- class stonesoup.metricgenerator.base.MetricManager[source]
Bases:
Base
Metric Manager base class
Holds the data and manages the production of
Metric
objects through aMetricGenerator
- class stonesoup.metricgenerator.base.MetricTableGenerator[source]
Bases:
MetricGenerator
Metric Table base class
Takes a set of :class: ~.Metric objects and outputs a table of the values next to a description and target for each metric
- class stonesoup.metricgenerator.base.PlotGenerator[source]
Bases:
MetricGenerator
PlotGenerator base class
PlotGenerators generate metrics that are visualisations. Return
PlottingMetric
objects.
Metric Managers
- class stonesoup.metricgenerator.manager.MultiManager(generators: Sequence[MetricGenerator] = None, associator: Associator = None)[source]
MultiManager class for metric management
MetricManager
for the generation of metrics on multiple sets ofTrack
,Detection
andGroundTruthPath
objects passed in as dictionaries.- Parameters:
generators (
Sequence[MetricGenerator]
, optional) – List of generators to useassociator (
Associator
, optional) – Associator to combine tracks and truth
- generators: Sequence[MetricGenerator]
List of generators to use
- associator: Associator
Associator to combine tracks and truth
- add_data(metric_data: Dict = None, overwrite=True)[source]
Adds data to the metric generator
- Parameters:
metric_data (dict of lists or dict of sets of
GroundTruthPath
,Track
, and/orDetection
) – Ground truth paths, Tracks, and/or detections to be added to the manager.overwrite (bool) – Declaring whether pre-existing data will be overwritten. Note that overwriting one key-value pair (e.g. ‘tracks’) does not affect the others.
- associate_tracks(generator)[source]
- Associate tracks to truth using the associator to produce an
- Parameters:
generator (
MetricGenerator
) –MetricGenerator
containing tracks_key and truths_key to extract tracks and truths fromMetricManager
for association.
- generate_metrics()[source]
Generate metrics using the generators and data that has been added
- Returns:
Metrics generated
- Return type:
nested dict of
Metric
- list_timestamps(generator=None)[source]
List all the unique timestamps used in the tracks and truth associated with a given generator, in order
- Parameters:
generator (
MetricGenerator
) –MetricGenerator
containing tracks_key and truths_key to extract tracks and truths fromMetricManager
to extract timestamps from. Default None to take tracks and truths values from firstMetricGenerator
in self.generators.- Returns:
unique timestamps present in the internal tracks and truths.
- Return type:
list of
datetime.datetime
- class stonesoup.metricgenerator.manager.SimpleManager(generators: Sequence[MetricGenerator] = None, associator: Associator = None)[source]
SimpleManager class for metric management
Simple
MetricManager
for the generation of metrics on multipleTrack
,Detection
andGroundTruthPath
objects.- Parameters:
generators (
Sequence[MetricGenerator]
, optional) – List of generators to useassociator (
Associator
, optional) – Associator to combine tracks and truth
- generators: Sequence[MetricGenerator]
List of generators to use
- associator: Associator
Associator to combine tracks and truth
- add_data(groundtruth_paths: Iterable[GroundTruthPath | Platform] = None, tracks: Iterable[Track] = None, detections: Iterable[Detection] = None, overwrite=True)[source]
Adds data to the metric generator
- Parameters:
groundtruth_paths (list or set of
GroundTruthPath
) – Ground truth paths to be added to the manager.tracks (list or set of
Track
) – Tracks objects to be added to the manager.detections (list or set of
Detection
) – Detections to be added to the manager.overwrite (bool) – declaring whether pre-existing data will be overwritten. Note that overwriting one field (e.g. tracks) does not affect the others