[mlpack-git] [mlpack] implement command line programs of softmaxRegression (#466)

stereomatchingkiss notifications at github.com
Thu Oct 29 22:19:23 EDT 2015


>I can add the documentation under the PROGRAM_INFO() macro, so don't worry about that unless you want to.

I will leave this to you, thanks.

>If you want, it might be worth it to add an --optimizer option

I would like to, but which optimizer is suit for SoftmaxRegressionFunction?As far as I know, it do not fit the requirements of aug_lagrangian, sa, and sgd, is LRSDP suit for SoftmaxRegressionFunction?

>I think data::NormalizeLabels() will do what you want here.

Correct me if I am wrong, what I want to do is find out the number of classes(equal to the number of the unique labels), but the NormalizeLabels() will normalize the labels between [0...n), it do not help me find out the number of unique labels.

>I'd avoid using auto for clarity's sake.

I had the same concern as yours, until I read this post(http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/).

auto has several downsides(auto may ruin the results if the return type is some sort of proxy), but it has its merits too.

I think auto is quite safe, easy to read and easier to adapt to future change in this case.In c++98, we have to write out the type explicitly

    const std::string inputFile = CLI::GetParam<std::string>("input_data");
    const std::string labelFile = CLI::GetParam<std::string>("input_label");
    const int maxIterations = CLI::GetParam<int>("max_iterations");

But with auto, the type of the variables become more versatile and able to adapt to the change of codes.With auto, we do not need to change the type on both sides even the type of GetParam change in the future.

auto version 

    const auto maxIterations = CLI::GetParam<size_t>("max_iterations");

explicit version, you have to change the type on both sides

    const size_t maxIterations = CLI::GetParam<size_t>("max_iterations");

if you think this is acceptable, I would prefer auto in this case; If you think explicit type is better, I would use explicit types(already change to explicit type)

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


More information about the mlpack-git mailing list