title: Sequential Neural Network
body: <p>I am trying to construct a neural network as a generative model, to predict the next vector following a sequence of vectors (each vector is a distribution of real numbers of length <code>n</code>).</p>
  
  <p>My thought was to take <code>k</code> previous sequences and concatenate them to have a <code>k</code>x<code>n</code> input vector. To train the model, I would have the next vector in the sequence as the output. As I am looking for non-deterministic output, I was going to use a sigmoid activation function with low gradient.</p>
  
  <p>Does this procedure seem reasonable?</p>
  
  <p>In the hope it does, I tried implementing it in R using both the <code>nnet</code> and <code>neuralnet</code> libraries, but it the documentation and examples I came across, it seems the input and output vectors must be of the same length. What is the syntax to train on input/output vectors of varying length in either of those modules?</p>
  
  <p>A sample of my input vector is:</p>
  
  <pre><code>      [,1]      
   [1,] 0         
   [2,] 0         
   [3,] 0.6       
   [4,] 0.4       
   [5,] 0         
   [6,] 0         
   [7,] 0.06666667
   [8,] 0.6666667 
   [9,] 0         
  [10,] 0.2666667 
  [11,] 0         
  [12,] 0.4       
  [13,] 0         
  [14,] 0         
  [15,] 0.6       
  </code></pre>
  
  <p>And output vector:</p>
  
  <pre><code>      [,1]    
   [1,] 0         
   [2,] 0         
   [3,] 0.8571429 
   [4,] 0         
   [5,] 0.1428571 
  </code></pre>
  
  <p>N.B. The above sample has <code>n=5</code>, <code>k=3</code>, although my actual dataset has <code>n~200</code>. In both cases, the individual vectors are normalized to 1.</p>
  
  <p>Any help is much appreciated!</p>