tracktable.algorithms.dbscan module

Module contents

tracktable.algorithms.dbscan - Label points with cluster IDs using DBSCAN.

tracktable.algorithms.dbscan.cluster_labels_to_dict(cluster_labels, feature_vectors)[source]

Returns a dictionary from array of cluster label pairs.

The dictionary uses the cluster labels as keys. The values of each

key is an array of tuples containing the feature vector data. In the case of undecorated points, the vertex id is also included in the tuple.

Parameters
  • cluster_labels (Array of Tuples) – pairs of cluster ids and vector ids. The vector ids map to the index of points in the feature vector. This is usually generated from the compute_cluster_labels function.

  • feature_vectors (Array of Tuples) – the feature vectors used to compute the cluster labels.

Returns

Dictionary of cluster labels mapped to feature vectors.

tracktable.algorithms.dbscan.compute_cluster_labels(feature_vectors, search_box_half_span, min_cluster_size)[source]

Use DBSCAN to compute clusters for a set of points.

DBSCAN is a clustering algorithm that looks for regions of high density in a set of points. Connected regions of high density are identified as clusters. Small regions of low density or even single points get identified as noise (belonging to no cluster).

Parameters
  • feature_vectors (list) – The points to cluster.

  • search_box_half_span (int) – The cluster labels with respect to two parameters: the search box size (defining “nearby” points)

  • min_cluster_size (int) – The minimum number of points that you’re willing to call a cluster.

Returns

You will get back a list of (vertex_id, cluster_id) pairs. If you supplied a list of points as input the vertex IDs will be indices into that list. If you supplied pairs of (my_vertex_id, point) instead, the vertex IDs will be whatever you supplied.

tracktable.algorithms.dbscan.is_decorated(point)[source]

Returns True if point is decorated

A decorated point contains more than the individual point data.

Parameters

point (tuple) – Usually this will be the first point from a feature vector. It will either only contain the point data or it may also contain other features and labels.

Returns

Boolean indicating the point is decorated or not