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<>
typedef RealVector ParameterVectorType
 

Public Member Functions

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

Protected Attributes

tree_type const * mep_tree
 binary tree More...
 
- 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 59 of file HierarchicalClustering.h.

Member Typedef Documentation

◆ BatchInputType

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

Definition at line 64 of file HierarchicalClustering.h.

◆ BatchOutputType

Definition at line 65 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 73 of file HierarchicalClustering.h.

References SHARK_RUNTIME_CHECK.

Member Function Documentation

◆ hardMembership()

template<class InputT>
BatchOutputType shark::HierarchicalClustering< InputT >::hardMembership ( BatchInputType const &  patterns) const
inlinevirtual

Return the best matching cluster for very pattern in the batch.

Reimplemented from shark::AbstractClustering< InputT >.

Definition at line 92 of file HierarchicalClustering.h.

References shark::batchSize(), shark::BinaryTree< InputT >::hasChildren(), shark::BinaryTree< InputT >::isLeft(), and shark::HierarchicalClustering< InputT >::mep_tree.

◆ inputShape()

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

Implements shark::AbstractClustering< InputT >.

Definition at line 82 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 79 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 87 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<>.

Definition at line 122 of file HierarchicalClustering.h.

◆ parameterVector()

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

from IParameterizable

Reimplemented from shark::IParameterizable<>.

Definition at line 112 of file HierarchicalClustering.h.

◆ setParameterVector()

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

from IParameterizable

Reimplemented from shark::IParameterizable<>.

Definition at line 117 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: