title: Neural network and algorithm(s), predicting future outcome from past
body: <p>I was working on a algorithm, where I am given some input and I am given output for them, and given the output for 3 months (give or take) I need a way to find/calculate what might be the future output.<br>
  Now, this problem given can be related to stock exchange, we are given certaing constraints and certain outcomes, and we need to find the next.<br>
  I stumbled upon neural network stock market prediction, you can <a href="https://www.google.co.in/#hl=en&amp;sclient=psy-ab&amp;q=neural+networks+stock+market+prediction&amp;oq=neural+networks+stock&amp;gs_l=hp.3.0.0l3j0i30.10255.16257.0.17291.18.14.2.2.2.0.250.2580.0j11j3.14.0.les;..0.0...1c.1.5ZcKSY3V0uo&amp;pbx=1&amp;bav=on.2,or.r_gc.r_pw.r_qf.&amp;fp=44e6e71ca51f30fd&amp;bpcl=36601534&amp;biw=1280&amp;bih=615" rel="noreferrer">Google</a> it, or you can read about it <a href="http://people.ok.ubc.ca/rlawrenc/research/Papers/nn.pdf" rel="noreferrer">here</a>, <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.134.1114&amp;rep=rep1&amp;type=pdf" rel="noreferrer">here</a> and <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.109.3374&amp;rep=rep1&amp;type=pdf" rel="noreferrer">here</a>.</p>
  
  <p>To get started at making the algorithm, I couldn't figure out what should be the structure of layers.<br>
  The given constraint are:</p>
  
  <ul>
  <li>The output would always be integer.</li>
  <li>The output would always be between 1 and 100.</li>
  <li>There is no exact input for say, just like stock market, we just know that the stock price would fluctuate btw 1 and 100, so we might (or not?) consider this as the only input.</li>
  <li>We have record for last 3 months (or more).</li>
  </ul>
  
  <p>Now, my first question is, how many nodes do I take for input?  </p>
  
  <p>The output is just one, fine. But as I said, should I take 100 nodes for input layer (given that the stock price would always be integer and would always be btw 1 and 100?)</p>
  
  <p>What about hidden layer? How many nodes there? Say, if I take 100 nodes there too, I don't think that would train the network much, because what I think is that for each input we need to take into account all previous input also.</p>
  
  <p>Say, we are calulating output for 1st day of 4th month, we should have 90 nodes in hidden/middle layer (imagining each  month is 30 days for simplicity). Now there are two cases</p>
  
  <ul>
  <li>Our prediction was correct and outcome was same as we predicted.</li>
  <li>Our prediction failed, and the outcome was different than what we predicted.</li>
  </ul>
  
  <p>Whatever the case be, now when we are calculating the output for 2nd day of 4th month, we need not only those 90 input(s) but also that last <em>result (and not the prediction, be it the same!)</em> too, so we now have 91 nodes in our middle/hidden layer. </p>
  
  <p>And so on, it would keep increasing the number of nodes each day, AFAICT.</p>
  
  <p>So, my other question is how do I define/set the number of nodes in hidden/middle layer if its dynamically changing.</p>
  
  <p>My last question is, is there any other particular algorithm out there (for this kinda thing/stuff) that I am not aware of? That I should be using instead of messing around with this neural networking stuff?</p>
  
  <p>Lastly, is there anything, that I might be missing that might cause me (rather the algo I am making) to predict the output, I mean any caveats, or anything that might make it go wrong that I might be missing?</p>