Learn Neural Network Using Keras & Python from Scratch | Sobhan N. | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Learn Neural Network Using Keras & Python from Scratch

teacher avatar Sobhan N., AI Developer | Electrical Engineer (PhD)

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

22 Lessons (2h)
    • 1. Introduction to Course

      2:10
    • 2. Recurrent neural networks and LSTMs theory

      6:26
    • 3. Predict Google stock price using LSTMs - Part1

      5:10
    • 4. Predict Google stock price using LSTMs - Part2

      5:20
    • 5. Predict Google stock price using LSTMs - Part3

      6:30
    • 6. Predict Google stock price using LSTMs - Part4

      6:00
    • 7. Predict Google stock price using LSTMs - Part5

      5:53
    • 8. Forecast NASDAQ Index using LSTMs and Keras library - Part1

      7:09
    • 9. Forecast NASDAQ Index using LSTMs and Keras library - Part2

      3:46
    • 10. Forecast NASDAQ Index using LSTMs and Keras library - Part3

      4:23
    • 11. Forecast NASDAQ Index using LSTMs and Keras library - Part4

      5:32
    • 12. Forecast NASDAQ Index using LSTMs and Keras library - Part5

      6:03
    • 13. Predict New York annual temperature using LSTMs - Part 1

      6:10
    • 14. Predict New York annual temperature using LSTMs - Part 2

      6:03
    • 15. Predict New York annual temperature using LSTMs - Part 3

      5:14
    • 16. Predict New York annual temperature using LSTMs - Part 4

      6:03
    • 17. Predict New York annual temperature using LSTMs - Part 5

      6:29
    • 18. Forecast New York wind speed using LSTMs and Keras library - Part 1

      4:37
    • 19. Forecast New York wind speed using LSTMs and Keras library - Part 2

      4:53
    • 20. Forecast New York wind speed using LSTMs and Keras library - Part 3

      5:10
    • 21. Forecast New York wind speed using LSTMs and Keras library - Part 4

      4:56
    • 22. Forecast New York wind speed using LSTMs and Keras library - Part 5

      7:02
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

112

Students

--

Projects

About This Class

Do you like to learn how to forecast economic time series like stock price or indexes with high accuracy?

Do you like to know how to predict weather data like temperature and wind speed with a few lines of codes?

If you say Yes so read more ...

Artificial neural networks (ANNs) or connectionist systems are computing systems vaguely inspired by the biological neural networks that constitute animal brains. Such systems "learn" to perform tasks by considering examples, generally without being programmed with any task-specific rules.  

A recurrent neural network (RNN) is a class of artificial neural network where connections between nodes form a directed graph along a sequence. This allows it to exhibit temporal dynamic behavior for a time sequence. Unlike feedforward neural networks, RNNs can use their internal state (memory) to process sequences of inputs.

In this course you learn how to build RNN and LSTM network in python and keras environment. I start with basic examples and move forward to more difficult examples.

In the 1st section you'll learn how to use python and Keras to forecast google stock price .  

In the 2nd section you'll know how to use python and Keras to predict NASDAQ Index precisely.

In the 3rd section you'll learn how to use python and Keras to forecast New York temperature with low error. 

In the 4th section you'll know how to use python and Keras to predict New York Wind speed accurately.

All resources files are attached in class project section.

It's time to take Action!

Click the "Take This Course" button at the top right now!

...Don't waste time! Every second of every day is valuable...

I can't wait to see you in the course!

Best Regrads,

Sobhan

Meet Your Teacher

Teacher Profile Image

Sobhan N.

AI Developer | Electrical Engineer (PhD)

Teacher

My passion is teaching people through online courses. I love learning new skills, and since 2015 have been teaching people like you everything. I create courses that teach you how to become the better version of yourself with all kinds of skills.  

What would you like to learn?  

Would you like to learn Artificial Intelligence in python?  

Would you like to make money creating landing pages?  

Would you like to build your own AI programs & do something awesome for you?  

Would you like to learn Xamarin to make both iOS/Android apps?  

Would you like to learn how to write codes in HTML5 and CSS3?  

