Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Neural Networks UPDATE_WEIGHTS does not work

Hi, I'm trying to develop a neural network, where my weights are trained on-line, i.e. training algorithms should be called more times, and each time the net should keep learning starting from the current weights. So I added UPDATE_WEIGHTS flag, but when I use it, prediction and other methods return nan values. Is there a bug with this flag or am I supposed to do something different?

Neural Networks UPDATE_WEIGHTS does not work

Hi, I'm trying to develop a neural network, where my weights are trained on-line, i.e. training algorithms should be called more times, and each time the net should keep learning starting from the current weights. So I added UPDATE_WEIGHTS flag, but when I use it, prediction and other methods return 0 or nan values. Is there a bug with this flag or am I supposed to do something different?different? Here the code I used:

    Mat classificationResult(1, 100, CV_32F);
    Mat training_set = Mat::zeros(100,1,CV_8U); //fill it with something at each step in the loop
    Mat test_set = Mat::zeros(100,1,CV_8U); //fill it either
    Mat layers(3,1,CV_32S);
    layers.row(0)  = Scalar(100);
    layers.row(1)  = Scalar(10);
    layers.row(2)  = Scalar(100);

    CvANN_MLP aann(layers,CvANN_MLP::SIGMOID_SYM,1,1); //aann initialization
    CvANN_MLP_TrainParams params( cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 1000, 0.0001), CvANN_MLP_TrainParams::BACKPROP, 0.1, 0.1);
    while(1){   //run it for a while
          int iterations = aann.train(training_set, training_set,Mat(),Mat(),params, CvANN_MLP::UPDATE_WEIGHTS);
    }
   aann.predict(test_set, classificationResult);
   cout << classificationResult << endl;

Since I'd like to create an autoassociator supervision coincides with the pattern features.

Neural Networks UPDATE_WEIGHTS does not work

Hi, I'm trying to develop a neural network, where my weights are trained on-line, i.e. training algorithms should be called more times, and each time the net should keep learning starting from the current weights. So I added UPDATE_WEIGHTS flag, but when I use it, prediction and other methods return 0 or nan values. Is there a bug with this flag or am I supposed to do something different? Here the code I used:

    Mat classificationResult(1, 100, CV_32F);
    Mat training_set = Mat::zeros(100,1,CV_8U); //fill it with something at each step in the loop
    Mat test_set = Mat::zeros(100,1,CV_8U); //fill it either
    Mat layers(3,1,CV_32S);
    layers.row(0)  = Scalar(100);
    layers.row(1)  = Scalar(10);
    layers.row(2)  = Scalar(100);

    CvANN_MLP aann(layers,CvANN_MLP::SIGMOID_SYM,1,1); //aann initialization
    CvANN_MLP_TrainParams params( cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 1000, 0.0001), CvANN_MLP_TrainParams::BACKPROP, 0.1, 0.1);
    while(1){   //run it for a while
          int iterations = aann.train(training_set, training_set,Mat(),Mat(),params, CvANN_MLP::UPDATE_WEIGHTS);
    }
   aann.predict(test_set, classificationResult);
   cout << classificationResult << endl;

Since I'd like to create an autoassociator supervision coincides with the pattern features.features. If, instead, I train my network without using UPDATE_WEIGHTS, I get consistent results.