[mlpack-git] [mlpack] improve speed of SparseAutoencoder and make it more flexible (#451)

stereomatchingkiss notifications at github.com
Thu Dec 10 14:23:32 EST 2015


>which would result in a single parameter we have to pass to the performance function.

I think both designs have their pros and cons

Implementing SparseCost function, and I find out the Error function need one more parameter--error

    double Error(const DataType&, const DataType&, const DataType &error)

The problem is FNN call the function as following

    return performanceFunc.Error(
            std::get<sizeof...(Tp) - 1>(t).OutputParameter(), target);

But I need the error parameter

    return performanceFunc.Error(
            std::get<sizeof...(Tp) - 1>(t).OutputParameter(), target, error);



Now there are two solutions in my mind 

1 : make all of the Error function accept one more parameter
2 : Use SFINAE to determine which function to called

a : declare a traits 
    HAS_MEM_FUNC(Error, HasErrorCheck);
b : use SFINAE to select appropriate function at compile time

    typename std::enable_if<
          HasErrorCheck<T, double(T::*)(const U&, const U&, const U&)>::value, double>::type

I prefer solution 1, what is your opinion?

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/451#issuecomment-163724808
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20151210/c3751ecf/attachment.html>


More information about the mlpack-git mailing list