title: Regression in DL4J - predict the next time-step
body: <p>I have a multiLayer network trained, but I'm stuck on how to do a prediction for additional time-steps. </p>
  
  <p>I tried following the character iteration example by creating this method - </p>
  
  <pre><code>public float[] sampleFromNetwork(INDArray testingData, int numTimeSteps, DataSetIterator iter){
      int inputCount = this.getNumOfInputs();
      int outputCount = this.getOutputCount();
  
      float[] samples = new float[numTimeSteps];
  
      //Sample from network (and feed samples back into input) one value at a time (for all samples)
      //Sampling is done in parallel here
      this.network.rnnClearPreviousState();
      INDArray output = this.network.rnnTimeStep(testingData);
      output = output.tensorAlongDimension(output.size(2)-1,1,0); //Gets the last time step output
  
      for( int i=0; i&lt;numTimeSteps; ++i ){
          //Set up next input (single time step) by sampling from previous output
          INDArray nextInput = Nd4j.zeros(1,inputCount);
  
          //Output is a probability distribution. Sample from this for each example we want to generate, and add it to the new input
          double[] outputProbDistribution = new double[outputCount];
          for( int j=0; j&lt;outputProbDistribution.length; j++ ) {
              outputProbDistribution[j] = output.getDouble(j);
          }
          int nextValue = sampleFromDistribution(outputProbDistribution, new Random());
  
          nextInput.putScalar(new int[]{0,nextValue}, 1.0f);      //Prepare next time step input
          samples[i] = (nextValue);   //Add sampled character to StringBuilder (human readable output)
          output = this.network.rnnTimeStep(nextInput);   //Do one time step of forward pass
      }
  
      return samples;
  }
  </code></pre>
  
  <p>but the sampleFromDistribution() doesn't make sense because I am not using discrete classes.</p>
  
  <p>Any thougts?</p>