<p>Before teaching a neural network via <code>neuralnet</code>, it is strongly advised to scale your data:</p>
<pre class="lang-R prettyprint-override"><code>learn &lt;- scale(learn)
# be honest and use the mean and scaling inferred from the training set -
# the test set could in principle contain only one element causing an incorrect scaling
test &lt;- scale(test, center = attributes(learn)$`scaled:center`, scale = attributes(learn)$`scaled:scale`)
model &lt;- neuralnet(formula, learn, ...)
compute(model, test)$net.result
</code></pre>
<p>Neural networks are sensitive to shifting and scaling of the data. Additionally, the initial weights are chosen randomly from a distribution alike to a standard normal one.</p>
<p>See, for example, chapter 3.2, &quot;Preprocessing&quot; (and much more) in an excellent paper by Yoshua Bengio [1].</p>
<p><strong>Modern update:</strong> Modern networks usually approach this sensitivity by using normalization layers, possibly with trained parameters. The most well-known and popular is Batch Normalization [2].</p>
<p>[1] <a href="http://arxiv.org/abs/1206.5533" rel="nofollow noreferrer">http://arxiv.org/abs/1206.5533</a></p>
<p>[2] <a href="https://en.wikipedia.org/wiki/Batch_normalization" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Batch_normalization</a></p>
Neural network in R to predict stock return
<p>I am using neuralnet package and using neuralnet function to train my data and compute to predict. </p>

<pre><code>x &lt;- neuralnet( X15  ~ X1 + X2 + X3 + X8, norm_ind[1:15000,],2,act.fct="tanh",linear.output=TRUE)
pr &lt;- compute(x,testdata)
</code></pre>

<p>The problem I am facing is <code>pr$net.result</code> value is almost constant for all data points. </p>

<p>I am predicting return of stock and providing stock real return one day ahead as target function i.e. <code>X15</code> in formula. Output I am getting is almost constant as you can see below. 
Could anyone tell me what needs to be done? </p>

<pre><code>1084 0.00002217204168
1085 0.00002217204168
1086 0.00002217204168
1087 0.00002217204168
1088 0.00002217204168
1089 0.00002217204168
1090 0.00002217204168
1091 0.00002217204168
1092 0.00002217204168
1093 0.00002217204168
1094 0.00002217204168
1095 0.00002217204168
1096 0.00002217204168
1097 0.00002217204168
1098 0.00002217204168
1099 0.00002217204168
1100 0.00002217204168
</code></pre>