14 #ifndef MLPACK_METHODS_ANN_LAYER_DROPCONNECT_HPP 15 #define MLPACK_METHODS_ANN_LAYER_DROPCONNECT_HPP 60 typename InputDataType = arma::mat,
61 typename OutputDataType = arma::mat
79 const double ratio = 0.5);
88 void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
98 void Backward(
const arma::Mat<eT>& input,
99 const arma::Mat<eT>& gy,
109 template<
typename eT>
110 void Gradient(
const arma::Mat<eT>& input,
111 const arma::Mat<eT>& error,
115 std::vector<LayerTypes<> >&
Model() {
return network; }
128 OutputDataType
const&
Delta()
const {
return delta; }
130 OutputDataType&
Delta() {
return delta; }
133 OutputDataType
const&
Gradient()
const {
return gradient; }
144 double Ratio()
const {
return ratio; }
150 scale = 1.0 / (1.0 - ratio);
159 template<
typename Archive>
160 void serialize(Archive& ar,
const uint32_t );
170 OutputDataType weights;
173 OutputDataType delta;
176 OutputDataType gradient;
179 OutputDataType outputParameter;
188 OutputDataType denoise;
191 LayerTypes<> baseLayer;
194 std::vector<LayerTypes<> > network;
double Ratio() const
The probability of setting a value to zero.
Definition: dropconnect.hpp:144
OutputDataType const & Gradient() const
Get the gradient.
Definition: dropconnect.hpp:133
bool Deterministic() const
The value of the deterministic parameter.
Definition: dropconnect.hpp:138
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
std::vector< LayerTypes<> > & Model()
Get the model modules.
Definition: dropconnect.hpp:115
OutputDataType & Parameters()
Modify the parameters.
Definition: dropconnect.hpp:120
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & Delta()
Modify the delta.
Definition: dropconnect.hpp:130
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Ordinary feed backward pass of the DropConnect layer.
Definition: dropconnect_impl.hpp:84
size_t WeightSize() const
Return the size of the weight matrix.
Definition: dropconnect.hpp:154
void Ratio(const double r)
Modify the probability of setting a value to zero.
Definition: dropconnect.hpp:147
DropConnect()
Create the DropConnect object.
Definition: dropconnect_impl.hpp:31
OutputDataType & Gradient()
Modify the gradient.
Definition: dropconnect.hpp:135
OutputDataType const & Delta() const
Get the delta.
Definition: dropconnect.hpp:128
bool & Deterministic()
Modify the value of the deterministic parameter.
Definition: dropconnect.hpp:141
The DropConnect layer is a regularizer that randomly with probability ratio sets the connection value...
Definition: dropconnect.hpp:63
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: dropconnect.hpp:125
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Ordinary feed forward pass of the DropConnect layer.
Definition: dropconnect_impl.hpp:53
OutputDataType const & Parameters() const
Get the parameters.
Definition: dropconnect.hpp:118
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: dropconnect.hpp:123
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
Definition: dropconnect_impl.hpp:108