SuperInstance¶
Each COBRAS variant has its own super-instance type. The specific super-instance decides how the representative of a super-instance is chosen and provides a way to calculate the distance between two super-instances (used for querying the closest super-instances first while merging)
-
class
cobras_ts.superinstance.
SuperInstance
(data, indices, train_indices, parent=None)¶ A class representing a super-instance used in the COBRAS algorithm
-
__init__
(data, indices, train_indices, parent=None)¶ - Parameters
data – the full dataset
indices – the indices of the instances that are in this super-instance
train_indices – all training indices (i.e. training indices of the full dataset)
parent – the parent super-instance (if any)
-
abstract
distance_to
(other_superinstance)¶ Calculates the distance to the given super-instance This is COBRAS variant specific
- Parameters
other_superinstance – the super-instance to calculate the distance to
- Returns
the distance between this super-instance and the given other_superinstance
-
SuperInstance_DTW¶
-
class
cobras_ts.superinstance_dtw.
SuperInstance_DTW
(data, indices, train_indices, parent=None)¶ -
__init__
(data, indices, train_indices, parent=None)¶ Chooses the super-instance representative based on the affinity matrix under the data argument
-
distance_to
(other_superinstance)¶ Uses the negative entry in the affinity matrix between the two super-instance representatives
note: this is not a correct distance measure but this is not necessary for COBRAS
-
SuperInstance_kmeans¶
-
class
cobras_ts.superinstance_kmeans.
SuperInstance_kmeans
(data, indices, train_indices, parent=None)¶ -
__init__
(data, indices, train_indices, parent=None)¶ Chooses the super-instance representative as the instance closest to the super-instance centroid
-
distance_to
(other_superinstance)¶ The distance between two super-instances is equal to the distance between there centroids
-
SuperInstance_kShape¶
-
class
cobras_ts.superinstance_kshape.
SuperInstance_kShape
(data, indices, train_indices, sbd_centroid=None, parent=None)¶ -
__init__
(data, indices, train_indices, sbd_centroid=None, parent=None)¶ If sbd_centroid is given the instance that has the smallest distance to the sbd_centroid is chosen as representative Otherwise the representative index is simply the first instance in this super-instance
-
distance_to
(other_superinstance)¶ The distance between two super-instances is the distance between their sbd centroids
-