[mlpack] Training very simple neural networks

Kirill Mishchenko ki.mishchenko at gmail.com
Mon May 29 09:42:09 EDT 2017


Hi!

I’m working on cross-validation module for mlpack, and for better code coverage in tests I want to check some functionality on neural networks. For that I need to train a very simple feedforward neural network that is able to remember responses for training data. I tried the following:

  arma::mat data("1 2");
  arma::mat trainingResponses("1 2; 3 4");

  FFN<MeanSquaredError<>> ffn;
  ffn.Add<Linear<>>(1, 2);
  ffn.Add<ReLULayer<>>();

  ffn.Train(data, trainingResponses);

  arma::mat predictedResponses;
  ffn.Predict(data, predictedResponses);

After running this piece of code the predictedResponse matrix was the zero matrix (2x2) rather than something close to arma::mat("1 2; 3 4”). What did I do wrong?

I also have noticed that if I don’t add ReLULayer<>, than there is an error during training:

  unknown location:0: fatal error: in "CVTest/MSENNTest": signal: SIGABRT (application abort requested)

Is it possible to train a linear model with the FNN class (i.e. linear regression)?

Best regards,

Kirill Mishchenko



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20170529/1bf01392/attachment.html>


More information about the mlpack mailing list