Conversion of real-valued outputs to classes. More...
#include <shark/Models/Converter.h>
Public Types | |
typedef Model::InputType | InputType |
typedef unsigned int | OutputType |
typedef Batch< InputType >::type | BatchInputType |
typedef Batch< unsigned int >::type | BatchOutputType |
Public Types inherited from shark::AbstractModel< Model::InputType, unsigned int > | |
enum | Feature |
typedef Model::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< Feature > | Features |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Member Functions | |
ArgMaxConverter () | |
ArgMaxConverter (Model 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... | |
Model const & | decisionFunction () const |
Return the decision function. More... | |
Model & | 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< Model::InputType, unsigned int > | |
AbstractModel () | |
virtual | ~AbstractModel () |
const Features & | features () 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< State > | createState () 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... | |
virtual void | eval (BatchInputType const &patterns, BatchOutputType &outputs, State &state) const=0 |
Standard interface for evaluating the response of the model to a batch of patterns. More... | |
Data< OutputType > | operator() (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 ¶meterDerivative, 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 | |
Protected Attributes inherited from shark::AbstractModel< Model::InputType, unsigned int > | |
Features | m_features |
Conversion of real-valued outputs to classes.
In the special case that d is 1, it is assumed that the model can be represented as a 2 d vector with both components having the same value but opposite sign. In this case the behavior is equivalent to the threshold converter with threshold 0.
The underlying decision function is an arbitrary model. It should be default constructable and it can be accessed using decisionFunction(). The parameters of the ArgMaxConverter are the ones of the decision function.
Definition at line 166 of file Converter.h.
typedef Batch<InputType>::type shark::ArgMaxConverter< Model >::BatchInputType |
Definition at line 173 of file Converter.h.
typedef Batch<unsigned int>::type shark::ArgMaxConverter< Model >::BatchOutputType |
Definition at line 174 of file Converter.h.
typedef Model::InputType shark::ArgMaxConverter< Model >::InputType |
Definition at line 171 of file Converter.h.
typedef unsigned int shark::ArgMaxConverter< Model >::OutputType |
Definition at line 172 of file Converter.h.
|
inline |
Definition at line 176 of file Converter.h.
|
inline |
Definition at line 178 of file Converter.h.
|
inline |
Return the decision function.
Definition at line 198 of file Converter.h.
Referenced by shark::KernelSGDTrainer< InputType, CacheType >::train(), and shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train().
|
inline |
Return the decision function.
Definition at line 203 of file Converter.h.
|
inline |
Definition at line 207 of file Converter.h.
|
inline |
Definition at line 225 of file Converter.h.
|
inlinevirtual |
Standard interface for evaluating the response of the model to a single pattern.
pattern | the input of the model |
output | the prediction or response of the model to the pattern |
Reimplemented from shark::AbstractModel< Model::InputType, unsigned int >.
Definition at line 229 of file Converter.h.
|
inlinevirtual |
returns the name of the object
Reimplemented from shark::INameable.
Definition at line 182 of file Converter.h.
|
inlinevirtual |
Return the number of parameters.
Reimplemented from shark::IParameterizable.
Definition at line 193 of file Converter.h.
|
inlinevirtual |
Return the parameter vector.
Reimplemented from shark::IParameterizable.
Definition at line 185 of file Converter.h.
|
inlinevirtual |
From ISerializable.
Reimplemented from shark::AbstractModel< Model::InputType, unsigned int >.
Definition at line 241 of file Converter.h.
|
inlinevirtual |
Set the parameter vector.
Reimplemented from shark::IParameterizable.
Definition at line 189 of file Converter.h.
|
inlinevirtual |
From ISerializable.
Reimplemented from shark::AbstractModel< Model::InputType, unsigned int >.
Definition at line 245 of file Converter.h.