32 #ifndef SHARK_OBJECTIVEFUNCTIONS_SparseAutoencoderError_H 33 #define SHARK_OBJECTIVEFUNCTIONS_SparseAutoencoderError_H 40 #include "Impl/FunctionWrapperBase.h" 42 #include <boost/scoped_ptr.hpp> 61 template<
class H
iddenNeuron,
class OutputNeuron>
63 DatasetType
const& dataset,
66 double rho = 0.5,
double beta = 0.1
68 template<
class H
iddenNeuron,
class OutputNeuron>
70 DatasetType
const& dataset,
73 double rho = 0.5,
double beta = 0.1
77 mp_wrapper.reset(op.mp_wrapper->clone());
83 {
return "SparseAutoencoderError"; }
86 return mp_wrapper->numberOfVariables();
90 return mp_wrapper->proposeStartingPoint();
94 m_regularizer = regularizer;
95 m_regularizationStrength = factor;
98 double eval(RealVector
const& input)
const{
100 double value = mp_wrapper ->
eval(input);
102 value += m_regularizationStrength * m_regularizer->
eval(input);
110 value += m_regularizationStrength * m_regularizer->
evalDerivative(input,regularizerDerivative);
111 noalias(derivative) += m_regularizationStrength*regularizerDerivative;
117 swap(op1.mp_wrapper,op2.mp_wrapper);
121 boost::scoped_ptr<detail::FunctionWrapperBase > mp_wrapper;
124 double m_regularizationStrength;
128 #include "Impl/SparseAutoencoderError.inl"