Menu

Memory Input synapse

ucicelos
2008-11-03
2013-04-16
  • ucicelos

    ucicelos - 2008-11-03

    hi guys.

    I am having trouble with getting the network train with memory input. I am getting the following error

    Exception in thread "Thread-1" java.lang.NullPointerException
            at org.joone.io.MemoryInputTokenizer.nextLine(MemoryInputTokenizer.java:51)
            at org.joone.io.StreamInputSynapse.getStream(StreamInputSynapse.java:197)
            at org.joone.io.StreamInputSynapse.readAll(StreamInputSynapse.java:328)
            at org.joone.io.StreamInputSynapse.fwdGet(StreamInputSynapse.java:121)
            at org.joone.engine.Layer.fireFwdGet(Layer.java:246)
            at org.joone.engine.Layer.fwdRun(Layer.java:1351)
            at org.joone.net.NeuralNet.stepForward(NeuralNet.java:1159)
            at org.joone.net.NeuralNet.fastRun(NeuralNet.java:1113)
            at org.joone.net.NeuralNet.fastRun(NeuralNet.java:1075)
            at org.joone.net.NeuralNet$1.run(NeuralNet.java:1011)
            at java.lang.Thread.run(Thread.java:619)

    any pointers toward what i might be doing wrong??

    thanks,
    Ucicelos

     
    • ferra4models

      ferra4models - 2008-11-03

      Just pointers....

      After instantiating a new memory input synapse, you have to still set the input array and also the columns from which to read. So, typically,

      // Create a stream input synapse to read the data from a file
      StreamInputSynapse streamInputSynapse = new StreamInputSynapse ();
      // Configure stream input synapse to get data from some file....

      // Create and populate memory input synapse
      MemoryInputSynapse inputSynapse = new MemoryInputSynapse ();
      inputSynapse.setInputArray ( JooneTools.getDataFromStream ( streamInputSynapse, streamInputSynapse.getFirstRow (), streamInputSynapse.getLastRow (), streamInputSynapse.getFirstCol (), streamInputSynapse.getLastCol () );

      // Configure memory input synapse
      inputSynapse.setAdvancedColumnSelector ( "1-" + String.valueOf ( streamInputSynapse.getLastCol () - streamInputSynapse.getFirstCol () + 1 );

      I use this often to speed up the processing.

      Regards
      MG
      http://www.ferra4models.com

       
    • ucicelos

      ucicelos - 2008-11-03

      Hi MG,

      Thanks for taking time to reply.

      I am using one of the example and  it works when I initialize array in the following way

      private double[][]  inputArray = new double[][] {
              {0.0, 0.0, 0.0},
              {0.0, 1.0, 1.0},
              {1.0, 0.0, 1.0},
              {1.0, 1.0, 0.0}
          };

      but it gives me that error, when i use following code

      private double[][]  inputArray=null;
      public double createTrainValidate(double [][] inA) {
             inputArray = new double[inA.length][inA[0].length];
             inputArray=inA;

      inA is the same double[][] array defined in some other class.

      its just baffling me :(

       
    • ucicelos

      ucicelos - 2008-11-03

      Hi,

      Don't worry....I think the array wasn't  getting initialized, Solved.

      Thanks anyways :)

      Ucicelos

       
    • ferra4models

      ferra4models - 2008-11-03

      > inputArray = new double[inA.length][inA[0].length];
      > inputArray=inA;

      These 2 lines look funny. First you initialise inputArray, then you assign it to something else? It seems that inA is the problem then? Maybe post more code to show inA's definition and the memory input synapse.

      Regards
      MG
      http://www.ferra4models.com

       
    • ferra4models

      ferra4models - 2008-11-03

      OK, seems our posts crossed, so ignore my last one as well.....

      Regards
      MG
      http://www.ferra4models.com

       

Log in to post a comment.

MongoDB Logo MongoDB