[mlpack] Question regarding Optimizer template template params.

Arun Reddy arunreddy.nelakurthi at gmail.com
Thu Mar 2 13:25:54 EST 2017


Hi Devs,

I was working on refactoring SGD optimizer to incorporate UpdatePolicyType
as a template param.

template<typename DecomposableFunctionType,
         typename UpdatePolicyType = EmptyUpdate>
class SGD

{
...
}

I came across Optimizer type being referenced in other places as "template
template parameters". DecomposableFunctionType in this case..

template<
  template<typename> class OptimizerType = mlpack::optimization::SGD
>
class RegularizedSVD
{

}

So I have modified the code to the following to make room for UpdatePolicyType..

template<
  template<typename, typename> class OptimizerType = mlpack::optimization::SGD
>
class RegularizedSVD
{

}

But it is used in many other places too.. For eg. LogisticRegression,
L_BFGS uses only one typename, but when the OptimizerType is set to
SGD this fails..

template<
    template<typename> class OptimizerType = mlpack::optimization::L_BFGS
>
void Train(const MatType& predictors,
           const arma::Row<size_t>& responses);


*Question*: Instead of adding additional template parameters everytime
we make some changes to the optimizer, can we make it more generic?


Thanks

Arun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20170302/7be4664f/attachment.html>


More information about the mlpack mailing list