shark::LinearClassifier< VectorType > Class Template Reference

Basic linear classifier. More...

#include <shark/Models/LinearClassifier.h>

+ Inheritance diagram for shark::LinearClassifier< VectorType >:

Public Member Functions

 LinearClassifier ()
 
std::string name () const
 returns the name of the object More...
 
- Public Member Functions inherited from shark::ArgMaxConverter< LinearModel< VectorType > >
 ArgMaxConverter ()
 
 ArgMaxConverter (LinearModel< VectorType > const &decisionFunction)
 
std::string name () const
 returns the name of the object More...
 
RealVector parameterVector () const
 Return the parameter vector. More...
 
void setParameterVector (RealVector const &newParameters)
 Set the parameter vector. More...
 
std::size_t numberOfParameters () const
 Return the number of parameters. More...
 
LinearModel< VectorType > const & decisionFunction () const
 Return the decision function. More...
 
LinearModel< VectorType > & decisionFunction ()
 Return the decision function. More...
 
void eval (BatchInputType const &input, BatchOutputType &output) const
 
void eval (BatchInputType const &input, BatchOutputType &output, State &state) const
 
void eval (InputType const &pattern, OutputType &output) const
 Standard interface for evaluating the response of the model to a single pattern. More...
 
void read (InArchive &archive)
 From ISerializable. More...
 
void write (OutArchive &archive) const
 From ISerializable. More...
 
- Public Member Functions inherited from shark::AbstractModel< LinearModel< VectorType > ::InputType, 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 hasSecondParameterDerivative () const
 Returns true when the second parameter derivative is implemented. More...
 
bool hasFirstInputDerivative () const
 Returns true when the first input derivative is implemented. More...
 
bool hasSecondInputDerivative () const
 Returns true when the second parameter derivative is implemented. More...
 
bool isSequential () const
 
virtual boost::shared_ptr< StatecreateState () const
 Creates an internal state of the model. 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 &coefficients, State const &state, RealVector &derivative) const
 calculates the weighted sum of derivatives w.r.t the parameters. More...
 
virtual void weightedParameterDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, Batch< RealMatrix >::type const &errorHessian, State const &state, RealVector &derivative, RealMatrix &hessian) const
 calculates the weighted sum of derivatives w.r.t the parameters More...
 
virtual void weightedInputDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, State const &state, BatchInputType &derivative) const
 calculates the weighted sum of derivatives w.r.t the inputs More...
 
virtual void weightedInputDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, typename Batch< RealMatrix >::type const &errorHessian, State const &state, RealMatrix &derivative, Batch< RealMatrix >::type &hessian) const
 calculates the weighted sum of derivatives w.r.t the inputs More...
 
virtual void weightedDerivatives (BatchInputType const &patterns, 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
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

- Public Types inherited from shark::ArgMaxConverter< LinearModel< VectorType > >
typedef LinearModel< VectorType > ::InputType InputType
 
typedef unsigned int OutputType
 
typedef Batch< InputType >::type BatchInputType
 
typedef Batch< unsigned int >::type BatchOutputType
 
- Public Types inherited from shark::AbstractModel< LinearModel< VectorType > ::InputType, unsigned int >
enum  Feature
 
typedef LinearModel< VectorType > ::InputType InputType
 Defines the input type of the model. More...
 
typedef unsigned int OutputType
 Defines the output type of the model. 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
 
- Protected Attributes inherited from shark::AbstractModel< LinearModel< VectorType > ::InputType, unsigned int >
Features m_features
 

Detailed Description

template<class VectorType = RealVector>
class shark::LinearClassifier< VectorType >

Basic linear classifier.

The LinearClassifier class is a multi class classifier model suited for linear discriminant analysis. For c classes \( 0, \dots, c-1 \) the model computes

\( \arg \max_i w_i^T x + b_i \)

Thus is it a linear model with arg max computation. The internal linear model can be queried using decisionFunction().

Definition at line 47 of file LinearClassifier.h.

Constructor & Destructor Documentation

§ LinearClassifier()

template<class VectorType = RealVector>
shark::LinearClassifier< VectorType >::LinearClassifier ( )
inline

Definition at line 50 of file LinearClassifier.h.

Member Function Documentation

§ name()

template<class VectorType = RealVector>
std::string shark::LinearClassifier< VectorType >::name ( ) const
inlinevirtual

returns the name of the object

Reimplemented from shark::INameable.

Definition at line 52 of file LinearClassifier.h.


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