corrected some typos
This commit is contained in:
@@ -1458,10 +1458,11 @@ predicted<span style="color: #666666">=</span>np<span style="color: #666666">.</
|
||||
trainScore <span style="color: #666666">=</span> model<span style="color: #666666">.</span>evaluate(trainX, trainY, verbose<span style="color: #666666">=0</span>)
|
||||
<span style="color: #008000">print</span>(trainScore)
|
||||
|
||||
index <span style="color: #666666">=</span> df<span style="color: #666666">.</span>index<span style="color: #666666">.</span>values
|
||||
plt<span style="color: #666666">.</span>plot(index,df)
|
||||
plt<span style="color: #666666">.</span>plot(index,predicted)
|
||||
plt<span style="color: #666666">.</span>axvline(df<span style="color: #666666">.</span>index[Tp], c<span style="color: #666666">=</span><span style="color: #BA2121">"r"</span>)
|
||||
|
||||
df <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(x)
|
||||
pred <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(predicted)
|
||||
plt<span style="color: #666666">.</span>plot(df,c<span style="color: #666666">=</span><span style="color: #BA2121">"b"</span>)
|
||||
plt<span style="color: #666666">.</span>plot(pred,c<span style="color: #666666">=</span><span style="color: #BA2121">"r"</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre>
|
||||
</div>
|
||||
@@ -1544,24 +1545,24 @@ y_tot <span style="color: #666666">=</span> np<span style="color: #666666">.</sp
|
||||
<p>The way the recurrent neural networks are trained in this program
|
||||
differs from how machine learning algorithms are usually trained.
|
||||
Typically a machine learning algorithm is trained by learning the
|
||||
relationship between the x data and the y data. In this program, the
|
||||
relationship between the \( x \) data and the \( y \) data. In this program, the
|
||||
recurrent neural network will be trained to recognize the relationship
|
||||
in a sequence of y values. This is type of data formatting is
|
||||
typically used time series forcasting, but it can also be used in any
|
||||
in a sequence of \( y \) values. This is type of data formatting is
|
||||
typically used for time series forecasting, but it can also be used in any
|
||||
extrapolation (time series forecasting is just a specific type of
|
||||
extrapolation along the time axis). This method of data formatting
|
||||
does not use the x data and assumes that the y data are evenly spaced.
|
||||
does not use the \( x \) data and assumes that the \( y \) data are evenly spaced.
|
||||
</p>
|
||||
|
||||
<p>For a standard machine learning algorithm, the training data has the
|
||||
form of (x,y) so the machine learning algorithm learns to assiciate a
|
||||
y value with a given x value. This is useful when the test data has x
|
||||
form of \( (x,y) \) so the machine learning algorithm learns to associate a
|
||||
\( y \) value with a given \( x \) value. This is useful when the test data has \( x \)
|
||||
values within the same range as the training data. However, for this
|
||||
application, the x values of the test data are outside of the x values
|
||||
of the training data and the traditional method of training a machine
|
||||
learning algorithm does not work as well. For this reason, the
|
||||
recurrent neural network is trained on sequences of y values of the
|
||||
form ((y1, y2), y3), so that the network is concerned with learning
|
||||
form \( ((y1, y2), y3) \), so that the network is concerned with learning
|
||||
the pattern of the y data and not the relation between the x and y
|
||||
data. As long as the pattern of y data outside of the training region
|
||||
stays relatively stable compared to what was inside the training
|
||||
|
||||
@@ -1417,10 +1417,11 @@ predicted=np.concatenate((trainPredict,testPredict),axis=<span style="color: #B4
|
||||
trainScore = model.evaluate(trainX, trainY, verbose=<span style="color: #B452CD">0</span>)
|
||||
<span style="color: #658b00">print</span>(trainScore)
|
||||
|
||||
index = df.index.values
|
||||
plt.plot(index,df)
|
||||
plt.plot(index,predicted)
|
||||
plt.axvline(df.index[Tp], c=<span style="color: #CD5555">"r"</span>)
|
||||
|
||||
df = pd.DataFrame(x)
|
||||
pred = pd.DataFrame(predicted)
|
||||
plt.plot(df,c=<span style="color: #CD5555">"b"</span>)
|
||||
plt.plot(pred,c=<span style="color: #CD5555">"r"</span>)
|
||||
plt.show()
|
||||
</pre>
|
||||
</div>
|
||||
@@ -1503,24 +1504,24 @@ y_tot = np.array([-<span style="color: #B452CD">0.03077640549</span>, -<span sty
|
||||
<p>The way the recurrent neural networks are trained in this program
|
||||
differs from how machine learning algorithms are usually trained.
|
||||
Typically a machine learning algorithm is trained by learning the
|
||||
relationship between the x data and the y data. In this program, the
|
||||
relationship between the \( x \) data and the \( y \) data. In this program, the
|
||||
recurrent neural network will be trained to recognize the relationship
|
||||
in a sequence of y values. This is type of data formatting is
|
||||
typically used time series forcasting, but it can also be used in any
|
||||
in a sequence of \( y \) values. This is type of data formatting is
|
||||
typically used for time series forecasting, but it can also be used in any
|
||||
extrapolation (time series forecasting is just a specific type of
|
||||
extrapolation along the time axis). This method of data formatting
|
||||
does not use the x data and assumes that the y data are evenly spaced.
|
||||
does not use the \( x \) data and assumes that the \( y \) data are evenly spaced.
|
||||
</p>
|
||||
|
||||
<p>For a standard machine learning algorithm, the training data has the
|
||||
form of (x,y) so the machine learning algorithm learns to assiciate a
|
||||
y value with a given x value. This is useful when the test data has x
|
||||
form of \( (x,y) \) so the machine learning algorithm learns to associate a
|
||||
\( y \) value with a given \( x \) value. This is useful when the test data has \( x \)
|
||||
values within the same range as the training data. However, for this
|
||||
application, the x values of the test data are outside of the x values
|
||||
of the training data and the traditional method of training a machine
|
||||
learning algorithm does not work as well. For this reason, the
|
||||
recurrent neural network is trained on sequences of y values of the
|
||||
form ((y1, y2), y3), so that the network is concerned with learning
|
||||
form \( ((y1, y2), y3) \), so that the network is concerned with learning
|
||||
the pattern of the y data and not the relation between the x and y
|
||||
data. As long as the pattern of y data outside of the training region
|
||||
stays relatively stable compared to what was inside the training
|
||||
|
||||
@@ -1393,10 +1393,11 @@ predicted=np.concatenate((trainPredict,testPredict),axis=<span style="color: #B4
|
||||
trainScore = model.evaluate(trainX, trainY, verbose=<span style="color: #B452CD">0</span>)
|
||||
<span style="color: #658b00">print</span>(trainScore)
|
||||
|
||||
index = df.index.values
|
||||
plt.plot(index,df)
|
||||
plt.plot(index,predicted)
|
||||
plt.axvline(df.index[Tp], c=<span style="color: #CD5555">"r"</span>)
|
||||
|
||||
df = pd.DataFrame(x)
|
||||
pred = pd.DataFrame(predicted)
|
||||
plt.plot(df,c=<span style="color: #CD5555">"b"</span>)
|
||||
plt.plot(pred,c=<span style="color: #CD5555">"r"</span>)
|
||||
plt.show()
|
||||
</pre>
|
||||
</div>
|
||||
@@ -1479,24 +1480,24 @@ y_tot = np.array([-<span style="color: #B452CD">0.03077640549</span>, -<span sty
|
||||
<p>The way the recurrent neural networks are trained in this program
|
||||
differs from how machine learning algorithms are usually trained.
|
||||
Typically a machine learning algorithm is trained by learning the
|
||||
relationship between the x data and the y data. In this program, the
|
||||
relationship between the \( x \) data and the \( y \) data. In this program, the
|
||||
recurrent neural network will be trained to recognize the relationship
|
||||
in a sequence of y values. This is type of data formatting is
|
||||
typically used time series forcasting, but it can also be used in any
|
||||
in a sequence of \( y \) values. This is type of data formatting is
|
||||
typically used for time series forecasting, but it can also be used in any
|
||||
extrapolation (time series forecasting is just a specific type of
|
||||
extrapolation along the time axis). This method of data formatting
|
||||
does not use the x data and assumes that the y data are evenly spaced.
|
||||
does not use the \( x \) data and assumes that the \( y \) data are evenly spaced.
|
||||
</p>
|
||||
|
||||
<p>For a standard machine learning algorithm, the training data has the
|
||||
form of (x,y) so the machine learning algorithm learns to assiciate a
|
||||
y value with a given x value. This is useful when the test data has x
|
||||
form of \( (x,y) \) so the machine learning algorithm learns to associate a
|
||||
\( y \) value with a given \( x \) value. This is useful when the test data has \( x \)
|
||||
values within the same range as the training data. However, for this
|
||||
application, the x values of the test data are outside of the x values
|
||||
of the training data and the traditional method of training a machine
|
||||
learning algorithm does not work as well. For this reason, the
|
||||
recurrent neural network is trained on sequences of y values of the
|
||||
form ((y1, y2), y3), so that the network is concerned with learning
|
||||
form \( ((y1, y2), y3) \), so that the network is concerned with learning
|
||||
the pattern of the y data and not the relation between the x and y
|
||||
data. As long as the pattern of y data outside of the training region
|
||||
stays relatively stable compared to what was inside the training
|
||||
|
||||
@@ -1470,10 +1470,11 @@ predicted<span style="color: #666666">=</span>np<span style="color: #666666">.</
|
||||
trainScore <span style="color: #666666">=</span> model<span style="color: #666666">.</span>evaluate(trainX, trainY, verbose<span style="color: #666666">=0</span>)
|
||||
<span style="color: #008000">print</span>(trainScore)
|
||||
|
||||
index <span style="color: #666666">=</span> df<span style="color: #666666">.</span>index<span style="color: #666666">.</span>values
|
||||
plt<span style="color: #666666">.</span>plot(index,df)
|
||||
plt<span style="color: #666666">.</span>plot(index,predicted)
|
||||
plt<span style="color: #666666">.</span>axvline(df<span style="color: #666666">.</span>index[Tp], c<span style="color: #666666">=</span><span style="color: #BA2121">"r"</span>)
|
||||
|
||||
df <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(x)
|
||||
pred <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(predicted)
|
||||
plt<span style="color: #666666">.</span>plot(df,c<span style="color: #666666">=</span><span style="color: #BA2121">"b"</span>)
|
||||
plt<span style="color: #666666">.</span>plot(pred,c<span style="color: #666666">=</span><span style="color: #BA2121">"r"</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre>
|
||||
</div>
|
||||
@@ -1556,24 +1557,24 @@ y_tot <span style="color: #666666">=</span> np<span style="color: #666666">.</sp
|
||||
<p>The way the recurrent neural networks are trained in this program
|
||||
differs from how machine learning algorithms are usually trained.
|
||||
Typically a machine learning algorithm is trained by learning the
|
||||
relationship between the x data and the y data. In this program, the
|
||||
relationship between the \( x \) data and the \( y \) data. In this program, the
|
||||
recurrent neural network will be trained to recognize the relationship
|
||||
in a sequence of y values. This is type of data formatting is
|
||||
typically used time series forcasting, but it can also be used in any
|
||||
in a sequence of \( y \) values. This is type of data formatting is
|
||||
typically used for time series forecasting, but it can also be used in any
|
||||
extrapolation (time series forecasting is just a specific type of
|
||||
extrapolation along the time axis). This method of data formatting
|
||||
does not use the x data and assumes that the y data are evenly spaced.
|
||||
does not use the \( x \) data and assumes that the \( y \) data are evenly spaced.
|
||||
</p>
|
||||
|
||||
<p>For a standard machine learning algorithm, the training data has the
|
||||
form of (x,y) so the machine learning algorithm learns to assiciate a
|
||||
y value with a given x value. This is useful when the test data has x
|
||||
form of \( (x,y) \) so the machine learning algorithm learns to associate a
|
||||
\( y \) value with a given \( x \) value. This is useful when the test data has \( x \)
|
||||
values within the same range as the training data. However, for this
|
||||
application, the x values of the test data are outside of the x values
|
||||
of the training data and the traditional method of training a machine
|
||||
learning algorithm does not work as well. For this reason, the
|
||||
recurrent neural network is trained on sequences of y values of the
|
||||
form ((y1, y2), y3), so that the network is concerned with learning
|
||||
form \( ((y1, y2), y3) \), so that the network is concerned with learning
|
||||
the pattern of the y data and not the relation between the x and y
|
||||
data. As long as the pattern of y data outside of the training region
|
||||
stays relatively stable compared to what was inside the training
|
||||
|
||||
Binary file not shown.
+173
-172
File diff suppressed because it is too large
Load Diff
@@ -921,11 +921,13 @@ predicted=np.concatenate((trainPredict,testPredict),axis=0)
|
||||
trainScore = model.evaluate(trainX, trainY, verbose=0)
|
||||
print(trainScore)
|
||||
|
||||
index = df.index.values
|
||||
plt.plot(index,df)
|
||||
plt.plot(index,predicted)
|
||||
plt.axvline(df.index[Tp], c="r")
|
||||
|
||||
df = pd.DataFrame(x)
|
||||
pred = pd.DataFrame(predicted)
|
||||
plt.plot(df,c="b")
|
||||
plt.plot(pred,c="r")
|
||||
plt.show()
|
||||
|
||||
!ec
|
||||
|
||||
|
||||
@@ -976,23 +978,23 @@ y_tot = np.array([-0.03077640549, -0.08336233266, -0.1446729567, -0.2116753732,
|
||||
The way the recurrent neural networks are trained in this program
|
||||
differs from how machine learning algorithms are usually trained.
|
||||
Typically a machine learning algorithm is trained by learning the
|
||||
relationship between the x data and the y data. In this program, the
|
||||
relationship between the $x$ data and the $y$ data. In this program, the
|
||||
recurrent neural network will be trained to recognize the relationship
|
||||
in a sequence of y values. This is type of data formatting is
|
||||
typically used time series forcasting, but it can also be used in any
|
||||
in a sequence of $y$ values. This is type of data formatting is
|
||||
typically used for time series forecasting, but it can also be used in any
|
||||
extrapolation (time series forecasting is just a specific type of
|
||||
extrapolation along the time axis). This method of data formatting
|
||||
does not use the x data and assumes that the y data are evenly spaced.
|
||||
does not use the $x$ data and assumes that the $y$ data are evenly spaced.
|
||||
|
||||
For a standard machine learning algorithm, the training data has the
|
||||
form of (x,y) so the machine learning algorithm learns to assiciate a
|
||||
y value with a given x value. This is useful when the test data has x
|
||||
form of $(x,y)$ so the machine learning algorithm learns to associate a
|
||||
$y$ value with a given $x$ value. This is useful when the test data has $x$
|
||||
values within the same range as the training data. However, for this
|
||||
application, the x values of the test data are outside of the x values
|
||||
of the training data and the traditional method of training a machine
|
||||
learning algorithm does not work as well. For this reason, the
|
||||
recurrent neural network is trained on sequences of y values of the
|
||||
form ((y1, y2), y3), so that the network is concerned with learning
|
||||
form $((y1, y2), y3)$, so that the network is concerned with learning
|
||||
the pattern of the y data and not the relation between the x and y
|
||||
data. As long as the pattern of y data outside of the training region
|
||||
stays relatively stable compared to what was inside the training
|
||||
|
||||
Reference in New Issue
Block a user