Results 1 to 5 of 5

Thread: array error

  1. #1
    blu_fox88 is offline Member
    Join Date
    Feb 2010
    Posts
    9
    Rep Power
    0

    Default array error

    Exception in thread "main" java.lang.NullPointerException
    at org.encog.neural.networks.training.propagation.bac k.Backpropagation.<init>(Unknown Source)
    at neural_network.NetworkTrain.training(NetworkTrain. java:35)
    at neural_network.Main.main(Main.java:17)


    public class NetworkTrain
    {
    public static void training (){
    final File file = new File(Names.NETNAME);

    final EncogPersistedCollection encog = new EncogPersistedCollection(
    file);

    //create the network dataset
    double netinput [][] ={
    {0.3140,0.31370,0.31340,0.31310,0.31310,0.31360,0. 31390,
    0.31480,0.31720,0.31770}
    };
    double netideal [][] = {
    {0.31780}
    };
    NeuralDataSet traindata = new BasicNeuralDataSet(netinput, netideal);

    final BasicNetwork network = (BasicNetwork) encog
    .find(Names.NETNAME);

    // train the neural network
    final Train train = new Backpropagation(network, traindata, 0.7, 0.2);

    int epoch = 1;

    I'm having lots of problems with my neural network. This is the error i get and my code.
    Please help.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Check if "network" is null.

  3. #3
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    provide us the object code

    NeuralDataSet traindata = new BasicNeuralDataSet(netinput, netideal);

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,785
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Webuser View Post
    provide us the object code
    No, the exception stack trace showed this:

    Java Code:
    at neural_network.NetworkTrain.training(NetworkTrain. java:35)
    so the OP'd better show us line 35 of the file NetworkTrain.java, because that line is on the track where the exception occurred; don't obfuscate people by writing nonsense and please don't beg for rep points, that is so adolescent. You haven't supplied (m)any useful answers yet.

    kind regards,

    Jos

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Since the actual exception is thrown from:
    at org.encog.neural.networks.training.propagation.bac k.Backpropagation.<init>(Unknown Source)

    and the only line doing an init on Backpropagation is:
    final Train train = new Backpropagation(network, traindata, 0.7, 0.2);

    I would guess that that's line 35, so either network or traindata is null, and traindata is initialised two lines beforehand...

    Of course, it could be some other internal thing to Backpropagation, but I would lay odds on it being network is null.

Similar Threads

  1. Can't Solve Array Error
    By Gregadeaux in forum New To Java
    Replies: 2
    Last Post: 12-14-2009, 04:01 AM
  2. Error if array contains duplicate integers
    By lithium002 in forum New To Java
    Replies: 4
    Last Post: 12-05-2009, 09:58 AM
  3. Replies: 1
    Last Post: 12-05-2009, 08:28 AM
  4. Replies: 1
    Last Post: 03-31-2009, 07:40 AM
  5. Replies: 3
    Last Post: 01-23-2009, 09:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •