Class Clusterer

Inheritance Relationships

Base Types

Derived Types

Class Documentation

class cpphots::interfaces::Clusterer : public virtual cpphots::interfaces::Streamable, public cpphots::interfaces::ClonableBase<Clusterer>

Interface for time surface clustering based on centroids.

Subclassed by cpphots::interfaces::Clonable< CosineClusterer, interfaces::Clusterer >, cpphots::interfaces::Clonable< GMMClusterer, interfaces::Clusterer >, cpphots::interfaces::Clonable< KMeansClusterer, interfaces::Clusterer >, cpphots::ClustererHistogramMixin, cpphots::ClustererOfflineMixin, cpphots::ClustererOnlineMixin, cpphots::Layer

Public Functions

inline ~Clusterer()

Destroy the Clusterer object.

virtual uint16_t cluster(const TimeSurfaceType &surface) = 0

Performs clustering.

In case of online clustering algorithms, also updates the clusters, if learning is enabled.

Parameters

surface – the timesurface to cluster

Returns

id of the cluster

virtual uint16_t getNumClusters() const = 0

Get the number of clusters.

Returns

the number of clusters

virtual void addCentroid(const TimeSurfaceType &centroid) = 0

Add a new centroid to the clusterer.

This function should not be used manually, seeding should be done via a ClustererSeeding function.

If the Clusterer already has enough centroids, an exception is raised.

Parameters

centroid – the centroid to add

virtual const std::vector<TimeSurfaceType> &getCentroids() const = 0

Get the list of centroids.

Returns

the list of centroids

virtual void clearCentroids() = 0

Remove all centroids.

virtual bool hasCentroids() const = 0

Check if clusterer has enough centroids.

A clusterer has centroids if there is a number of centroids equal to the number of clusters.

Returns

true if clusterer has centroids

Returns

false otherwise

virtual bool isOnline() const = 0

Check if clusterer can perform online cluster updates or not.

Returns

true if it can

Returns

false otherwise

virtual bool toggleLearning(bool enable = true) = 0

Enable or disable learning.

This affects whether the centroids are updated when Clusterer::cluster is called or not.

During the learning phase, output of Clusterer::cluster may be undefined, depending on the implementaton.

Parameters

enable – true if learning should be active, false otherwise

Returns

the previous learning state

virtual void train(const std::vector<TimeSurfaceType> &tss) = 0

Fit a set of time surfaces.

Udpate the centroids by clustering the set of time surfaces.

Parameters

tss – set of time surfaces

virtual std::vector<uint32_t> getHistogram() const = 0

Get the histogram of centroids activations.

Returns

the histogram of activations

virtual void reset() = 0

Reset the histogram of activations.