Database Reference
In-Depth Information
for ( int i=0;i<1000;i++) {
double base = Math. sin (t);
y[0] = base + 0.5*twist.nextGaussian();
//Update the input time series
if (i >= x.length) {
nn.train(x, y);
System. out .println(nn.output()[0]+"\t"+y[0]+"\t"+base);
//Move the time series over
for ( int j=0;i<x.length-1;j++) x[i] = x[i+1];
x[x.length-1]=y[0];
} else {
x[i] = y[0];
}
t += 2.0*Math. PI /60.0;
}
The first k steps of the process are used to fill the input vector. After the
input vector has been filled, the update algorithm is run every time a new
input arrives. In this particular implementation of a feed-forward neural
network, training the model on an observation also generates a prediction
for the outputs prior to the update of the model.
The neural network in this example is being updated in an online fashion.
A particular data point is only used once in the model, and all data is
eventually used to improve the model. This example produces the predicted
value, base value without noise, and the noisy value used as the input to
the model. Figure 11.7 shows these three values against each other, where
the neural network manages to recover the original signal fairly well. The
original signal is represented by a dotted line; the gray dots indicate the
actual observed values; and the solid line indicates the prediction for each
observed value made by the neural network.
 
Search WWH ::




Custom Search