Class GMMClusterer

Inheritance Relationships

Base Types

Class Documentation

class cpphots::GMMClusterer : public cpphots::interfaces::Clonable<GMMClusterer, interfaces::Clusterer>, public cpphots::ClustererHistogramMixin, public cpphots::ClustererOfflineMixin

Clustering using variational gaussian mixture models.

See https://github.com/OOub/peregrine for more details.

Public Types

enum GMMType

GMM algorithm options.

Values:

enumerator S_GMM
enumerator U_S_GMM

Public Functions

GMMClusterer()

Construct a new GMMClusterer.

This constructor should never be used to create a new object, it is provided only to create containers with Clusterer instances or to read parameters from a file.

GMMClusterer(GMMType type, uint16_t clusters, uint16_t truncated_clusters, uint16_t clusters_considered, TimeSurfaceScalarType eps, unsigned int max_iterations = 100)

Construct a new GMMClusterer.

Parameters
  • type – algorithm type

  • clusters – number of clusters

  • truncated_clusters – number of truncated clusters

  • clusters_considered – number of neighboring clusters considered

  • eps – precision convergence criterion

  • max_iterations – maximum number of iterations for convergence

virtual uint16_t cluster(const TimeSurfaceType &surface) override

Performs clustering.

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

If learning is enabled the time surfaces will be stored in memory and output will always be 0.

Parameters

surface – the timesurface to cluster

Returns

id of the cluster

virtual uint16_t getNumClusters() const override

Get the number of clusters.

Returns

the number of clusters

virtual void addCentroid(const TimeSurfaceType &centroid) override

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 override

Get the list of centroids.

Returns

the list of centroids

virtual void clearCentroids() override

Remove all centroids.

virtual bool hasCentroids() const override

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 void train(const std::vector<TimeSurfaceType> &tss) override

Fit a set of time surfaces.

Udpate the centroids by clustering the set of time surfaces.

Parameters

tss – set of time surfaces

virtual void toStream(std::ostream &out) const override

Insert to stream.

Insert parameters of the clusterer and centroids on the stream.

Parameters

out – stream where to insert to

virtual void fromStream(std::istream &in) override

Extract from stream.

Parameters/current state is expected to be overwritten or invalidated.

Reads parameters and centroids from the stream.

Parameters

in – stream where to extract from