1

I'm using Neuroph 2.9 framework to code ANN to predict housing prices. I want get every error every time run every epoch (to show the improve of error on chart) but this cause error.

// create multi layer perceptron
    System.out.println("Creating neural network");
    MultiLayerPerceptron neuralNet = new MultiLayerPerceptron(
            TransferFunctionType.SIGMOID, inputsCount, hiddentsCount1,
            outputsCount);

// set learning parameters
    MomentumBackpropagation learningRule = new MomentumBackpropagation();
    learningRule.setLearningRate(0.3);
    learningRule.setMomentum(0.5);
    learningRule.setNeuralNetwork(neuralNet);

    learningRule.setTrainingSet(TrainSet);
    learningRule.doOneLearningIteration(TrainSet);

I get this:

Exception in thread "main" java.lang.NullPointerException
at org.neuroph.nnet.learning.MomentumBackpropagation.updateNeuronWeights(MomentumBackpropagation.java:72)
at org.neuroph.nnet.learning.BackPropagation.calculateErrorAndUpdateOutputNeurons(BackPropagation.java:83)
at org.neuroph.nnet.learning.BackPropagation.updateNetworkWeights(BackPropagation.java:53)
at org.neuroph.core.learning.SupervisedLearning.learnPattern(SupervisedLearning.java:190)
at org.neuroph.core.learning.SupervisedLearning.doLearningEpoch(SupervisedLearning.java:165)
at org.neuroph.core.learning.IterativeLearning.doOneLearningIteration(IterativeLearning.java:245)
at com.thao.Main.main(Main.java:76)

The problem is when I use : learningRule.learn(TrainSet); it's ok, no error come out. The documentation so bad to differ functions to chose right function to run the right thing I want.

chickensoup
  • 334
  • 1
  • 17
  • my advice for you guy even with beginner to ML is that just use common large community framework like Pytorch, Tensorflow. It's much faster and has many good example. We could avoid a lot of bugs like this by learning quicker with their examples. – chickensoup Dec 16 '19 at 15:29

1 Answers1

0

The thing I found is that doOneLearningIteration function didn't work because inside them. It's not initiated. Therefore, to run, we need to override or run 1 epoch and then doOneLearningIteration. That's work for me.

chickensoup
  • 334
  • 1
  • 17