shark::HierarchicalClustering< InputT > Class Template Reference

Clusters defined by a binary space partitioning tree. More...

#include <shark/Models/Clustering/HierarchicalClustering.h>

+ Inheritance diagram for shark::HierarchicalClustering< InputT >:

Public Types

typedef base_type::BatchInputType BatchInputType
 
typedef base_type::BatchOutputType BatchOutputType
 
- Public Types inherited from shark::AbstractClustering< InputT >
enum  Feature { HAS_SOFT_MEMBERSHIP = 1 }
 
typedef InputT InputType
 
typedef unsigned int OutputType
 
typedef Batch< InputType >::type BatchInputType
 
typedef Batch< OutputType >::type BatchOutputType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 
- Public Types inherited from shark::IParameterizable< VectorType >
typedef VectorType ParameterVectorType
 

Public Member Functions

 HierarchicalClustering (const tree_type *tree)
 Constructor.
 
std::string name () const
 From INameable: return the class name.
 
Shape inputShape () const
 
std::size_t numberOfClusters () const
 Return the number of clusters.
 
BatchOutputType hardMembership (BatchInputType const &patterns) const
 Return the best matching cluster for very pattern in the batch.
 
RealVector parameterVector () const
 from IParameterizable
 
void setParameterVector (RealVector const &newParameters)
 from IParameterizable
 
std::size_t numberOfParameters () const
 from IParameterizable
 
- Public Member Functions inherited from shark::AbstractClustering< InputT >
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool hasSoftMembershipFunction () const
 
virtual unsigned int hardMembership (InputType const &pattern) const
 Compute best matching cluster.
 
virtual RealVector softMembership (InputType const &pattern) const
 Compute cluster membership function.
 
virtual RealMatrix softMembership (BatchInputType const &patterns) const
 Compute cluster membership function.
 
void read (InArchive &archive)
 empty default implementation of ISerializable::read
 
void write (OutArchive &archive) const
 empty default implementation of ISerializable::write
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::IParameterizable< VectorType >
virtual ~IParameterizable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor.
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...).
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...).
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Attributes

tree_type const * mep_tree
 binary tree
 
- Protected Attributes inherited from shark::AbstractClustering< InputT >
Features m_features
 

Detailed Description

template<class InputT>
class shark::HierarchicalClustering< InputT >

Clusters defined by a binary space partitioning tree.

Binary space-partitioning is a simple and fast way of clustering.
It is not clear how the unfolding of the tree can be expressed as a flat parameter vector. Therefore, the parameter vector of this model is empty.

Definition at line 60 of file HierarchicalClustering.h.

Member Typedef Documentation

◆ BatchInputType

template<class InputT >
typedef base_type::BatchInputType shark::HierarchicalClustering< InputT >::BatchInputType

Definition at line 65 of file HierarchicalClustering.h.

◆ BatchOutputType

template<class InputT >
typedef base_type::BatchOutputType shark::HierarchicalClustering< InputT >::BatchOutputType

Definition at line 66 of file HierarchicalClustering.h.

Constructor & Destructor Documentation

◆ HierarchicalClustering()

template<class InputT >
shark::HierarchicalClustering< InputT >::HierarchicalClustering ( const tree_type tree)
inline

Constructor.

Construct a hierarchy of clusters from a binary tree.
Parameters
treetree object underlying the clustering

Definition at line 74 of file HierarchicalClustering.h.

References SHARK_RUNTIME_CHECK.

Member Function Documentation

◆ hardMembership()

◆ inputShape()

template<class InputT >
Shape shark::HierarchicalClustering< InputT >::inputShape ( ) const
inlinevirtual

Implements shark::AbstractClustering< InputT >.

Definition at line 83 of file HierarchicalClustering.h.

◆ name()

template<class InputT >
std::string shark::HierarchicalClustering< InputT >::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 80 of file HierarchicalClustering.h.

◆ numberOfClusters()

template<class InputT >
std::size_t shark::HierarchicalClustering< InputT >::numberOfClusters ( ) const
inlinevirtual

Return the number of clusters.

Implements shark::AbstractClustering< InputT >.

Definition at line 88 of file HierarchicalClustering.h.

References shark::HierarchicalClustering< InputT >::mep_tree, and shark::BinaryTree< InputT >::nodes().

Referenced by main().

◆ numberOfParameters()

template<class InputT >
std::size_t shark::HierarchicalClustering< InputT >::numberOfParameters ( ) const
inlinevirtual

from IParameterizable

Reimplemented from shark::IParameterizable< VectorType >.

Definition at line 123 of file HierarchicalClustering.h.

◆ parameterVector()

template<class InputT >
RealVector shark::HierarchicalClustering< InputT >::parameterVector ( ) const
inlinevirtual

from IParameterizable

Reimplemented from shark::IParameterizable< VectorType >.

Definition at line 113 of file HierarchicalClustering.h.

◆ setParameterVector()

template<class InputT >
void shark::HierarchicalClustering< InputT >::setParameterVector ( RealVector const &  newParameters)
inlinevirtual

from IParameterizable

Reimplemented from shark::IParameterizable< VectorType >.

Definition at line 118 of file HierarchicalClustering.h.

References SHARK_ASSERT.

Member Data Documentation

◆ mep_tree

template<class InputT >
tree_type const* shark::HierarchicalClustering< InputT >::mep_tree
protected

The documentation for this class was generated from the following file: