[mlpack] Layer with a regularizer: should it work?
Ryan Mitchley
ryan at peralex.com
Wed Mar 31 09:26:58 EDT 2021
Hi all,
I have tried adding a L2Regularizer to a Linear ANN layer instead of the
default NoRegularizer.
Making the default NoRegularizer explicit works:
FFN<NegativeLogLikelihood<>, RandomInitialization> model;
model.Add<Linear<arma::mat, arma::mat, NoRegularizer>>(24 * uInRows *
uInCols, uNumCategories, NoRegularizer());
However, the following produces a slew of incomprehensible compiler errors:
model.Add<Linear<arma::mat, arma::mat, L2Regularizer>>(24 * uInRows *
uInCols, uNumCategories, L2Regularizer(0.1));
The error messages end with:
mlpack::ann::TransposedConvolution<mlpack::ann::NaiveConvolution<mlpack::ann::ValidConvolution>,mlpack::ann::NaiveConvolution<mlpack::ann::ValidConvolution>,mlpack::ann::NaiveConvolution<mlpack::ann::ValidConvolution>,arma::mat,arma::mat>
*,mlpack::ann::WeightNorm<arma::mat,arma::mat>
*,mlpack::ann::MoreTypes>>>::push_back(const _Ty &)': cannot convert
argument 1 from 'LayerType *' to 'const _Ty &'
mlpack-3.4.2\src\mlpack\methods\ann\ffn.hpp 290
Should I expect this to work? I don't see any use of regularizers in the
examples. However, the LRegularizer code is in the library so I imagine
I could be using this incorrectly?
Thanks for any help.
Best regards,
Ryan
Disclaimer: http://www2.peralex.com/disclaimer.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20210331/37fdafdc/attachment.htm>
More information about the mlpack
mailing list