Model which corrupts the data using Impulse noise. More...
#include <shark/Models/ImpulseNoiseModel.h>
Public Member Functions | |
ImpulseNoiseModel () | |
Default Constructor; use setStructure later. More... | |
ImpulseNoiseModel (unsigned int inputs, double prob, double value=0.0) | |
Constructor creating a model with given input size and a probability to set values of the input to a given value. More... | |
std::string | name () const |
From INameable: return the class name. More... | |
size_t | inputSize () const |
obtain the input dimension More... | |
size_t | outputSize () const |
obtain the output dimension More... | |
RealVector | parameterVector () const |
obtain the parameter vector More... | |
void | setParameterVector (RealVector const &newParameters) |
overwrite the parameter vector More... | |
size_t | numberOfParameters () const |
return the number of parameter More... | |
boost::shared_ptr< State > | createState () const |
Creates an internal state of the model. More... | |
void | eval (BatchInputType const &inputs, BatchOutputType &outputs) const |
Add noise to the input. More... | |
void | eval (BatchInputType const &inputs, BatchOutputType &outputs, State &state) const |
Evaluate the model: output = matrix * input + offset. More... | |
void | weightedParameterDerivative (BatchInputType const &patterns, RealVector const &coefficients, State const &state, RealVector &gradient) const |
Public Member Functions inherited from shark::AbstractModel< RealVector, RealVector > | |
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 void | read (InArchive &archive) |
From ISerializable, reads a model from an archive. More... | |
virtual void | write (OutArchive &archive) const |
writes a model to an archive More... | |
virtual void | eval (InputType const &pattern, OutputType &output) const |
Standard interface for evaluating the response of the model to a single pattern. 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 | |
Public Types inherited from shark::AbstractModel< RealVector, RealVector > | |
enum | Feature |
typedef RealVector | InputType |
Defines the input type of the model. More... | |
typedef RealVector | 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 |
Protected Attributes inherited from shark::AbstractModel< RealVector, RealVector > | |
Features | m_features |
Model which corrupts the data using Impulse noise.
We define impulse noise as a noise which randomly sets the value of an element in a vector to a given value, 0 by default. We chose the name as with for example a noise of 1, impulses can be seen in the visualised vectors.
very input dimension is tested independently.
This noise can be used to implement denoising autoencoders for binary data.
Definition at line 49 of file ImpulseNoiseModel.h.
|
inline |
Default Constructor; use setStructure later.
Definition at line 59 of file ImpulseNoiseModel.h.
References shark::AbstractModel< RealVector, RealVector >::HAS_FIRST_PARAMETER_DERIVATIVE, and shark::AbstractModel< RealVector, RealVector >::m_features.
|
inline |
Constructor creating a model with given input size and a probability to set values of the input to a given value.
Definition at line 63 of file ImpulseNoiseModel.h.
References shark::AbstractModel< RealVector, RealVector >::HAS_FIRST_PARAMETER_DERIVATIVE, and shark::AbstractModel< RealVector, RealVector >::m_features.
|
inlinevirtual |
Creates an internal state of the model.
The state is needed when the derivatives are to be calculated. Eval can store a state which is then reused to speed up the calculations of the derivatives. This also allows eval to be evaluated in parallel!
Reimplemented from shark::AbstractModel< RealVector, RealVector >.
Definition at line 97 of file ImpulseNoiseModel.h.
|
inlinevirtual |
Add noise to the input.
Reimplemented from shark::AbstractModel< RealVector, RealVector >.
Definition at line 102 of file ImpulseNoiseModel.h.
References shark::coinToss(), inputSize(), SHARK_CRITICAL_REGION, and SIZE_CHECK.
Referenced by eval().
|
inlinevirtual |
Evaluate the model: output = matrix * input + offset.
Implements shark::AbstractModel< RealVector, RealVector >.
Definition at line 116 of file ImpulseNoiseModel.h.
References eval().
|
inline |
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 69 of file ImpulseNoiseModel.h.
|
inlinevirtual |
return the number of parameter
Reimplemented from shark::IParameterizable.
Definition at line 94 of file ImpulseNoiseModel.h.
|
inline |
obtain the output dimension
Definition at line 78 of file ImpulseNoiseModel.h.
|
inlinevirtual |
obtain the parameter vector
Reimplemented from shark::IParameterizable.
Definition at line 83 of file ImpulseNoiseModel.h.
|
inlinevirtual |
overwrite the parameter vector
Reimplemented from shark::IParameterizable.
Definition at line 88 of file ImpulseNoiseModel.h.
References SIZE_CHECK.
|
inline |
Definition at line 120 of file ImpulseNoiseModel.h.