Would you like to learn MATLAB the sci... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction to Course: in this course you learned recurrent neural network or in in an LSD, and by using cross library and python, you learn how to forecast weather data sets by a list em to fork as temperature and win the spit. Next you go further. You will learn how to forecast Time series model by using LSD and neural network in cross environments. In this course, you can forecast output off different data sets using LSD in networks and cursed library. You can use cross power to forecast Google s stock price with high accuracy. You can also see that effect of training airports on the total error a list em neural network. Then you will learn how to use cross an LSD, um, network to forecast NASDAQ index properly. You can also learn how to use delays to forecast it better. Do you like to forecast temperature? If you say yes, you can use for us for new your temperature for casting. Next. I want to show you how LSD M can predict noisy data like vine. The speed in this part of the village was win the Speed three A's to forecast it more accurate city in every lecture you will get Python source called completely and details any restoration. You can also download data sits in CS reformat. I do my best to update the course regularly and consider that you have a 30 day money back guarantee you can see free purview if I want to explore farther. Finally start your journey toe artificial intelligence world I can very to see you so purse and robots. 2. Recurrent neural networks and LSTMs theory: Hello, everyone. In this lecture, I got to show you basic Torrey behind Recurrent neural network or ordinance a recurrent neural netware, or or in in is a classified artificial neural network were connections between notes from a directed graph along a seconds. These allows it to accept temporal dynamic behaviour for a time sequence on like feed forward neural networks or in, and can use their internal S Sterritt or memory to process sequences of inputs. This makes them applicator bit. Two tasks, such as on segmented connected handwriting recognition or a speech recognition. The term recurrent neural network is used to refer to two browed classes off networks. It is similar general s structure, where one is finding impulse and the other is infinite impulse. Both classes of networks exhibit temporal dynamic behaviour. A final impasse Recurring Network is a directed cycle graph that can be enrolled and replaced with a strictly feet forward neural network. While an infinite impulse recurrent metric is a directed cycle graft that cannot be unrolled. Both finance impulse an infinite impulse. Recurrent networks can have additional estate, estate and storage can be on retired control by the new role in its virtue this storage can also be replaced by another network or graph if that incorporates time delays or has a feedback loops. Such control estates are referred to as a gated estate or gated memory and are part of long short train memories or LS teams and gated recurrence units. Well, it's Tim Long short term memory or LSD. Units are units are Recurrence Neural Network or in its AN or inal Compost off LS Team units is often called an L esteem network. A common LS team unit is composed of a sale. An input gate on Outward Gate on a forget get the cell remembers values over arbitrary times into role, and the three gates regulate the flu off information into and out off the salt ls dim. Networks are well suited to classify processing and making and making predictions based on times raised data. Since there can be lags off on a duration between important event. In its hypes raise, LS teams were developed to deal with exploding and vanishing Gradin. Problems can be encountered when training traditional ordinance Here, you can see the inside of L S T. M's para meters X'd represents input vector to the LST Munitz FT. Represents Forget gates. Activation. Victor, I t input gates. Activation victor or tea is outward gates Activation Victor HD in city are outward vector of L s team units and sell estate better then and Sigma and 10 a.m. h is signaling activation function on the hyperbolic tangent activation function. You can see the diagram off sigmoid activation for kitchen and hyperbolic tension activation function. Here we used this function in our coding lecture so estate into the next lectures. Then if you find out it off each layer, you have the following equations for FBI, T, Audie City and Esteem. I don't care about the equations and definition off these perimeters, but the most important things here are W we want to trained our recurrent neural network, or else Team neural network to find bed optimum w to minimize ls team's total error on a set of training sequences it rated bread indecent such as back propagation through time can be used to change each weight or w in proportion to directive off the earth. With respect to it, L s team can also being trained by a combination of artificial evolution for rates to the hidden units and pseudo inverse or suffered better machin for ways to the output units Application off. Ls Tim Neural Network. These type of neural network has a lot of applications, but here I mentioned six of them. You can use these type off neural network for robot control. Time service prediction s peaked. Recognition, music, composition and hand rating and human action recognition. All right. Now, the land basic story behind recurrent neural networks and Ellis Tim. Now we are going to write some python code with cross library, so stay tuned. And don't worry, because python do everything for us. 3. Predict Google stock price using LSTMs - Part1: Hello, everyone. In this lecture, we want to forecast Google s stock price and we will using Ellis them a recurrent neural network for these proposed And I have done load I have done with it. Ah, data set of and Google s stock price. You can download it for on course materials and we want to use it as our data set. And we want to forecast the price off Google s stock, so create a new blank python foil and import following libraries. So, first of all, imports no fight as an teen than import pound us library as Q. Did you? And we need some applaud library to visualize out outsports. So a lot import matter a lot. Lead Piper lots as a PLT. Then we need to import some cross the libraries. So from Caro's, uh, models imports sequin show, said Quinn. So it must be a capital s. And then, from across layers, import Dennis from Keira start layers, imports dance layer and finally, from Kara is that layer A games imports. L s see him functions. Then we need some metrics toe measure our accuracy. So from cross imports metrics, we will use these metrics in our accuracy catch relations. And, um, because our data are really data, we need to estan dart estan dark eyes, these data, and we must import following libraries from s Kayla. So from SK learn Dodds pre pro. So seeing imports, I mean, Max a scaler. Mean? Max scallop. Capitalises Keller. All right, import our record libraries. Now, if we must input our Google s stock price data sit to our program. So we use pandas Data said as follows. Defining data frame as follows The F equals two PD that read underlie CSP to read Excell FIEs And here import our files RCs fee file. As you see it is G double org dot c s v. So come here and write it video. See this? Okay. We need to measure the length off these status. That's so use this comment toe. Measure the length off our data frame. You can print it and see the length off the status is so and save everything and build your CO to see the length off data set 4. Predict Google stock price using LSTMs - Part2: all right. As you can see, the length of our latest that is 151 lines off data are so they want to use They want to use high, low and chill owes columns to forecast the Google price, the Google s stock price and we input high and low price as a input data on. And we want to forecast close price based on these two columns off data. So first of all, we need toe define and this date off for our program. So I define high columns as follows I m p that's awry on Dhere. Define ah, proper columns. So the f dot i x and here they find it as fathers. I define 30 columns as a high. So you come back here and check it again. And as you can see, 123 on because we started with zero, we must use a two number for this column and for local um, I simply cope. Ian, paste these codes here and change it to three number. And finally, for close price. We need to paste it again. Here on put four here. Okay. We want to visualize these states are so we can pull out these three data Cetus and these three columns of data simultaneously by using following comments. So I define edge for high and, uh, here I use plt dot plot And here I use high data said as follows. So here we want to use first row off these data said so me, you and views. These are a for high and before it we must define pull out that figure one for better pill outnumbering and here defined low. And here again I copia encased thes code here on Dhere I change it too low. And finally for killers, I defy see and paste it again. Here on finally, I used clothes you can define at a legend for your pilots, so define it as follows Plot that legend. And, uh, here we must, uh, used etch l and C for our legend. And here we defined our proper text here so you can define high for EJ and low. Sorry. You must used double quotation and here you can define kilos finally defined plt that show to see the output off these results now builds your codes and they to see the outward all right. As you can see, our output palette that has been created properly. We have three type of data high, low and close. And as you can see, the kill owes. Data is between high and low, and you can see the high vegetable color clothes with green and low vit orange color. All right. Next, we want to create our require data to input them to our 5. Predict Google stock price using LSTMs - Part3: Okay. Next, we need to combine high and low columns into the one input data, or X, and we need toe. Define why? Data said or close price data said as output data. So to do this, we need to define excess follows So X equals m p dot con katyn eight n p dot con okay, Two maids and here the used high and low and here defined access equals 20 to come. Katyn eight these days are based on first anxious. And then we need to print a shape of these data set to see them shape of this later. So appeals your coat. Andi Kilos thes. And as you can see, we have a two by 251 data we need to transport the state are toe make it similar to the status It as you can see here we have a 2200 and 51 columns of data, and here we have a reverse situation. So we need toe comment This and here we need to transpose our data. So, um, define transports, function transposed and transport x as follows on. Then they need to define why, as follows. Why equals two kilos price. So I defined why, as follows and similar to pray views X, we need to transpose it again. So we need to write falling lines off codes. And here transpose vie. All right. After it. Ah, to input the state or to our neural nets for module we need to make these data is Keller or Condor? Does the state does so define a scaler as follow scaler equal to mean like a scholar function? And first, we want to fit this data toe a scaler object so define And here Input X is in this function . And finally, X equals two s Keller the transform oh, picks then do a similar thing for y data. So defined another stellar object and named esque elevon And it calls means to mean much scaler function. And again we use a scholar von that fits. And here use why and why calls to Sorry, It's calorie Wanda transform And here put to buy all right and make our data a scholar And these data are are bit Finn zero and one now, so ah, toe continue with El STM neural nets where we need to do another work and another thing, because neural network, because l esteem neural network input must be three dimension. We need to reshape X into the three dimension awry. So defined it as follows ex echo, or redefine it as follows MPD artery shape. And here define X and ex dot shape zero and one and, um, finally define extort shape. What? This is the line, of course. Make it three dimensional area to input two l s Team Neural Network. Finally, to see the shape of our imports, you can extort shape, kill of these. And as you can see, we have ah, and thes shape of later said, And we want to import these data are to our else team neural net for so 6. Predict Google stock price using LSTMs - Part4: So to create our neural intermodal create model, it calls to sequence shields. And here we use LSD M neural network as a inputs layer. So use model dot at and here use a Lestienne No run networks. So we want to use 100 fully connected unit in the first layer. And we use activation function as follows to be used hyper bullet tangents for at thes activation function on. Um, the most important thing is in poor shape. And he was input. Shape equals two one ends too. As you can see, we have at 251 lines of data with this dimension, and we must input these dimension toe input shape. Then we need to use another activation function for recurrent activation function. So use recurrent underlying activation equals to heart signal it. All right. We created our first layer off a lesson neural network. Then we need to add the outward layer for these neural networks. So model that ad and here we use Onley, Dennis, output a layer, and we use one for dimension off these and they test it so we can briefly discuss about these neural networks. We use high and low price off Google s stock and they want toe forecast the output or close price off a stock. So we need to compile the model. So model that compiles and here we must define a last function. Last function equals two, I mean a square. And we used on optimizer too to compile task for us, optimizer equals two RM s group and finally, to measure the accuracy off model me to defining metrics and metrics equals two mass tricks dot mean absolute error or m e. And, uh then we need to feed our X and Y data into our model so define model that fit and here define X and why. And we must define number of April's here. So I want to define first a boy size because to 100 we can define the bat size for it and because the one and finally we used their bows because to to to see what happened during the feet task. And it's visual visualized for us in the common line. And ah, finally we need to predict our model by using model dot prayer addict and he every used X on they can use their bells across to one. And we kept friends. Is screens sorry for Predict. So build your code and wait to see what happened during the training module. And as we can moving down Uh, I mean, absolute error and loss. I've been decreased. And now we need to use some plot function to visualize our predict and compare it with the rial at data. So creating new plot, object and at predict and why data to it? 7. Predict Google stock price using LSTMs - Part5: So come here. And if I'm plt dot Figure number two And here define rawness Scatter plot for this type of blood and bullet that a scatter. And here they find why and predict for your propose on, uh, toe show this plot function we need to use a plt that show. But before it, we need to see both plots Similar Tanis Lee. So I used a blocked acorns to false here to see both policy multi earnestly and for better time efficiency. I used 15 for airports. And as you can see, after 15 ports, airports, we have not any valuable modification for me in Absolute Aurora and lost. And it is near to numbers in 15 15th 8 points. So I use 15 for a putz and and then we need to define another plot object to see what happened after a prediction so defined third plot as follows and defined test objects. And I, uh, added vie to test object. So plt does plot why and for predict I used predict object for this. Let's so here defined predict. And, um, we can't define some legend object for this on plot, and here are used predicts and test and define require takes for it. So here I different predicted pray, takes it data for eight and finally define a riel data for peace public and finally use plt that show for this plot object. And here again we use block equals two falls to see these three plots objects simultaneously. So here I use black questo faults. So we are ready to run Arco to see what happened after training our model for forecasting Google s stock price. So feels your coat again and they too see what happened. If you have a good accuracy, we must have intense population of later in this line the line of it for 45 degrees off a slow. And if we have a bad accuracy our data scattered in these two friend girls So insurgency, we have a very, very good act. Crazy. And the forecast Google Price Google a stock price based on Onley high and low price. And finally, in the last figure, we can see some really important And let me is room. And these regent, As you can see, the predicted data has been plotted with orange color and re later plotted with blue as we conceive, you have a very, very close predicted data to our really later. And it's it shows at the popover off the L S team Neural net for and it and it is really important for us to I'm pretty a time Serie any type of time stories like temperature, like a stock price like electricity load. Precisely. And this type of neural network let us to do thes. And I hope you learn good things from this lecture. And in the next lecture we want to use and other data said, And I want to show you the power off ls Time Neural Network to forecast the status that So I hope to see you in the next lecture. Thanks for watching. 8. Forecast NASDAQ Index using LSTMs and Keras library - Part1: Hello, everyone. Welcome to this new lecture in this lecture. I want to show you another forecasting problem and in this lecture I use and NASDAQ Data said as a time series data set for forecasting and in this lecture used l esteemed recurrent Neural network. For our forecasting propose, you can access thes status that, in course material similar to previous lecture. And so let's start our coding. So create blank price in code and add a fallen libraries as follows Import non pi as n. P. And they need to import pound us to read our CSE fire on Define it as a PD and we need to you import Matula deep in the pipe a lot import that's plots lead dot high lots has a Pluto . And, um, we need to import some cross libraries as follows. So import cross dot models Sorry from for Charest. Ah, that models import sequin shells import this week one shell and from Caracas Dodds Les errors import dense and from Keros that layers import ls And to measure accuracy off our mother, we need to import some metrics. Then we need to import son useful library from s Kaylan so from SK Learn on, uh, pre processing imports, Max. And we need toe defined train and test parts for our forecasting. So from SK learn again. The model selection imports train test. Espoli trained under line test underlying SPD's. All right, The import Our required libraries too. Our program. Then we must input our data's it into our code. So define a data frame as follows. PT that read underlines CSP and here, Vamos at the NASDAQ that CSP. So yeah, right. Yes. Uh, this is then, uh, we need to measure the length off. The status is so I define l a cause a len off the f and I want to trained these data sets parentis number. So save your coat and build a are called to see the possible outs with Aero Incorrect. Um, okay. As you can see their length off our data's, that is 252 lines of code and we want to use this data to forecast the close price or killers Number of NASDAQ index. So to do this Vinit toe Ah, define outsports. Here we define outward as follows mp dot array. And here we need toe you'll some index off our data frame. And here I use fifth column of this data set. So here I had a four for this column. As you can see, this column is 123 and 45 and we use for number for it. And I want to show you these data in the figure so define our first vigor ous flows. So plt does figure one and plt dot lots. And here use this number. I want to show you the first column off this data set. And I used plz that plot and use pelted out show and build your call to see there NASDAQ Index in the plot object. Okay. As you can see, our NASDAQ index has been plotted in figure one, and we want to forecast it. These states are said by using LSD M neural network. 9. Forecast NASDAQ Index using LSTMs and Keras library - Part2: okay to do this. First of all, we need toe. Define some and delays off these index I want to use ah, free delays off these index as an import. For example, I want to use leaves on these days as in port, to predict the output off our data. So to do this we need to define Exxon x two and X three for these propose. I use ex one as follows. And here I define zero to L minus five and I define X two similar to X one. But I must change in these number and this number. This number must be changed to one. And this number must be changed for and here to and free. And finally we need to change them through two and three. Then you can Ah, con canton eight. These input data to one day, right? So X equals two N. P. Dodds con. Okay. Sorry. Con can needs. It's really long words. So here use Exxon x two and extremely and he aereo's access because 20 and finally similar to previous project we need to transpose x and then I want to show you the X. So be is your code and see what happened. Okay. As you can see there, three delays off NASDAQ index has been created and we want to use these three number to forecast next number or these number, so toe. To do this, we need to create voy object as follows. So I only must use another transplants function to why? And here I Akopian pace at these arguments here and change it to free and l minus two. All right. Next we need to estimate or dies our data, so we must input. There s Keller object neck. 10. Forecast NASDAQ Index using LSTMs and Keras library - Part3: so at s color object to your program. First of all, we need to define a scaler as follows A scaler equals two. I mean, marks a scaler function on. Then we need to feed our data through these objects. So a cellar that feet x as input very bill. And we need to transform eggs into the X s calor data or est under dark data. So X equals was Keller that transform? And here, right x, this three lines convert X values into their arrange off minus 12 plus yvonne number. So we need to do same procedure for why so I co p and paste it here and define another scaler objects Keller von and Feet. Who? Why data sit into it. So here we need to change in these two y and these two a scale alone and these two Why all right after it? Before we train and test our neural network, we need toe do one more thing because off the a less them need toe three dimensional imports. So we must reshape our example into the three dimensional area. So defined eggs as follows or redefine, eat, reshape. And here writes x and we need toe define three dimensional optical array. So I used extent Shape one. So put zero here and then one number and here x dot Shape one. These lines create a three dimensional object for us, and now we are ready to create our model as a mentioned before, we need to define a test on train process for our index forecasting. Mean we want to test our neural network, vit, not trained data. So we need to escalate our data into the train and test data so they find X train and ex test on Dwight train. And why test as follows? I mean, we want to use train test ESP its function as follows. So dysfunction has a three arguments, and 1st 2 arguments are input on out with data. And third argument is his size. We need to use and number for test size. I want to They use a 30% or 25% for tears. Test size and this function experience our data into them. 75 5 75 person for train and 25% for test. Now we are ready to create our model. Similar to perv use creates a second show model as follows. So model because to sequence 11. Forecast NASDAQ Index using LSTMs and Keras library - Part4: to see Quinn Shell. And here we need to define L s t m input layer for our models. So model dot at a list in and here, define 10 for units and we need to define activation function for our model. And I use hyperbolic tangent for it. And, uh, the most important thing for L s team is input input size. And here we have after one by tree input size because we use three delays off NASDAQ index . So after it, uh, we need to define records activation. And here we use heart sigmoid. All right. We define the first layer off LST um, neural network with 10 units and with hyperbole, tangents, activation function and one by three input size. Then we need to at the outwardly a for it. So model that at. And here I use Dennis for the output and we use Onley run out food for our model. And so we have created our neural electric. Then we must compile it. So model that comply. Comment, Lou, this for us on it has a three arguments lost function. It was to I mean a squirt error and we need toe use some party miser for our model. So I use RMS broke for optimizer on to measure accuracy in each iteration off compile and training and test we need to define some metrics and metrics equals two magic start mean absolute error. All right, After it, we need to fit our data into the model. So we use these comments, and here we want to feed train data into our mother. So right extreme on Dwight. Train on, use some people's for our training model and you can use verbals accords to to to see what happened during training process. And after it, we can build our model. So save everything on be into your model to see what happened after it used visualisation plot functions to show you what happened during the training process. And we test our model with ex test and Reuters data. All right, As you can see, we have finished 15 April's on the mean absolute error is 20% 21 persons and the last function is Quiles too. 0.6 So Oh, for seeing what happened. And during test process, we need toe use some plot function toe visualize data for user and assure him or her the accuracy off our model doing test process. So we use Mac politely libraries 12. Forecast NASDAQ Index using LSTMs and Keras library - Part5: so come here on First of all, we need to define predict up pretty data and we want to predict the outward based on ex test and we want to calm pray the predict video fighters to see the error and accuracy between predict and writers. So here input X test for predict function. And after it we create plot objects for out program. So I create second bullet object plt dot figure two and we use a scatter plot for Oh, propose. So here used white test and I predict for this object on for the split objects. And here we use plt dot show function to see our Pillot after it we need to define another plot object. So here define plt that figure three and different test and predict object as follows So test equals two plt that pure plots Sorry VLT dot Plots on dhere we use Why fist on for predict use plt dot Plots of predicts you can use legend but I escaped this for time efficiency and used PLC that show and to see both figure simultaneously used block equals two falls here and used this object copy and paste this object This line of code here. Apparently that show the luck equals 2/4. And now we are ready to build our codes a game. All right. As you can see, we have created the three plots. First part or first figure is NASDAQ Index, and I close these a second. Pallotti's these blood. We compare test data of it, predict data, and if we have a good accuracy, we have a date. We must have a data in these lines. And as you can see, we have a some gap here, here, here, in peaks, in volleys. So to create better accuracy, we can way we can do some some task, for example. Sorry. For example, we can use ah, another number for a pose. For example, I use 15 boys and builds Michael to see what happened for accuracy. All right, As you can see, we have a better accuracy than previews, and we correctly tracked the fluctuation off NASDAQ index in peaks and valleys off this index during test process. And here you can depart. You can see the power off ls team neural network or recurrent neural net. But here we used only 10 units off l STM Andi used only 50 airports and we have Ah, very, very good accuracy here is near to zero. Sorry, we have a very good last function here, and I mean absolute error here. As you can remember, from the perv use, we have to any person for me an absolute hero. And we have on Lee to person for mean absolute error. So this is perv. Use figure on the seas. Recent figure VIHD 15 airports. So in this lecture, you you have learned how to use ls team neural network to forecast NASDAQ Index and you can use some some argument to increase the accuracy, decrease the aero. You can use different number for these A Lestienne units and you can gain a better accuracy by man if relating these argument. 13. Predict New York annual temperature using LSTMs - Part 1: Hello again. Welcome through this lecture. In this lecture, we want to use New York temperature data set in last year from in July after any 17 to these late. So in this lecture, we want to use minimum maximum an average temperature of New York City, and we want to forecast the temperature or average temperature based off these two columns on, uh, let's start. So so do is we need to create a blank Parton file and start to import required library. So important number I as an MP and import find us as PD. You can escape the video to the end of this import process. And I want to teach these lecture completely for a new person that watch it, for example, first time. So I must import everything and I must and teach everything for new person so you can escape it to their end off the import process. So imports Matt a lot. Leave Don Piper lots as a peer t on. We need to import three d object and two D functions from much blood live so from MPs to two kids. Sorry. Mpl underline two kids I m plots treaty in towards excess treaty then import train test s pleat for our scale. Learn that model Underlying selection imports train test under a line escalate. As I said in the first lectures, you need to install these library simply by using Peeping Star. For example, a scaler, for example, Match politely such a and we need to import some cross important library Some from cross import sequin show and from Caracas to Layer Import thence have used this function for article player from cross again darts layers of we need to import LST in use at least for input Layer and Braun Caracas Import minutes Ricks To measure the accuracy during training and test process, we need to used this on from SK. Learn and gain. We need to imports. I mean Max s Keller to ah make our data a scaler and standard then between minus one and possible numbers and from escalating that pre processing import many in max. It's Keller. All right. I want to imports New York City and Temperature Data said So I define it data frame as followed, so defined the F equals two PD or pandas and the called read underlines. Yes, we function and here. We need to keep pores and and why? Dots? Yes. Sorry. This function. Simply grab the envoy that CSE and put it in the data frame. 14. Predict New York annual temperature using LSTMs - Part 2: tough frame to read the average minimum and maximum temperature we need to define some non poi are as follows so define T average as follows on the average equals to need MP dot awry and here, right the F and we want to read 1/5 columns are these Data said, because the average temperature put it there and here I used Sorry, I was for number for it, and I simply check it again. 123456 and seven for a t m Rage or we need to use six number sorry for death after it we need to define t massing are t maximum is a cause to sick columns And I used five here on finally use t mean as follows I pasted a game and changed it to four. You have access to this data sets in course materials, and you can simply download it and use it in your programs to test our program v. Canada Rinty average simply and save everything and build it to see the output. All right, As you can see, we have created average temperature on simply we have printed it in the output common line for better visualization. We can define a treaty Palat object to see what happened for t minimum maximum an average and dependencies between them so defined feet as follows. So I use plt does figure one to create our figure on different through the object as follows a X equals two fiqh dot underlie saw plot And here the only use treaty object for these subplots. And here use three for projection because we want to see at least three data's that in three dimensional Espace. So use a scatter plot for team minimum and maximum. And here, right team Max t mean onboard finally t average. And we want to use some market freed and I select empty circles for it On Finally, we can set some labels for our X y and that access is so used extent set underlying XLE a bill on Dhere right to me I simply coping on and pasty 32 times And here I use a while a bill and here use that label on makes and finally average. To see this plot object, you need to use plz that show and if your codes to see what happened for this bullet all right. As you can see, we have printed the three dimensional. These three dimensional data, based on minimum temperature, maximum an average temperature off New York City. Next we need toe Ah, create the input and output data set for our recurrent neural network, or LST. 15. Predict New York annual temperature using LSTMs - Part 3: but before it I want to show you the average temperature in single dimensional palazzo. Simply We use plt Dodds plots. And here we use Aris Impression. But consider that because this t average is a r a. We need to used this comment to read first lines off these, Eric, so Chelsea dot plot t average on finally plt dart show to see it and it is your cold to see the average temperature. We need to close on this plot first to see the average so close these And as you can see, we have a very, very fluctuations in the temperature. And we want to use the power off recurrent neural letter or else in your illiterate to track these fluctuations. So next we need to create the ex envoy data sets. So we must content in eight. There have minimum and maximum temperature toe one array. So empty dot con can con. It's a very lying word. Con can terminate. All right, on here we need Teoh. Can Canton ate the minimum on and maximum temperature into the one IRA. So I use access because zero to do this. And as you remember from our previous lecture. We must transpose these state off to make it readable for our neural networks. So use empty transposed on and use X here to transport them and for why, or outward layer our outsports data sets we need to use empty the transposed. And here we used average temperature for outfits or it way already to create our neural network Mother. But before it, we must translated. These dates are into some data between minus one and plus one numbers. So we must create the S Keller object as follows, for example, s equals to mean Max s Keller function. And then we need to sc feet on Dhere. We use X for it and finally s c sorry sc dots trance for X it caused to and the most do fainting same procedure or same lines of code For why so simply copy and paste these lines of code and rename it to SP one and SP one that fits into why and here changing toe. Why on here? SC one and what? Okay, As I said before the LSE mural, it for must has a three dimensional import. So before creation of our model, we need to create a three dimensional area for our no run. It's very model so anti that reshape and do this for us. So here, MP, that reshape and we use X on used X here again. Sorry. Extras shape one and one and finally X that shape one. 16. Predict New York annual temperature using LSTMs - Part 4: one. Okay, this line off court created three dimension out input for LST neural network. Do you remember from the first lines off our codes, we use the import greatest SPL, its functions. So and we want to test our model vit test data on the data. That's a model does not trained. So here we Espen, it's our data into the train and test data. Four time efficiency I Akopian pasted from our previews coat. And I want to use 30 person for test size on. And finally we are ready to a curate. Our no were a literate model, so model echoes to sequin show function. So after it, if we must create their input layer for our neural network models So model that at and here used LSD in layer for it. I want to use 10 units 10 LST Munitz here and activation and call slowed hyperbolic tangent on. The important thing for this is includes shape. Then we need to create the output layer for our model. Then we need to create the input layer for our mother. So here, right model dot at and he used l s t m for our propose. We used 10 units. 10 ls Team units for our neural network and here we use hyperbole, Tensions for activation function. Activation equals two. 10 h and the important thing for LS team Net Lauren network is input shape. Input shape equals two one by two one bite because we use only minimum and maximum temperature columns. So we have one guy to input shape. And finally, we must define recurrence, activation and the use hard signal it similar to previous lecture. After it, we must define the outward layer model dot and absolutely every only views only one unit off Dennis Layer. Then we must compile the model to track there outsports our function so you must define plus as follows. I will use mini square error for the last function. It's quit error for last function and we must define optimizer for eight and optimizing cost too are in this group on toe measure the accuracy during the training process. We need to use some metrics and I use metric start a e on he must be put it a securely bracket after it, we must feed our data in no illiterate model. So model that feed on We use only the train data. So ex train on right Oring must be used for the feet process. And we want to do this for 15 times or it was acquires toe sorry for 20 times and I think be so far. See what happened during this process. You can use verbose across to to All right, we are ready to run our models, so save everything and builds your model. 17. Predict New York annual temperature using LSTMs - Part 5: all right. As you can see, we have a 28 points and as we as we moving forward into a pose, we have a very, very good in los. As you see, it is decrease and the same thing happened for mean absolute error. So anyway, to continue to measure the accuracy off our model based on test stater, we need toe do something. So we must predict on output based on ex test. So I used model that predict and input X tests into it. And after it, I want to show you and visualize the outward for you. So I defined the figure object as follows. Plz that figure to we want to a scatter plot the predictive data on real data as follows. So we use a scatter plot for these proposed. So I use why test and predict simply in this plot function compared their test and predicted data. The predictive data is the output off our neural network model, and the test data is a real data. So is simply at the guilty that show object function here and I want to use and other plot object. So plt dot figure three. And here we want to plot the brightest and predict single tennis Lee. So simply define it as follows. So right. I think the really is better for Israel equals two BLT. That plot, uh, why test on reuse predict? And here we used critics and finally to showed them in the Pillot object we use planted that show to see both off these diagrams who used block records. Too false. All right, beads or coat. And they too see plots. All right, as we can see way have a plot that complicate the output off our neural network model and real data. And as I mentioned in pervious lecture, if we have a very, very good accuracy, he must have a data in this line. That line of it, 45 degrees off s lo. And as you can see, we have s scattered data here because we have a moderate accuracy. The mean absolute error is caused 11% and here re compare their really later and predicted data insane plots. As you can realize from these plot, we have a bad accuracy in peaks and valleys. So too better this function. I want to incurs the number of units in input, layer off LSD in and I want to increase thes number into 50. So big zero code again and wait to see what happened for error. And Chris All right, As you can see again, we have a better output compared to previews on we can compare them in the figure or number three I'm anymore. Is it here We have a very, very good tracking and good forecasting in the Peterson Valley. But here we have a bad tracking, but in overall we have it and 3% for mean absolute area. As you remember, from pair of use Vita 10 units and 20 airports, we have an 11 person for me in absolute er enemy. In this lecture, you learned how to use the povero recurrent neural network and LST neural nets for to forecast temperature the average temperature of new your city. And you can use another data set based on your opinion and imagination to predict your desired data set. So tanks were watching and there's things you to the next lecture 18. Forecast New York wind speed using LSTMs and Keras library - Part 1: Hello, everyone. Welcome to this new lecture in this lecture. We want to forecast New York wind eSpeed in this lecture. I use these data said Thies, Xa later said, and you can download it for on course material so similar to pervious lecture. Create blank pie tin foil and they started import libraries that you need. So first of all, I want to import numb pie. So import my boy as a MP. Then we need to import pandas imports as a PD. As I said before, you can escape this part of video and go to the second part. But I had to learn a new B how toe important libraries that he needs. So after it, we need to import Mathebula leap for pillock proposed. So that's a lovely piper. Lots as Peel Team then. And we need to import some caress library. Soberon from care us that models. Sorry that models imports. Sorry. Ah, from care us dots More adults. Him boards sick one shell. Then we need toe import tennis and l esteem layers from Keros IHS tm on from care us that players import Dennis after a tow measure accuracy in the training and test proposals during test part, we need to import some metrics. So from Kira's import made fix on Finally to make the data estan dart, we need toe make them a scaler. So from SK, learn pre processing imports. I mean, Max, this cow All right, we have imported all libraries. There's we need. Then we must define our data frame to our program. So DF ah, as a data frame and we want to read our CS for your excel. If I so I call, read, underline, see SV for this proposals. And here I put the name off my data set. And why don't you dot CS three? As I said before, you have access to these stages that in course materials, and you can simply download it and use it 19. Forecast New York wind speed using LSTMs and Keras library - Part 2: use it free. So we need to define and measured the length off our data frame. So I defined a lot as well. Laying off DS. I want to use three delays off the Vince SPD's as the import and I want to forecast fourth delay ah, by this program and by using recurrent neural network ls team Neural network. So, first of all, for some, for better realization, I want to show you Ah, there Palat off the vendors beat during last year in new or so before it's we need to define the output off our moving the speed. So I define that umpire area as follows. So I want to select four column off our data says so. 1234 So I used 3 4/4 column. Then you can fill out these object this area as follows simply plt dot plots and here use these lines off kowtow. See there windows beat during the last year. So I am save everything by control s and gives your code by Constable be and wait to see there vend Do you have grown all right? As you can see, we have a very, very fluctuation off electrician's data on. As you can see, we have a very possibly a very, very bad oscillation between five and 25 a meter per second. And we want to forecast these noisy data. So to continue, we need to create a three D lays off these data. So I define excellent as follows. So explain accords to these part of why I So I used zero to l minus five and do the same thing for x two and X free. So changed it to two. And here we want to. He was the one and foreign here. We used Teoh three on here. He used three after it. You need to can captain eight thes data into the one X awry for input for post. So I define excess follows so and, um pie con care to blades. And here I put x one, x two and x scream, and we want to cut Katyn it them based on zero access or first access then because, uh, we want toe put this data in our neural nets back. We must transpose them to make them better for feed toe our neural networks. So MPD transpose X create the proper input data set for 20. Forecast New York wind speed using LSTMs and Keras library - Part 3: we need toe transpose. Why? As follows. So simply use these lines off coat on and who they are. Transfer transpose our data on our output data, but way Want to use 123 And we use fourth delay here for why so simply put on this bracket for why on and here, select the data from three to l minus to okay. This line of court create the fourth delay off visa speed for us. And now you're ready to make our data. This Keller and s standardize them into the minus one and plus one by using his color. I mean, Max a scaler comment. So create SC it cause too, I mean, Max scaler function on. Do we need to feet our data into this object SC that fit X And finally, as X equals two Sorry. It's a close to s ee dot France for and here we could x These three lines of court convert our data to the desired values between minus one and plus one and you can feed them into the neural networks simply and you have a better data visualization by using them. We must do the same things for Why? Data set. So create another mean Maxus. Keller objects. And here feet your wide data or asked with data into the S 31 And finally why? Because to s it some transform. Sorry. Transform. Why? All right now we can create our models for neural network. But as you know, from previous lecture, we need to define a tree dimensional rector for input data set in LST neural net for So we must reshape our ex data as follows. So define every shape and he every use x and extent shape on Dhere. We use one number and tech start shape. What? This'll lines on this line of court created three dimensional input for L S D M neural network. And, uh, we want Teoh train and test our model. So we need to define training test data set for our model. So X train on and ex test And why train on why? I noticed they cost too Train underlying tests underlying SP leads um, here way. Want to escalate Xa y on? We must define test size for our proposed. So test size equals two. For example, 20% We used to any person for test size. And here before we continue to the next line of code, we must import this library to our model into our program, so 21. Forecast New York wind speed using LSTMs and Keras library - Part 4: So simply calm Teoh here and copy and paste it from pervious lecture. So from a scaling dot model selection, import train test, ESP elites All right now we are ready to create our model, so model equals two second shelf function and they must create and inputs layer for our model as follows model that at a last year and here we want to use five units of LSD in neural network and we use hyperbolic tangent of hyperbolic tangent function on important thing for us is input shape. And here we have reused at three delays off these data said so I used one by three array. And finally, we must define activation function for recurrent on Dhere. I use heart signal. All right. It is the first layer off our neural network, and we need to define. You can define it hidden layer for your neural network, but because it has a very good part Very good accuracy. It seems single layer and one output layer. We don't use it, but you can define a hidden layer for your mother. So I simply at the dentist Ottawa clear for this model and I use one Dennis layer in the out sport After it, we need to compile no run less for model. So simply write Model compiled. This function has a three argument. We must define a last function toe measure The last function during training process and the use Meanest squared a little for our propose. And here use optimizer. Finally, we must defining metrics for calculating. Sorry, we must define it outside these quotations and we must define metrics for measurement for accurate measurement So defined metrics as follows me used mean absolute error for mass tricks. Now we must fits our train data into the model. So simply write model that feet on Dhere You must define train Ex train on Why train as follows? I must change it Toe. Why capital? Why? For better visualization. All right. Ah then we must at the airports for this function. I want Teoh. It rate this process for 10 times or trained our mother for 10 times and I use verbals because to to see what happened during the training process. Now we are ready to run our model our new role. It'll model and see the accuracy and error off model. So builds your code and way to see the outfit 22. Forecast New York wind speed using LSTMs and Keras library - Part 5: all right. As you can see, way have finished the training process with 10 a pose. But as you realize for a mean, absolute error or if you have, ah, moderates error here I have a 12 person 120.37. So we want to do curious the error so you can define different number for LSD. Um, and different number for April's. So builds your code again to see the accuracy and error off your program. We have, um, one person in We have a 1% decrease in mean absolute error. So because off our data is very noisy and it has a heart fluctuation between five meter per second and 25 per second VI vill, we will not have a same accuracy that we have in the previews lectures. So we can do something. We can increase the units number of a Lestienne. We can increase the e ports, but for time efficiency. I ask you to do this by yourself, and I simply create the predict outwit off our model by input thes function. Our tests data sets to it on. I want to show you the output off our test. Ah Data said so I create new figure I a name it figure number two and I want to compare it with Israel data. So I s scatter plot. Why? Underlying tests on predict dysfunction create and compared plot for us and we can crumpet the test Really laser on predicted data in the one tr grant. And um finally we must create both data said in the single plot and I want to show them simultaneously in the one single plot. So define plot Figure three ends here plt dot plots Why test equals two rial data and we used test data. Sorry. For example predict on dhere plt dot plots I predict and I want to show them simultaneously But before it lets me at her some legend too This object plt that legend across to here I use predict on here, Riel. And if we can define our legend here I write prayer. You're addicted data on here. Really? Data and final right plz don't show to see what happened, Onda And to see this plots simultaneously, right? Blocked up by like equals two falls for it on and for thes god save everything and being your coat. All right as you can see we have Ah, these plots, the input data said, or in this people during the last year, we have these alert that plots predicted data and really later simultaneously and compare them as you remember from pervious lecture. If we have a very good accuracy, he must I have ah later in this line the line with 45 degrees off a slope. And finally, if we look at this plot, we can see the We are not good at picks and valleys off our data. Because off nature of the Venza speed in the our data set, we can correctly attract fluctuations off this data. But for the start point, it's very good. And we have ah, moderate accuracy. We have 18 9% for Akwasi here, and you can make it better by using different number for L S team units and April's. So thanks for watching. And I wish you have learned a lot off things from these lectures