diff --git a/doc/pub/week43/html/week43-bs.html b/doc/pub/week43/html/week43-bs.html index e5f8d9fd6..0b593b5bf 100644 --- a/doc/pub/week43/html/week43-bs.html +++ b/doc/pub/week43/html/week43-bs.html @@ -1458,10 +1458,11 @@ predicted=np.= 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() @@ -1544,24 +1545,24 @@ y_tot = np.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 diff --git a/doc/pub/week43/html/week43-reveal.html b/doc/pub/week43/html/week43-reveal.html index f91554b01..39bb53990 100644 --- a/doc/pub/week43/html/week43-reveal.html +++ b/doc/pub/week43/html/week43-reveal.html @@ -1417,10 +1417,11 @@ predicted=np.concatenate((trainPredict,testPredict),axis=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() @@ -1503,24 +1504,24 @@ y_tot = np.array([-0.03077640549, -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 diff --git a/doc/pub/week43/html/week43-solarized.html b/doc/pub/week43/html/week43-solarized.html index c6440f2f5..1b6ae0059 100644 --- a/doc/pub/week43/html/week43-solarized.html +++ b/doc/pub/week43/html/week43-solarized.html @@ -1393,10 +1393,11 @@ predicted=np.concatenate((trainPredict,testPredict),axis=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() @@ -1479,24 +1480,24 @@ y_tot = np.array([-0.03077640549, -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 diff --git a/doc/pub/week43/html/week43.html b/doc/pub/week43/html/week43.html index 4efcd90a5..1d41c36b0 100644 --- a/doc/pub/week43/html/week43.html +++ b/doc/pub/week43/html/week43.html @@ -1470,10 +1470,11 @@ predicted=np.= 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() @@ -1556,24 +1557,24 @@ y_tot = np.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 diff --git a/doc/pub/week43/ipynb/ipynb-week43-src.tar.gz b/doc/pub/week43/ipynb/ipynb-week43-src.tar.gz index 38921dd10..e21ce151e 100644 Binary files a/doc/pub/week43/ipynb/ipynb-week43-src.tar.gz and b/doc/pub/week43/ipynb/ipynb-week43-src.tar.gz differ diff --git a/doc/pub/week43/ipynb/week43.ipynb b/doc/pub/week43/ipynb/week43.ipynb index d8df74187..28ecc2260 100644 --- a/doc/pub/week43/ipynb/week43.ipynb +++ b/doc/pub/week43/ipynb/week43.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c5d39e0b", + "id": "015c71dd", "metadata": { "editable": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "markdown", - "id": "6459c579", + "id": "f6766299", "metadata": { "editable": true }, @@ -29,7 +29,7 @@ }, { "cell_type": "markdown", - "id": "70ebd784", + "id": "709ed995", "metadata": { "editable": true }, @@ -59,7 +59,7 @@ }, { "cell_type": "markdown", - "id": "ad740247", + "id": "1e56ca1d", "metadata": { "editable": true }, @@ -85,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "9293049f", + "id": "fc35bfe0", "metadata": { "editable": true }, @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "67a1fb47", + "id": "6f622ae2", "metadata": { "editable": true }, @@ -134,7 +134,7 @@ }, { "cell_type": "markdown", - "id": "5e4646d6", + "id": "52600837", "metadata": { "editable": true }, @@ -152,7 +152,7 @@ }, { "cell_type": "markdown", - "id": "9a829df6", + "id": "df1d6c72", "metadata": { "editable": true }, @@ -182,7 +182,7 @@ }, { "cell_type": "markdown", - "id": "3e53ba7c", + "id": "dc7cac96", "metadata": { "editable": true }, @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "09e08f91", + "id": "04e87f6b", "metadata": { "editable": true }, @@ -252,7 +252,7 @@ }, { "cell_type": "markdown", - "id": "7c8a5acf", + "id": "929941f5", "metadata": { "editable": true }, @@ -281,7 +281,7 @@ }, { "cell_type": "markdown", - "id": "12071d8a", + "id": "ed9841e7", "metadata": { "editable": true }, @@ -303,7 +303,7 @@ }, { "cell_type": "markdown", - "id": "c1faf1e4", + "id": "4830435d", "metadata": { "editable": true }, @@ -332,7 +332,7 @@ }, { "cell_type": "markdown", - "id": "39016bcb", + "id": "36474e75", "metadata": { "editable": true }, @@ -349,7 +349,7 @@ }, { "cell_type": "markdown", - "id": "945544d3", + "id": "f103c962", "metadata": { "editable": true }, @@ -369,7 +369,7 @@ }, { "cell_type": "markdown", - "id": "48a2b80c", + "id": "f02729ce", "metadata": { "editable": true }, @@ -381,7 +381,7 @@ }, { "cell_type": "markdown", - "id": "cfd14636", + "id": "06532fa8", "metadata": { "editable": true }, @@ -393,7 +393,7 @@ }, { "cell_type": "markdown", - "id": "66afa266", + "id": "8c39c4cf", "metadata": { "editable": true }, @@ -405,7 +405,7 @@ }, { "cell_type": "markdown", - "id": "96f87f9a", + "id": "09f8b99c", "metadata": { "editable": true }, @@ -415,7 +415,7 @@ }, { "cell_type": "markdown", - "id": "f070283e", + "id": "ca999e60", "metadata": { "editable": true }, @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "9d3db171", + "id": "59cf79b2", "metadata": { "editable": true }, @@ -439,7 +439,7 @@ }, { "cell_type": "markdown", - "id": "33f6af14", + "id": "d12c26ff", "metadata": { "editable": true }, @@ -454,7 +454,7 @@ }, { "cell_type": "markdown", - "id": "02a99cff", + "id": "ca17291c", "metadata": { "editable": true }, @@ -466,7 +466,7 @@ }, { "cell_type": "markdown", - "id": "2c6a4e0c", + "id": "a58c56d5", "metadata": { "editable": true }, @@ -476,7 +476,7 @@ }, { "cell_type": "markdown", - "id": "08df12bf", + "id": "aed190d3", "metadata": { "editable": true }, @@ -488,7 +488,7 @@ }, { "cell_type": "markdown", - "id": "2d082fe8", + "id": "8845e923", "metadata": { "editable": true }, @@ -498,7 +498,7 @@ }, { "cell_type": "markdown", - "id": "19f66253", + "id": "f1499a4a", "metadata": { "editable": true }, @@ -510,7 +510,7 @@ }, { "cell_type": "markdown", - "id": "06e842d7", + "id": "cba9bbaf", "metadata": { "editable": true }, @@ -523,7 +523,7 @@ }, { "cell_type": "markdown", - "id": "60a4a134", + "id": "5aa1c718", "metadata": { "editable": true }, @@ -542,7 +542,7 @@ }, { "cell_type": "markdown", - "id": "17cb3b7c", + "id": "5123c6a7", "metadata": { "editable": true }, @@ -554,7 +554,7 @@ }, { "cell_type": "markdown", - "id": "5c318d22", + "id": "65073f67", "metadata": { "editable": true }, @@ -566,7 +566,7 @@ }, { "cell_type": "markdown", - "id": "35ec45df", + "id": "f28c326d", "metadata": { "editable": true }, @@ -576,7 +576,7 @@ }, { "cell_type": "markdown", - "id": "2b9c44d7", + "id": "94999d37", "metadata": { "editable": true }, @@ -588,7 +588,7 @@ }, { "cell_type": "markdown", - "id": "70a7d1dc", + "id": "3075e47e", "metadata": { "editable": true }, @@ -598,7 +598,7 @@ }, { "cell_type": "markdown", - "id": "a29e240c", + "id": "2aa3debf", "metadata": { "editable": true }, @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "bf4a8589", + "id": "4caa7831", "metadata": { "editable": true }, @@ -630,7 +630,7 @@ }, { "cell_type": "markdown", - "id": "325858c8", + "id": "06f850ab", "metadata": { "editable": true }, @@ -641,7 +641,7 @@ }, { "cell_type": "markdown", - "id": "dad45e98", + "id": "255aafbb", "metadata": { "editable": true }, @@ -659,7 +659,7 @@ }, { "cell_type": "markdown", - "id": "633095c0", + "id": "3044a689", "metadata": { "editable": true }, @@ -673,7 +673,7 @@ }, { "cell_type": "markdown", - "id": "0499b303", + "id": "178b17ce", "metadata": { "editable": true }, @@ -687,7 +687,7 @@ }, { "cell_type": "markdown", - "id": "9f7145ad", + "id": "850e9d3b", "metadata": { "editable": true }, @@ -699,7 +699,7 @@ }, { "cell_type": "markdown", - "id": "c8f1867e", + "id": "ffbcd60b", "metadata": { "editable": true }, @@ -709,7 +709,7 @@ }, { "cell_type": "markdown", - "id": "c86dd048", + "id": "4bf03246", "metadata": { "editable": true }, @@ -721,7 +721,7 @@ }, { "cell_type": "markdown", - "id": "428656bc", + "id": "93e29686", "metadata": { "editable": true }, @@ -731,7 +731,7 @@ }, { "cell_type": "markdown", - "id": "c70e9d1e", + "id": "307c5715", "metadata": { "editable": true }, @@ -743,7 +743,7 @@ }, { "cell_type": "markdown", - "id": "7b9b0f19", + "id": "221ee4d7", "metadata": { "editable": true }, @@ -755,7 +755,7 @@ }, { "cell_type": "markdown", - "id": "ddc85d9b", + "id": "c76cfb13", "metadata": { "editable": true }, @@ -782,7 +782,7 @@ }, { "cell_type": "markdown", - "id": "004f94f5", + "id": "b0887074", "metadata": { "editable": true }, @@ -794,7 +794,7 @@ }, { "cell_type": "markdown", - "id": "ecbfa56d", + "id": "1ac4e0cc", "metadata": { "editable": true }, @@ -804,7 +804,7 @@ }, { "cell_type": "markdown", - "id": "ac1647b2", + "id": "4d7d6a58", "metadata": { "editable": true }, @@ -830,7 +830,7 @@ }, { "cell_type": "markdown", - "id": "d43e606a", + "id": "1f566b66", "metadata": { "editable": true }, @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "8cce1a2a", + "id": "79c5d13d", "metadata": { "editable": true }, @@ -861,7 +861,7 @@ }, { "cell_type": "markdown", - "id": "c44045c5", + "id": "ad7cd27d", "metadata": { "editable": true }, @@ -874,7 +874,7 @@ }, { "cell_type": "markdown", - "id": "59a365da", + "id": "a281e971", "metadata": { "editable": true }, @@ -886,7 +886,7 @@ }, { "cell_type": "markdown", - "id": "34ae8a74", + "id": "c9c48d1f", "metadata": { "editable": true }, @@ -907,7 +907,7 @@ }, { "cell_type": "markdown", - "id": "c67263a9", + "id": "197bbf2c", "metadata": { "editable": true }, @@ -928,7 +928,7 @@ }, { "cell_type": "markdown", - "id": "795378a9", + "id": "36f5a961", "metadata": { "editable": true }, @@ -953,7 +953,7 @@ }, { "cell_type": "markdown", - "id": "65b4ac52", + "id": "8435603c", "metadata": { "editable": true }, @@ -972,7 +972,7 @@ }, { "cell_type": "markdown", - "id": "caf13811", + "id": "acbb9c32", "metadata": { "editable": true }, @@ -983,7 +983,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "f8a921f2", + "id": "9c489f64", "metadata": { "collapsed": false, "editable": true @@ -1036,7 +1036,7 @@ }, { "cell_type": "markdown", - "id": "642845d2", + "id": "eb5ef469", "metadata": { "editable": true }, @@ -1047,7 +1047,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "615d9546", + "id": "0b887229", "metadata": { "collapsed": false, "editable": true @@ -1080,7 +1080,7 @@ }, { "cell_type": "markdown", - "id": "878a352e", + "id": "469f5d63", "metadata": { "editable": true }, @@ -1091,7 +1091,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "05878dc8", + "id": "71260f77", "metadata": { "collapsed": false, "editable": true @@ -1128,7 +1128,7 @@ }, { "cell_type": "markdown", - "id": "538e069f", + "id": "ca362756", "metadata": { "editable": true }, @@ -1139,7 +1139,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "4c91e0c7", + "id": "6b40bb7e", "metadata": { "collapsed": false, "editable": true @@ -1166,7 +1166,7 @@ }, { "cell_type": "markdown", - "id": "4708fdf8", + "id": "d1b6d608", "metadata": { "editable": true }, @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "dc871d8f", + "id": "5932ad38", "metadata": { "collapsed": false, "editable": true @@ -1218,7 +1218,7 @@ }, { "cell_type": "markdown", - "id": "4cc87ad5", + "id": "3a4c3443", "metadata": { "editable": true }, @@ -1234,7 +1234,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "6a075034", + "id": "97da0d0d", "metadata": { "collapsed": false, "editable": true @@ -1255,7 +1255,7 @@ }, { "cell_type": "markdown", - "id": "b48d3436", + "id": "8bf7aa7d", "metadata": { "editable": true }, @@ -1268,7 +1268,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "82256673", + "id": "c534f0c4", "metadata": { "collapsed": false, "editable": true @@ -1292,7 +1292,7 @@ }, { "cell_type": "markdown", - "id": "2de5f864", + "id": "02e8c931", "metadata": { "editable": true }, @@ -1307,7 +1307,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "34cd91dc", + "id": "4c9fe84a", "metadata": { "collapsed": false, "editable": true @@ -1328,7 +1328,7 @@ }, { "cell_type": "markdown", - "id": "c51270ac", + "id": "d52c1474", "metadata": { "editable": true }, @@ -1338,7 +1338,7 @@ }, { "cell_type": "markdown", - "id": "f7680dfc", + "id": "03873aca", "metadata": { "editable": true }, @@ -1357,7 +1357,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "b923f7c4", + "id": "ea66d800", "metadata": { "collapsed": false, "editable": true @@ -1373,7 +1373,7 @@ }, { "cell_type": "markdown", - "id": "8107d910", + "id": "0d8b6bb4", "metadata": { "editable": true }, @@ -1383,7 +1383,7 @@ }, { "cell_type": "markdown", - "id": "d6436c68", + "id": "f2aaa69f", "metadata": { "editable": true }, @@ -1394,7 +1394,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "6b1d461a", + "id": "b52ca319", "metadata": { "collapsed": false, "editable": true @@ -1410,7 +1410,7 @@ }, { "cell_type": "markdown", - "id": "a9853275", + "id": "933d427a", "metadata": { "editable": true }, @@ -1421,7 +1421,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "3641ff80", + "id": "935e7588", "metadata": { "collapsed": false, "editable": true @@ -1440,7 +1440,7 @@ }, { "cell_type": "markdown", - "id": "4e8bb911", + "id": "03da3848", "metadata": { "editable": true }, @@ -1467,7 +1467,7 @@ }, { "cell_type": "markdown", - "id": "d10dd84c", + "id": "b0716086", "metadata": { "editable": true }, @@ -1479,7 +1479,7 @@ }, { "cell_type": "markdown", - "id": "6791aa19", + "id": "99c49087", "metadata": { "editable": true }, @@ -1490,7 +1490,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "1a9bea34", + "id": "4898244d", "metadata": { "collapsed": false, "editable": true @@ -1557,16 +1557,17 @@ "trainScore = model.evaluate(trainX, trainY, verbose=0)\n", "print(trainScore)\n", "\n", - "index = df.index.values\n", - "plt.plot(index,df)\n", - "plt.plot(index,predicted)\n", - "plt.axvline(df.index[Tp], c=\"r\")\n", + "\n", + "df = pd.DataFrame(x)\n", + "pred = pd.DataFrame(predicted)\n", + "plt.plot(df,c=\"b\")\n", + "plt.plot(pred,c=\"r\")\n", "plt.show()" ] }, { "cell_type": "markdown", - "id": "7e222e09", + "id": "2829f486", "metadata": { "editable": true }, @@ -1582,7 +1583,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "fa1b4b28", + "id": "23baff06", "metadata": { "collapsed": false, "editable": true @@ -1621,7 +1622,7 @@ }, { "cell_type": "markdown", - "id": "c6237960", + "id": "1b32a005", "metadata": { "editable": true }, @@ -1631,23 +1632,23 @@ "The way the recurrent neural networks are trained in this program\n", "differs from how machine learning algorithms are usually trained.\n", "Typically a machine learning algorithm is trained by learning the\n", - "relationship between the x data and the y data. In this program, the\n", + "relationship between the $x$ data and the $y$ data. In this program, the\n", "recurrent neural network will be trained to recognize the relationship\n", - "in a sequence of y values. This is type of data formatting is\n", - "typically used time series forcasting, but it can also be used in any\n", + "in a sequence of $y$ values. This is type of data formatting is\n", + "typically used for time series forecasting, but it can also be used in any\n", "extrapolation (time series forecasting is just a specific type of\n", "extrapolation along the time axis). This method of data formatting\n", - "does not use the x data and assumes that the y data are evenly spaced.\n", + "does not use the $x$ data and assumes that the $y$ data are evenly spaced.\n", "\n", "For a standard machine learning algorithm, the training data has the\n", - "form of (x,y) so the machine learning algorithm learns to assiciate a\n", - "y value with a given x value. This is useful when the test data has x\n", + "form of $(x,y)$ so the machine learning algorithm learns to associate a\n", + "$y$ value with a given $x$ value. This is useful when the test data has $x$\n", "values within the same range as the training data. However, for this\n", "application, the x values of the test data are outside of the x values\n", "of the training data and the traditional method of training a machine\n", "learning algorithm does not work as well. For this reason, the\n", "recurrent neural network is trained on sequences of y values of the\n", - "form ((y1, y2), y3), so that the network is concerned with learning\n", + "form $((y1, y2), y3)$, so that the network is concerned with learning\n", "the pattern of the y data and not the relation between the x and y\n", "data. As long as the pattern of y data outside of the training region\n", "stays relatively stable compared to what was inside the training\n", @@ -1665,7 +1666,7 @@ { "cell_type": "code", "execution_count": 14, - "id": "777176d4", + "id": "815087a3", "metadata": { "collapsed": false, "editable": true @@ -1748,7 +1749,7 @@ }, { "cell_type": "markdown", - "id": "e5b3cd18", + "id": "0f248200", "metadata": { "editable": true }, @@ -1759,7 +1760,7 @@ { "cell_type": "code", "execution_count": 15, - "id": "8bd0ef49", + "id": "2ff698a1", "metadata": { "collapsed": false, "editable": true @@ -1861,7 +1862,7 @@ }, { "cell_type": "markdown", - "id": "ca50ecee", + "id": "f745c9eb", "metadata": { "editable": true }, @@ -1883,7 +1884,7 @@ { "cell_type": "code", "execution_count": 16, - "id": "0f56a065", + "id": "b2464d8e", "metadata": { "collapsed": false, "editable": true @@ -1980,7 +1981,7 @@ }, { "cell_type": "markdown", - "id": "231486ad", + "id": "950bc163", "metadata": { "editable": true }, @@ -2006,7 +2007,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "346c01ec", + "id": "0c41fb42", "metadata": { "collapsed": false, "editable": true @@ -2207,7 +2208,7 @@ }, { "cell_type": "markdown", - "id": "1e855715", + "id": "2088e26d", "metadata": { "editable": true }, @@ -2231,7 +2232,7 @@ }, { "cell_type": "markdown", - "id": "74c691f8", + "id": "ce21c422", "metadata": { "editable": true }, @@ -2251,7 +2252,7 @@ }, { "cell_type": "markdown", - "id": "20b0f4e4", + "id": "14ba0435", "metadata": { "editable": true }, @@ -2269,7 +2270,7 @@ }, { "cell_type": "markdown", - "id": "60295fd3", + "id": "9359ee17", "metadata": { "editable": true }, @@ -2284,7 +2285,7 @@ }, { "cell_type": "markdown", - "id": "06f276d9", + "id": "056aade8", "metadata": { "editable": true }, @@ -2302,7 +2303,7 @@ }, { "cell_type": "markdown", - "id": "ac42c4db", + "id": "54e238a3", "metadata": { "editable": true }, @@ -2315,7 +2316,7 @@ }, { "cell_type": "markdown", - "id": "04c1b0fe", + "id": "0a67f20d", "metadata": { "editable": true }, @@ -2333,7 +2334,7 @@ }, { "cell_type": "markdown", - "id": "91abaad4", + "id": "9a944e06", "metadata": { "editable": true }, @@ -2344,7 +2345,7 @@ }, { "cell_type": "markdown", - "id": "18714b71", + "id": "d0bc68db", "metadata": { "editable": true }, @@ -2362,7 +2363,7 @@ }, { "cell_type": "markdown", - "id": "6b83109a", + "id": "89f93ab0", "metadata": { "editable": true }, @@ -2389,7 +2390,7 @@ }, { "cell_type": "markdown", - "id": "f4623825", + "id": "8dd6eb78", "metadata": { "editable": true }, @@ -2401,7 +2402,7 @@ }, { "cell_type": "markdown", - "id": "97e20104", + "id": "b459ce4f", "metadata": { "editable": true }, @@ -2420,7 +2421,7 @@ }, { "cell_type": "markdown", - "id": "a11dc809", + "id": "d11f3e23", "metadata": { "editable": true }, @@ -2430,7 +2431,7 @@ }, { "cell_type": "markdown", - "id": "4e1c6fc8", + "id": "647e4631", "metadata": { "editable": true }, @@ -2450,7 +2451,7 @@ }, { "cell_type": "markdown", - "id": "6f811ebb", + "id": "1a161dc2", "metadata": { "editable": true }, @@ -2462,7 +2463,7 @@ }, { "cell_type": "markdown", - "id": "609dbebf", + "id": "46db414f", "metadata": { "editable": true }, @@ -2480,7 +2481,7 @@ }, { "cell_type": "markdown", - "id": "b8e9dc97", + "id": "0e1bd4d2", "metadata": { "editable": true }, @@ -2492,7 +2493,7 @@ }, { "cell_type": "markdown", - "id": "50adaf2b", + "id": "4488b9c5", "metadata": { "editable": true }, @@ -2513,7 +2514,7 @@ }, { "cell_type": "markdown", - "id": "f7f89a95", + "id": "6c7b3ea3", "metadata": { "editable": true }, @@ -2530,7 +2531,7 @@ { "cell_type": "code", "execution_count": 18, - "id": "e9dae945", + "id": "844a2f34", "metadata": { "collapsed": false, "editable": true @@ -2548,7 +2549,7 @@ }, { "cell_type": "markdown", - "id": "8469c1ae", + "id": "f999ed2a", "metadata": { "editable": true }, @@ -2559,7 +2560,7 @@ { "cell_type": "code", "execution_count": 19, - "id": "4f06f394", + "id": "1de68c0c", "metadata": { "collapsed": false, "editable": true @@ -2585,7 +2586,7 @@ }, { "cell_type": "markdown", - "id": "9c5cd3cf", + "id": "f4e25799", "metadata": { "editable": true }, @@ -2598,7 +2599,7 @@ { "cell_type": "code", "execution_count": 20, - "id": "db7ee861", + "id": "d8a97605", "metadata": { "collapsed": false, "editable": true @@ -2611,7 +2612,7 @@ }, { "cell_type": "markdown", - "id": "290ed024", + "id": "90284486", "metadata": { "editable": true }, @@ -2630,7 +2631,7 @@ { "cell_type": "code", "execution_count": 21, - "id": "86f144d3", + "id": "288b7876", "metadata": { "collapsed": false, "editable": true @@ -2698,7 +2699,7 @@ }, { "cell_type": "markdown", - "id": "8bf7ab88", + "id": "6f46d25e", "metadata": { "editable": true }, @@ -2711,7 +2712,7 @@ { "cell_type": "code", "execution_count": 22, - "id": "ee8291f7", + "id": "37b3054d", "metadata": { "collapsed": false, "editable": true @@ -2751,7 +2752,7 @@ }, { "cell_type": "markdown", - "id": "fffb3d71", + "id": "551d62e0", "metadata": { "editable": true }, @@ -2763,7 +2764,7 @@ { "cell_type": "code", "execution_count": 23, - "id": "a78aeff3", + "id": "b2514895", "metadata": { "collapsed": false, "editable": true @@ -2777,7 +2778,7 @@ { "cell_type": "code", "execution_count": 24, - "id": "b6841971", + "id": "65242556", "metadata": { "collapsed": false, "editable": true @@ -2790,7 +2791,7 @@ }, { "cell_type": "markdown", - "id": "7a0e935e", + "id": "c264a585", "metadata": { "editable": true }, @@ -2801,7 +2802,7 @@ { "cell_type": "code", "execution_count": 25, - "id": "4d955ef1", + "id": "bcd6d1d5", "metadata": { "collapsed": false, "editable": true @@ -2815,7 +2816,7 @@ }, { "cell_type": "markdown", - "id": "1f02c4d5", + "id": "cfcb27cc", "metadata": { "editable": true }, @@ -2830,7 +2831,7 @@ { "cell_type": "code", "execution_count": 26, - "id": "4f2c7e3b", + "id": "81a0d347", "metadata": { "collapsed": false, "editable": true @@ -2846,7 +2847,7 @@ { "cell_type": "code", "execution_count": 27, - "id": "3e283626", + "id": "55e5c0a6", "metadata": { "collapsed": false, "editable": true @@ -2863,7 +2864,7 @@ }, { "cell_type": "markdown", - "id": "f24a66e8", + "id": "0488b19f", "metadata": { "editable": true }, @@ -2875,7 +2876,7 @@ { "cell_type": "code", "execution_count": 28, - "id": "fe431bbc", + "id": "9b4e0734", "metadata": { "collapsed": false, "editable": true @@ -2889,7 +2890,7 @@ }, { "cell_type": "markdown", - "id": "08bedbc8", + "id": "e7a01f04", "metadata": { "editable": true }, @@ -2905,7 +2906,7 @@ { "cell_type": "code", "execution_count": 29, - "id": "dcbbfe02", + "id": "faa0f98f", "metadata": { "collapsed": false, "editable": true @@ -2939,7 +2940,7 @@ }, { "cell_type": "markdown", - "id": "642f178c", + "id": "6b1854b0", "metadata": { "editable": true }, @@ -2952,7 +2953,7 @@ { "cell_type": "code", "execution_count": 30, - "id": "8eb8f078", + "id": "b9a84b77", "metadata": { "collapsed": false, "editable": true @@ -2977,7 +2978,7 @@ }, { "cell_type": "markdown", - "id": "185100ba", + "id": "8b996be3", "metadata": { "editable": true }, @@ -2991,7 +2992,7 @@ { "cell_type": "code", "execution_count": 31, - "id": "6a256e74", + "id": "c5047657", "metadata": { "collapsed": false, "editable": true @@ -3009,7 +3010,7 @@ }, { "cell_type": "markdown", - "id": "bd97b51d", + "id": "5ab3e5e0", "metadata": { "editable": true }, @@ -3020,7 +3021,7 @@ { "cell_type": "code", "execution_count": 32, - "id": "42ddd910", + "id": "48d4afd1", "metadata": { "collapsed": false, "editable": true @@ -3060,7 +3061,7 @@ }, { "cell_type": "markdown", - "id": "cab3288a", + "id": "0caa2763", "metadata": { "editable": true }, @@ -3072,7 +3073,7 @@ { "cell_type": "code", "execution_count": 33, - "id": "e3e4e46b", + "id": "b0e73261", "metadata": { "collapsed": false, "editable": true @@ -3084,7 +3085,7 @@ }, { "cell_type": "markdown", - "id": "fa628eb4", + "id": "95eca1ec", "metadata": { "editable": true }, @@ -3098,7 +3099,7 @@ { "cell_type": "code", "execution_count": 34, - "id": "a29d7a36", + "id": "30cbdd71", "metadata": { "collapsed": false, "editable": true @@ -3115,7 +3116,7 @@ }, { "cell_type": "markdown", - "id": "c97bb950", + "id": "b72caa6a", "metadata": { "editable": true }, @@ -3129,7 +3130,7 @@ { "cell_type": "code", "execution_count": 35, - "id": "75c02c4f", + "id": "f1ecd7ef", "metadata": { "collapsed": false, "editable": true @@ -3146,7 +3147,7 @@ }, { "cell_type": "markdown", - "id": "7002de8e", + "id": "99f348cf", "metadata": { "editable": true }, @@ -3162,7 +3163,7 @@ { "cell_type": "code", "execution_count": 36, - "id": "7fafeb29", + "id": "1596f7d8", "metadata": { "collapsed": false, "editable": true @@ -3190,7 +3191,7 @@ { "cell_type": "code", "execution_count": 37, - "id": "965eee54", + "id": "c271a2ed", "metadata": { "collapsed": false, "editable": true @@ -3213,7 +3214,7 @@ { "cell_type": "code", "execution_count": 38, - "id": "08a29dab", + "id": "ed9d5fdd", "metadata": { "collapsed": false, "editable": true @@ -3226,7 +3227,7 @@ }, { "cell_type": "markdown", - "id": "889fcecb", + "id": "e602d023", "metadata": { "editable": true }, @@ -3242,7 +3243,7 @@ { "cell_type": "code", "execution_count": 39, - "id": "437bc288", + "id": "0dad14ee", "metadata": { "collapsed": false, "editable": true @@ -3269,7 +3270,7 @@ }, { "cell_type": "markdown", - "id": "ccbd2be7", + "id": "eb90f46b", "metadata": { "editable": true }, @@ -3284,7 +3285,7 @@ { "cell_type": "code", "execution_count": 40, - "id": "61d645f2", + "id": "c7f1007b", "metadata": { "collapsed": false, "editable": true @@ -3300,7 +3301,7 @@ }, { "cell_type": "markdown", - "id": "e098db36", + "id": "f51dd218", "metadata": { "editable": true }, @@ -3311,7 +3312,7 @@ }, { "cell_type": "markdown", - "id": "94429655", + "id": "4646c9d7", "metadata": { "editable": true }, @@ -3329,7 +3330,7 @@ { "cell_type": "code", "execution_count": 41, - "id": "2af9e60d", + "id": "d7d4467e", "metadata": { "collapsed": false, "editable": true @@ -3347,7 +3348,7 @@ }, { "cell_type": "markdown", - "id": "26be8697", + "id": "b95c647c", "metadata": { "editable": true }, @@ -3358,7 +3359,7 @@ { "cell_type": "code", "execution_count": 42, - "id": "b6534afb", + "id": "50648dfb", "metadata": { "collapsed": false, "editable": true diff --git a/doc/src/week43/week43.do.txt b/doc/src/week43/week43.do.txt index 1d68fa871..61669cac7 100644 --- a/doc/src/week43/week43.do.txt +++ b/doc/src/week43/week43.do.txt @@ -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