shark::HardClusteringModel< InputT > Class Template Reference

Model for "hard" clustering. More...

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

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

Public Types

typedef base_type::BatchInputType BatchInputType
 
typedef base_type::BatchOutputType BatchOutputType
 
typedef base_type::InputType InputType
 
typedef base_type::OutputType OutputType
 
- Public Types inherited from shark::ClusteringModel< InputT, unsigned int >
typedef AbstractClustering< InputT > ClusteringType
 
typedef base_type::BatchInputType BatchInputType
 
typedef base_type::BatchOutputType BatchOutputType
 
- Public Types inherited from shark::AbstractModel< InputT, unsigned int >
enum  Feature
 
typedef InputT InputType
 Defines the input type of the model. More...
 
typedef unsigned int OutputType
 Defines the output type of the model. More...
 
typedef AbstractModel< InputT, unsigned int, RealVector > ModelBaseType
 Defines the BaseType used by the model (this type). Useful for creating derived models. More...
 
typedef Batch< InputType >::type BatchInputType
 defines the batch type of the input type. More...
 
typedef Batch< OutputType >::type BatchOutputType
 defines the batch type of the output type More...
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 
- Public Types inherited from shark::IParameterizable< RealVector >
typedef RealVector ParameterVectorType
 

Public Member Functions

 HardClusteringModel (ClusteringType *clustering)
 Constructor. More...
 
std::string name () const
 From INameable: return the class name. More...
 
Shape inputShape () const
 Returns the expected shape of the input. More...
 
Shape outputShape () const
 Returns the shape of the output. More...
 
void eval (InputType const &pattern, OutputType &output) const
 Compute best matching cluster. More...
 
void eval (BatchInputType const &patterns, BatchOutputType &outputs) const
 Compute best matching cluster for a batch of inputs. More...
 
- Public Member Functions inherited from shark::ClusteringModel< InputT, unsigned int >
 ClusteringModel (ClusteringType *clustering)
 Constructor. More...
 
RealVector parameterVector () const
 Redirect parameter access to the clustering object. More...
 
void setParameterVector (RealVector const &newParameters)
 Redirect parameter access to the clustering object. More...
 
std::size_t numberOfParameters () const
 Redirect parameter access to the clustering object. More...
 
void read (InArchive &archive)
 From ISerializable, reads a model from an archive. More...
 
void write (OutArchive &archive) const
 From ISerializable, writes a model to an archive. More...
 
void eval (BatchInputType const &patterns, BatchOutputType &outputs, State &state) const
 Standard interface for evaluating the response of the model to a batch of patterns. More...
 
- Public Member Functions inherited from shark::AbstractModel< InputT, unsigned int >
 AbstractModel ()
 
virtual ~AbstractModel ()
 
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool hasFirstParameterDerivative () const
 Returns true when the first parameter derivative is implemented. More...
 
bool hasFirstInputDerivative () const
 Returns true when the first input derivative is implemented. More...
 
virtual boost::shared_ptr< StatecreateState () const
 Creates an internal state of the model. More...
 
virtual void eval (BatchInputType const &patterns, BatchOutputType &outputs) const
 Standard interface for evaluating the response of the model to a batch of patterns. More...
 
Data< OutputTypeoperator() (Data< InputType > const &patterns) const
 Model evaluation as an operator for a whole dataset. This is a convenience function. More...
 
OutputType operator() (InputType const &pattern) const
 Model evaluation as an operator for a single pattern. This is a convenience function. More...
 
BatchOutputType operator() (BatchInputType const &patterns) const
 Model evaluation as an operator for a single pattern. This is a convenience function. More...
 
virtual void weightedParameterDerivative (BatchInputType const &pattern, BatchOutputType const &outputs, BatchOutputType const &coefficients, State const &state, RealVector &derivative) const
 calculates the weighted sum of derivatives w.r.t the parameters. More...
 
virtual void weightedInputDerivative (BatchInputType const &pattern, BatchOutputType const &outputs, BatchOutputType const &coefficients, State const &state, BatchInputType &derivative) const
 calculates the weighted sum of derivatives w.r.t the inputs More...
 
virtual void weightedDerivatives (BatchInputType const &patterns, BatchOutputType const &outputs, BatchOutputType const &coefficients, State const &state, RealVector &parameterDerivative, BatchInputType &inputDerivative) const
 calculates weighted input and parameter derivative at the same time More...
 
- Public Member Functions inherited from shark::IParameterizable< RealVector >
virtual ~IParameterizable ()
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- 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 ()
 

Additional Inherited Members

- Protected Attributes inherited from shark::ClusteringModel< InputT, unsigned int >
ClusteringTypemep_clustering
 Clustering object, see class AbstractClustering. More...
 
- Protected Attributes inherited from shark::AbstractModel< InputT, unsigned int >
Features m_features
 

Detailed Description

template<class InputT>
class shark::HardClusteringModel< InputT >

Model for "hard" clustering.

The HardClusteringModel is based on an AbstractClustering object. Given an input, the model outputs the index of the best matching cluster.
See also SoftClusteringModel for general cluster membership.

Definition at line 55 of file HardClusteringModel.h.

Member Typedef Documentation

◆ BatchInputType

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

Definition at line 60 of file HardClusteringModel.h.

◆ BatchOutputType

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

Definition at line 61 of file HardClusteringModel.h.

◆ InputType

template<class InputT>
typedef base_type::InputType shark::HardClusteringModel< InputT >::InputType

Definition at line 62 of file HardClusteringModel.h.

◆ OutputType

template<class InputT>
typedef base_type::OutputType shark::HardClusteringModel< InputT >::OutputType

Definition at line 63 of file HardClusteringModel.h.

Constructor & Destructor Documentation

◆ HardClusteringModel()

template<class InputT>
shark::HardClusteringModel< InputT >::HardClusteringModel ( ClusteringType clustering)
inline

Constructor.

Definition at line 67 of file HardClusteringModel.h.

Member Function Documentation

◆ eval() [1/2]

template<class InputT>
void shark::HardClusteringModel< InputT >::eval ( InputType const &  pattern,
OutputType output 
) const
inlinevirtual

Compute best matching cluster.

The actual computation is redirected to the clustering object.

Reimplemented from shark::AbstractModel< InputT, unsigned int >.

Definition at line 88 of file HardClusteringModel.h.

References shark::AbstractClustering< InputT >::hardMembership(), and shark::ClusteringModel< InputT, unsigned int >::mep_clustering.

◆ eval() [2/2]

template<class InputT>
void shark::HardClusteringModel< InputT >::eval ( BatchInputType const &  patterns,
BatchOutputType outputs 
) const
inline

Compute best matching cluster for a batch of inputs.

The actual computation is redirected to the clustering object.

Definition at line 96 of file HardClusteringModel.h.

References shark::AbstractClustering< InputT >::hardMembership(), and shark::ClusteringModel< InputT, unsigned int >::mep_clustering.

◆ inputShape()

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

◆ name()

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

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 72 of file HardClusteringModel.h.

◆ outputShape()

template<class InputT>
Shape shark::HardClusteringModel< InputT >::outputShape ( ) const
inlinevirtual

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