Tensorflow Lite for Flutter Crash Course 2024 - Train and Deploy Machine Learning Models in Flutter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] do you want to train custom linear regression models and build flutter applications using those machine learning models then welcome to this course regression is one of the fundamental techniques in machine learning and it is used when we want to predict a continuous numeric value based upon input data for example if we want to train a machine learning model to predict price of of house based upon features like the area of house and its location then it will be a regression problem because here we are predicting house price which is a continuous numeric value similarly we can train countless prediction models using regression and buil smart mobile applications and some popular applications of regression in real word are Financial forecasting testing automobiles weather analysis and prediction sales and promotion forecasting and so on my name is Muhammad amza assif and I will be your guide for this exciting flutter machine learning course and for the last 5 years I am teaching use of machine learning and AI in mobile applications to over 60,000 students and in this course we are going to explore the powerful word of linear regression models and how you can train and use them to supercharge your flutter applications so we will cover everything from the fundamentals of linear regression to building real word applications using that predictive modeling technique so during this course we are going to train three different linear regression models and build flutter applications so firstly we are going to train a very simple regression model and build flutter application for it and after that we are going to train an advanced regression model to predict fuel efficiency of automobile and then we are going to use that model in flutter for building a beautiful fuel efficiency prediction application and finally we are going to train a house price prediction model and then we are going to use it in flutter for building our house price prediction application so after completing this course you will be able to train Advanced regression models and you will be able to use those regression models in flutter apart from that you will be be able to analyze and use existing regression models in flutter and the best part is you don't need to have any background knowledge of data science and machine learning to start this course we will break down complex Concepts into easy to understand Parts ensuring that you can apply linear regression in your flutter projects confidently so whether you are a beginner flutter developer or even an experienced professional this course has something for you so join me in this journey and together we are going to train and use prediction models inside of flutter applications so now let's look at the course curriculum so we will start this course by looking at the basics of machine learning and its types after that we will learn about deep learning and artificial neural network using which we are going to train our regression models for flutter and after learning the basics of these Concepts we will learn the basic syntax of Python programming language and we are going to Learn Python because later we are going to train our machine learning models in Python after that we will learn about different data science libraries like numai pandas and M plot lab and these libraries will help us to prepare and analyze the data set for model training and after that we will learn about tanor flow and Tor flow life because using taner flow we are going to train our regression models and using tensorflow light we are going to convert those models into a TF light format and use them inside our flutter application and after learning everything which is required we will learn to train a very simple regression model using tensorflow and Python and after that we will convert that model into a tflight format so that we can use it in flutter and finally you will learn to use that regression model in flutter and build Android and iOS application after that we will train our first real world regression model to predict fuel efficiency of automobile and then we are going to use that model in flutter for building a very beautiful fuel efficiency prediction flutter application after that we will train our third regression model and that model is for predicting how house price so we are going to train that model and use it inside flutter for building our house price prediction application so after completing this course you will be able to train your custom regression models and you will be able to use those models in flutter apart from that you can also analyze and use existing regression models in flutter welcome to this lecture in this lecture we will look at the basic introduction of machine learning machine learning is a branch of AI and computer science which focuses on the use of data and algorithm to imitate the way human learn so the basic idea is you supply data to computer and computer finds pattern in that data and then based upon that pattern computer can make predictions so let's understand machine learning with the help of a simple example so suppose that we want to train a a machine learning model to recognize different breeds of dogs like we want to recognize German shefer Afghan hound and pointer so to train a machine learning model which can recognize these three breeds we are going to collect the images of these dogs and this process is called data collection so after collecting few images of German shefer afan hound and pointer we are going to pass these images to our machine learning algorithm and now this algorithm will going to find pattern in these images and we will get our trained model and now in this trained model there is a specific pattern for each breed of dog like there will be a specific pattern for German shefford and there will be specific pattern for Afghan hound and pointer and now when we are going to pass an image to this train model then based upon the pattern which this train model contains it will going to make a prediction that German Shepherd is present in the following image and it is possible because our model knows the pattern for German shefer and our model predicted that because we trained our model on images of German shepher so now when we pass this image to our model our model recognized the breed of that dog and given us the result so that is the process of training a machine learning model similarly let's look at another example so let's say we want to train a machine learning model to predict the salary of a person based upon his experience and certifications so to do that we are firstly going to collect the data set and now the data sets will going to consist of the experience certification and salary of different persons so after getting the data set we are again going to pass it to our machine learning algorithm and now our machine learning algorithm will going to find the pattern and we will get our trained model and now in this trained model there is a specific pattern using which our model can predict the salary of a person given its experience and certification so now when we are going to pass the experience and certification for this person our model will going to make a prediction for the salary so as I mentioned earlier that you supply data to computer and computer find patterns in that data and this process is called machine learning so here we supplied this data and our algorithm found a pattern and now based upon that pattern our train model can do [Music] predictions hello guys Hamza here I just want to let you know that this video is just first few hours of my complete train taner Flite models for flutter course the complete course is about 5 hours long and it includes all source code which we write in this course every section has before and after source code so you can easily code along with me apart from that you will get a certificate upon completion which you can add to your resume and the course comes with a 30 days money back guarantee so if you are not satisfied just ask for a refund so if you are interested I will put a link down below and I am offering a discount to First 100 students so enroll now before it's too late now let's continue to the next lecture so now let's look at the types of machine learning so there are three main types of machine learning supervised machine learning unsupervised machine learning and reinforcement learning and we will cover the basic introduction of all these three but before that we need to look at few machine learning terminologies which will going to help us understand these types better and the first term is data set so as the name suggests data set is a collection of data for training our machine learning model and this data can be in the form of images text audio and so on so as we have seen the example of training a machine learning model for predicting the salary of person based upon his experience and certifications so to train this model we firstly need to collect the data of few persons like we are going to collect the experience certification and salary of a number of people and the process of doing this thing is called data set collection and after collecting that data we split that data into multiple Parts but the main two parts are called training data and testing data so as the name suggest on training data we train our machine learning model and on testing data we test our model after training and as inside this data set we are predicting the salary of a person based upon experience and certification so here our output or predicted value is salary so we also call the column which we are predicting label and the columns using which we predict this label are called features so these are few terms which you need to keep in mind while understanding the types of machine learning so the first term is the label so it is actually the value which we are predicting and then there is a term called features so this is basically the columns or the values using which we are making the prediction so now let's look at the first type of machine learning which is supervised machine learning so in supervised machine learning label data is used to predict a label given some feature so what does that mean so it means that while training a supervised machine learning model we use such data set where we got both features and label like this data set for predicting the salary of a person contain both features and also the label so now in supervised machine learning we are going to pass both of these features and also this label to our machine learning algorithm and now our algorithm will going to find the pattern based upon these input and this output and after that we will get our train model so as the label is also there in this data set so this data set will be called a label data set so hopefully you are getting the point that in supervised machine learning we train machine learning model on questions and also on answers of those questions and then we ask model to give answers of similar questions so in supervis machine learning when we are going to train our model on this data set firstly we are going to divide our data set into these two parts so on training data we are going to train our model and then for test in our model we are going to use this testing data so here we are only going to pass the experience and certifications to the model and our model will going to predict the salary of a person and now let's look at the types of supervised machine learning so there are two main types of supervised machine learning the first one is regression and the second one is classification so as in supervised machine learning we are predicting the label based upon the feature so if our label is continuous then it's called a regression problem and if our label is categorical then it is called a classification problem so as we are predicting the salary of a person based upon his experience and certifications so here the value of salary is continuous because it can be any value so that is called a regression problem on the other hand if we are predicting the gender of a person based upon his high height and weight then we are predicting a categorical value because gender can be either male or female so here this problem will be called classification so in simple words in supervised machine learning if we are predicting a continuous value then we are dealing with the regression problem and if we are predicting a categorical value then it is a classification problem so now let's look at regression so in regression train model is used to predict continuous numeric value so for example if our task is given experience and certification of person predict his salary so here our features are experience and certification of a person and our label is salary and as salary can be any value so it is a regression problem on the other hand in classification our trained model is predicting classes or categorical values so for example given a person height and weight predict their gender which is either male or female so here our features are height and weight and our label is gender so as this gender can be either male or female so it is a categorical column so here our label is categorical value so it's a classification problem so now let's look at unsupervised machine learning so in unsupervised machine learning we use unlabelled data to train our machine learning model so unlike supervised machine learning we don't have a resultant value we just have the input data and we need to find pattern in that data so we give that unlabeled data to our algorithm to train a model and then we ask questions from that model and the example of unsupervised machine learning is clustering so let's look at the detail of clustering so that we can understand that how machine learning models are trained with without the label or without the result so clustering is a method of dividing objects into clusters or groups that are similar between them and are dissimilar to the objects belonging to another cluster so for example finding out which customers made similar product purchases so the Practical example of clustering can be applied on a bakery or on a store so if we got the data about the purchases of the customers then after passing this data to our unsupervised machine learning algorithm we can get useful outputs like here if on a bakery a customer bought these items which are bread milk fruits and wheat and then customer to bought bread milk rice and butter so here based upon our observation we can see if the customer has bought bread then he is most likely to buy milk too and same is the case with thousands of other their products so after getting the data of a lot of customers and passing it to our algorithm we can get to know that which items are bought frequently together and then based upon the results we can position them correctly inside our store so that customer will find these items with ease and he is most likely to buy them and now let's look at the third type of machine learning which is reinforcement learning so it is actually a branch of machine learning that allows an aid driven system or an AI agent to learn through trial and error using feedback from its action so what is the mean of this long statement so it means that inside reinforcement learning our AI model or agent perform few actions and then based upon the result our model or our agent learns that whether that action is right or wrong and the example of reinforcement learning is robotic dogs self-driving cars and so on so for training self-driving cars or even robotic dogs they are being put in an environment where for each action they perform they will either get a reward or a penalty so now by performing a lot of actions and getting the output they learn that by performing which action they will get the reward and they are more likely to perform these actions in future so by that way our model is trained or they learn that which action to perform so reinforcement learning is a short form of trial and error method welcome to this lecture in this lecture we are going to learn about deep learning and artificial neural networks so let's start deep learning is a sub field of machine learning inspired from biological neural networks so it teaches computer to process data in a way that is inspired by human brain so deep learning models can recognize complex patterns in pictures text sounds and other data to produce accurate insights and predictions So based upon this detail we can say that in deep learning machine learning models are trained just like human brain so in deep learning we feed our data to artificial neural network for training and a neural network has layers and each layer contain neurons and using these neurons pattern is extracted from the data and our model is trained so as machine learning is all about pattern finding so in deep learning we extract that pattern using artificial neural networks and now let's see what is a neural network and how we are going to use it so you can see this picture on screen and it is representing a simple structure of neural network so you can see these circles and these lines joining them so here each circle is representing a neuron and a neuron is a basic unit of a neural network and it can receive one or more inputs but it will going to generate a single output value so there you can see this red circle so it is representing a neuron and it will going to take two values as input which will going to come from these two neurons and then it will going to generate or calculate a single value which will be the output and that output will be passed to the next neurons so the output of this neuron will be passed to this neuron and this one but the output value generated here will be same for this neuron and also for this neuron so that's why we say that a neuron receives multiple input and generates single output so inside a neural network the first important thing is this neuron and the second thing is the layer so as we have said that inside a neural network there are layers and inside those layers there are neurons so in this very simple neural network there are three types of layers and the first type is called input layer and it is represented with this blue circles and as the name suggest at this input layer we are going to pass input data to our model for training so let's say we want to train a machine learning model to predict gender of a person based upon his height and weight so in that case we are going to pass the height and weight of person to our neural network at the input layer so this is the first type of layer inside a neural network and after that the second type of layer is called hidden layer and it is represented here with red circles so the layer after the input layer is called hidden layer and the pattern from data is extracted here so as I have repeated multiple times that machine learning is all about pattern finding so in deep learning our ultimate goal is to find pattern in the data on which our model is being trained so the pattern from the data is being extracted at the hidden layer and right now in this hidden layer there are three neurons but it can have any number of neurons and similarly as it's a very simple neural network structure so it contain a single h hidden layer but there can be multiple hidden layers inside a single neural network like here after this hidden layer there can be one more hidden layer and the neurons of this hidden layer will be connected to the neurons of that hidden layer and so on so inside a neural network the pattern is extracted at the hidden layer and there can be multiple hidden layers inside a single neural network and after hidden layer the third type of layer is called output layer and as the name suggests the output from the model is being generated here so as we are predicting the gender of a person based upon his height and weight so after passing the height and weight of person here at the input layer we will get the prediction at the output layer so here if the value for this male neuron will be greater then our prediction will be male and if the value for this female neuron will be greater then our prediction will be female so these are three types of layers inside a neural network and at this point there will be a lot of questions in your mind and hopefully they will be answered till the end of this lecture so now in this example we are predicting the gender of a person based upon his height and weight so here our prediction will be either male or female so it's a classification problem and this neural network is representing the structure for a classification problem and in case of regression our neural network will going to look like this so let's say we are training a model to predict price of house based upon the area and the number of rooms so in that case our output is a continuous value so it will be a regression problem and the neural network for that regression problem will going to look like this and here at the output layer we got a single neuron because our output is not fixed and it can be any value so whatever value generated here will be considered the predicted value of house price so now let's understand the working of neural network with the help of an example so let's say we want to train a model to predict price of house given its area and the number of rooms so to do that we have this data set so there you can see in this data set we got the area and the number of rooms and these are our features and after that we got the house price and that is our output or our label and now to train our deep learning or neural network model on this particular data set we are going to pass each row of our data set to our neural network so for the first row of our data set the house area is 1250 and the number of rooms are four and the actual price of that house is 50,000 so now we are going to pass the area and the number of rooms at the input layer so we are going to pass 1250 for the area and four for number of rooms and after passing the data here at the input layer the next step is calculating the values of neurons in the next layer so let's name these neurons as Z1 Z2 and Z3 and now we need to find the values of neurons in the hidden layer and to calculate these values we are going to use the value of neurons which are connected with them and the weights joining them so as I told you earlier that the lines joining these neurons are called weights so now we have assigned random values to these weights and to calculate the value of neuron in the hidden layer we are going to use the value of neuron in the input layer and this we so firstly we are going to calculate the value of Z1 and it will be calculated using this formula so we are going to take the new neuron which is connected with this Z1 so firstly we are going to take the value of area and then we are going to multiply it with the weight joining these two neurons so you can see the weight value is 0.1 for this particular line so you are going to multiply this 1250 with this 0.1 and there you can see we are doing it and after that you are going to see if any other neuron is connected with this Z1 so we can see this rooms is also connected so so we are going to take the value of room and multiply it with this weight 0.2 so there you can see we are doing this as well and after that we are doing the calculations and finding the value 125.81614610 . 4 and then we multiplied this four with 0.1 and we got the value 5.4 and then we did the same for Z3 so to calculate a value of neuron we are going to use the value of neurons in the previous layer and the weights joining them and now after finding these values for Z1 Z2 and Z3 the next step is finding the value for this green neuron or the neuron of our output layer so let's name this neuron y1 and now to calculate the value for this y1 we are going to use the same procedure so we are going to take the value of neuron connected with this y1 and multiply it with the weight connecting them so firstly we are going to multiply this 125.81614610 0.5 and after calculation we will get the value for this y1 so the value for this y1 is 364 and this is actually the prediction for house price and as we also know the actual price of that house and it is $50,000 so this predicted value is nowhere close to the actual price and the reason is right now we have started to train our model and our model or algorithm knows nothing about the pattern which is there in the data set but when our model training will going to complete then our model will going to know or it has extracted the pattern from the data set and we are going to get correct predictions there and the reason for this thing is right now we have assigned random values to these weights but now after passing input data to our neural network and getting the predicted value for house price we are going to compare that price with the actual price of that house and after that we are going to update these weights so now once the weights will be updated then the next time when you are going to pass the same values through this neural network you are going to get an accurate prediction here as compared to our previous prediction but for now we have passed input data to our neural network at the input layer and we have calculated the value of neuron at the output layer and this process is called feed forwarding so feed forwarding is the process of passing all your training data to neural network at the input layer and getting the value of neuron at the output layer and after getting this predicted value we are going to update these weights and the process of updating these weights is called back propagation so as we are learning about supervised machine learning so we also know the actual price for that house so now after comparing that ual value with this predicted value we are going to update all of these weights and this process of updating weights is called back propagation and these weights will be updated using a formula which will going to take both this predicted value of house price and the actual value of house price and then after doing the calculation the formula will going to update these weights and the process of updating these weights is called back propagation or learning and we call it learning because now we are changing the weights based upon the pattern inside our data set and later using these weights we are going to make our prediction so the process of updating these weights can be called as learning as well and once we are going to pass all training data to our neural network and then based upon the predicted and actual value we are going to update these weights we are going to say that we have completed an epic so an EPO is actually the process of passing input data to neural network and then updating weights based upon actual and predicted results or you can also say that one cycle of feed forwarding and back propagation is called an epic and during training our model we set this epic parameter and we usually set a larger value for this epic like you can say 100 so when we will set this epic to 100 then it means that that for training our model we are going to pass all training data to our neural network 100 times and then we are going to update these weights 100 times so during this process the value for these weights will be changed during each UG and at the end of those 100 EPS our model will be trained so after passing whole data set to neural network multiple times and then by updating the weights we will get our trade model and using this model we can predict price of house in future and in actual our train model contains specific value for weights of neurons and using these weights predictions are done so when we say that we have trained our model using deep learning or neural network then in actual we mean that we have found the correct values for these weights and we have found these values by passing input data to neural net Network and after that updating the weights by comparing the predicted and actual value so now after training our model we can say our neural network will going to look like this so here we will get the values for these weights using which we are going to make the prediction so now after training the model the next step is testing that model so for testing the model we are going to pass inputs at the input layer but this time we have not not pass these inputs during training like somebody told me that his house area is550 and the number of rooms are three and now he want to get the predicted or estimate for his house price so we are going to pass his area and the number of rooms here and then using those formulas the values for Z1 Z2 and Z3 will be calculated and after that applying the same formula but using these new weights we are going to calculate the value for y1 and that will be the predicted value of this house price so that is how a deep learning model is trained using neural network or that's how a simple neural network will going to look like that it consist of neurons and these neurons are connected with each other and for training our model we are passing all the training data at the input layer and then the value of neurons in the output layer is calculated and after that we are comparing that predicted value with the actual value and updating these weights and this process is repeated again and again until correct values are set for these weights or our model is [Music] trained hello guys Hamza here I just want to let you know that this video is just first few hours of my complete TR and taner Flite models for flutter course the complete course is is about 5 hours long and it includes all source code which we write in this course every section has before an after source code so you can easily code along with me apart from that you will get a certificate upon completion which you can add to your resume and the course comes with a 30 days money back guarantee so if you are not satisfied just ask for a refund so if you are interested I will put a link down below and I am offering a discount to first 100 students so enroll now before it's too late now let's continue to the next lecture welcome to this lecture in this lecture we are going to learn about some basic concepts which we are going to use throughout this course so let's start so firstly we have learned about machine learning that machine learning is all about finding pattern in data using algorithm and then we have learned about about its two main types which are supervised machine learning and unsupervised machine learning so in supervised machine learning we use label data for training our model so it means that the data set on which we are training our model contains both input and output and our algorithm find pattern in that data set and then in unsupervised machine learning we use unlabeled data for training our model so it means that the data set which we are using contain only the input values and then we use algorithm to find pattern in that data and after that we have learned about deep learning and its working so it is a subfield of machine learning where we use artificial neural network for training our model and in deep learning we have learned about few important Concepts and the first one is feed forwarding so feed forwarding is the process of passing input data to our neural Network at the input layer and after that we are calculating the values of neurons of hidden layer and then using these values we are calculating the value of neuron at the output layer and this whole process is called feed forwarding so the process starts from input layer and ends at output layer and after feed forwarding we have learned about back propagation so after calculating the values of neurons at the output layer we are comparing this predicted value with the actual value and then we are updating the weights of neural network and this process of updating weights is called back propagation so the process starts from output layer and proceeds towards the input layer and after back propagation the next important thing is called learning rate so learning rate is a float value used to control how how much weights will be updated during back propagation so as during back propagation we are updating the weight so there we are using this float value and its role is to control the amount that how much those weights will be updated so during our model training process you are also going to set the value for this learning rate and after this learning rate the next thing is the loss function so loss function is used to measure difference between predicted and actual results during model training and it is used to monitor error of neural network during model training so as I told you earlier that when we are passing input data at the input layer and calculating the value of neuron at the output layer then there we are comparing that predicted value with the actual value so there to calculate difference between the predicted and actual value we use this loss function function and it is also called error of neural network because it is indicating the difference between actual and predicted results and during back propagations we are updating the weights in such a way that the value of this loss function will going to reduce for the next epic and after this loss function the next thing is overfitting so if we train our machine learning model and our trained model perform well on the training that but its performance is not good on the testing data then this problem is called overfitting and it is because our model starts remembering data instead of finding pattern in that data so overfitting is a problem which we can have with our trained model and in this problem after training the model our model will not going to perform well on the data which is new for our model and to solve this problem we use a technique that is is called Dropout so in Dropout certain neurons are ignored during model training and By ignoring we mean that the value of few neurons are not considered during certain epic of model training so to tackle that overfitting problem we use this technique and in this technique for certain epic of our neural network model training we will ignore the value of some random neuron and by that way we can avoid overfitting welcome to this lecture in this lecture we are going to look at a platform called Google collab so as inside this course you will learn to train machine learning models for mobile applications and for training our machine learning models we are going to use Python programming language so we need a tool or an ID where we can run the python code so instead of installing any software in your system we are going to use a a very useful tool provided by Google and with the help of this tool we can run python code inside our browser and we don't need to have a powerful system to train Advanced machine learning models so the tool which we are going to use is called Google collab so to open it you need to open your browser and go to Google and there you can type Google collab and press enter and now here you need to click on this link research . google.com Cabot so click on it and the homepage for collab will be opened so there you can see this page is opened so as I am already using collab so I can see this dialogue but if I will click cancel then you will see this page so this is the page which you will get if you are using it for the first time and here at the top right corner you need to attach your Google account with this platform otherwise you won't be able to use it so I currently logged in using my email address so that is the basic interface of this Google collab and here you can run powerful python code and use all the powerful python libraries so here when you will scroll down you will see the introduction so collab or cab AR allows you to write and execute python code in your browser with zero configuration required similarly it provide you the access to the gpus free of charge and it also provides you an easy method to share your code so these are very few advantages of Google collab and you will get to know about its benefits once we will proceed in this course so for now let's look at some basic operations which we can perform inside this Google cab so as we are using it for running our python code so here inside this collab if you want to run a python code you need to create a code cell so a code cell is similar to this one so there you can see in this cell we are declaring a variable with the name seconds in a day and then we are assigning this value to this variable and after that we are printing the value of this variable so this is a very simple python code and we will learn about the syntax inside our upcoming lectures but for now you can see these two lines here and these are present inside a code cell so if you want to execute this code you can simply click on this run button and the code present inside this cell will be executed so I will click on it so here for the first time it will going to take few seconds to allocate resources to your notebook file and once done you will be able to see the RAM and the disk associated with this collab and here the execution of this cell is completed and we got this output similarly here you can add more code cells if you want to like if I will click on this this code plus button you will see a new cell is added and here you can write any other python code like I can write a is equal to 5 and then I can print the value of this a so now let's run it and there you can see we got the output is equal to 5 here similarly you can add this code cell anywhere inside this notebook file and after that apart from these code cells you can add one more type of cell which is a Tex cell so there you can see apart from this code cell in this file we also got these commments so when you will double click on them you can see these are also editable and these are basically the Tex cells so you can also add these Tex cells by clicking on this plus text icon and a text cell will be added so you can add as many code cells and as many text Sals and easily arrange your code so that is a basic introduction of Google collab that inside it you can write your python code and execute it without installing any software inside your computer and now let's see some basic operations which we can perform inside Google collab so just like any other ID or any other code editor here you can create multiple code files and a file in Google collab is called a notebook so here when you will click on this file button you will see this option for new notebook open notebook and upload notebook similarly you can also download or save your notebooks here so the standard format for storing this notebook or the code file is ipynb which is for python notebook but you can also save it as a python file with the extension py so here let's create a new notebook so that we can see it and then we are going to download it and then we are going to open it so there you can see a our new notebook file is created and here we are going to write a simple code like we can set a is equal to 10 and then we can print the value of a and now let's run this cell so there you can see the cell is executed and we got the output is equal to 10 so now you can change the name of this notebook by simply clicking here so I can name it starter and after that if you want to download it then you can click on this file and then go to download and download it as a notebook file so there you can see the file is downloaded and now if you want to open this downloaded file then let's just firstly close it and here inside our original notebook click on file and then this upload notebook and then you can browse to the location where you downloaded it so I got it here so I will select it so there you can see our notebook file is opened so these are some basic operations which we can perform inside Google collab and inside upcoming lectures we are going to use this Google collab for training our Advanced machine learning models for mobile applications welcome to this lecture in this lecture we will start learning about the basic syntax of Python programming language so as inside this course we are going to train machine learning models and then we are going to use these models inside our mobile applications so for training these models we are going to use the Python language and inside these few lectures we are going to cover some very basic things which you need to know so that you can easily understand the process of model training so here in order to learn about python you need to open the course resources and there you need to go inside this python folder and there you will find this notebook file and this python file so you need to open this notebook file inside Google collab and you can also check this lecture resources and you will find these files so here on Google collab you need to click on this file button and then this upload notebook and then here you can simply drag the file or select it so I will simply drag it and put it here so there you can see our notebook file is opened and there you can firstly see the introduction of this language so python is interpreted programming language which is being used by developers worldwide to develop various things like websites machine learning algorithms and also simplifying and automating day-to-day tasks basically python is a language that can be used for developing anything and everything you want so it is very powerful programming language and it is good to have some basic know knowledge of this language so we are going to start by looking at the variables and data types in Python so python variables do not need any explicit declaration to reserve memory space so it means that in Python while declaring variables we don't need to specify the data type of the variable but based upon the value which we are storing inside the variable the memory is located to this variable so for example if we are cre in this V1 is equal to 5 so as it is an integer value so in Python this V1 will be assigned the data type integer so you don't need to explicitly specify the data type here but the data type will be assigned to the variables based upon the value stored inside them and here in order to test this you can simply run this cell and you will be able to see integer here so there you can see it is already showing this output but when the cell is executed again again you will see the integer here again so there you can see that so now inside this notebook there are outputs printed for all the Cod cells but in order to learn effectively you can hide these outputs by clicking on this edit and then selecting this clear all outputs and it will going to remove all outputs and now we will see the outputs as we are going to run the cells so let's run this cell again and you will see integer here so there you can see that similarly if we create this V2 variable and set the value 5.0 and now we print the type of this variable using this type function you will see the type will be float because now we stored the float value inside this variable so there you can see that and now let's create this V3 variable and store the string inside it and now when we print the value you will see the output equal to string so there you can see that so that is one basic thing about python variable that we don't need to manually specify the data type here and now let's look at python data types so python has five standard data types and these are numbers string list Tuple and dictionary and we will start with python numbers and we will start with python numbers so in Python in order to create number variables you can simply write the name of the variable and then assign the value to it like here we are creating this V1 variable and assigning the value one and then we are creating this V2 variable and assigning 100 here and then we are printing this V2 as well so let's run this cell and you will see the output equal to 100 and after that if you want to free the space of this V1 or V2 variable then you can simply write this Del keyword and the name of the variable which you want to delete and now this variable will be deleted from the memory so here let's try it so there you can see now this variable is deleted so if I add a Cod cell here and type V1 which is now deleted and then I will run it there you can see we got an error that V1 is not defined and the reason is we have just deleted V1 here similarly if we type V2 and print the value now we will get the result because V2 is declared here and we did not deleted it yet so there you can see that and now let's explore python numbers further so python supports for different numerical types and these are integer long float and complex and here this integer long and Float are similar to any other programming language but this complex is a data type which we usually find in Python so in Python apart from these integer long and float you can also create complex variables and in complex variable there are two parts one is a real part and one is an imaginary part like if you want to declare a complex number then you can do it just like that so we3 is equal to 1 + 3.14 J so here this one is the real part of this complex number and this 3.14 is the imaginary part and you cannot declare this type of variable in most of the programming language so here after creating this variable we are printing it type so let's run it so there you can see the type of this variable is complex and now let's print the value of this variable so V3 and there you can see we got this value here so that is a basic introduction of python numbers and it is only first of five data types which python have so now after looking at python number numers the next data type is python string so in order to declare string in pythons you can use single quotations like here we are creating this Str Str variable and then we are specifying the value inside single quations so this string will be created and now if you want to print the value of this string you can simply use this print function and specify the variable name and after that if we are going to run this cell you will be able to see the output here so there you can see we got this value hello world but apart from that we also got these values here so here we have performed few operations on python strings and we got the output here so let's cover them one by one so there you can see after printing the value of this string we are showing the value which is present at the index zero so in Python we can treat string as an array of characters and as inside an array we can get the value by specifying the index so here you can do the same so we specified the index zero and we got the value H here because H is present at the index zero and then if you want to get the sub string of this string or you want to get a portion of this string then you can get it with the help of this slice notation so you need to specify the name of the variables and then inside these square brackets you need to specify the start index and the end index so for example if we specify 2 to 5 now it means that we want to get the value of this string starting from the index 2 till the index 4 so here the ending index is not inclusive so if you specify 2 till 5 then it will going to start from index 2 till the index 4 so there you can see when we printed this value we got this result L and this notation in Python string is called slice notation and Sim similarly if you want to print this string starting from the index two till the end then you can leave this value empty and it will going to print the string till end so there you can we got this output here or our string is printed till the end and now if you multiply your string variable with any integer value you will see this output so basically we multiplied string with two and it actually repeated that string and if you specify five here then you will be be able to see this hello word five times and if you want to concatenate the string then you can simply use this plus operator so there you can see we got the value hello word test so these are some basic operations which you can perform on python strings so after python strings the next data type is python list and it is most important data type in Python so list are most worst style of python compound data type a list contain item separated by commas and enclosed within square brackets so in order to create a list in Python you need to name the list and then inside these square brackets you can specify the items of the list and one amazing thing in Python is that a list can contain items of different data types like here we created this list and the first value is an integer and the second value here is a string and the third value is again an integer and the fourth value is a float value and we put all inside a single list so let's run this cell so that we can see the creation of this list and now if we want to print the first value of this list you can simply specify the index and you will get the value 10 and if you want to get the type of this first element then you can put this thing inside this type function and run this cell and you will see the type integer here so there you can see see that and if you want to see the type of second variable which is a string then you can do this and there you can see we got the output equal to string and if you want to print a range of values inside this list just like strings then you can use this slice notation so here we are specifying that print the value of this list starting from index one till index 2 so when we will run it you will see the output so there you can see the out put is hello and2 so it printed this list starting from the first element till the second element and in Python list you can also simply reassign an item like if you want to change this two with another list which contain 1 comma 2 then you can simply do that so let's run it and now let's print the value at index 2 and now you can see the index two contain this another list which contain 1 comma 2 and when you will print this list you will be able to see this output so there you can see now inside our python list at the index 2 we got another list which contain the values 1 comma 2 so inside python list we can have anything so there you have seen that we can have a variable of type multiple data types and also have a list inside a python list and now let's look at few methods of python list and the first and the most used method is append so append is used to add single item at the end of list so if inside our list you want to add a value one then you can do this and print the value and you will see after this 30 we will get this one so there you can see that and if you want to do this thing but without this append function then you can also do it like this so you can use this plus operator and then specify the values which you want to add like here after doing it when we will run it you can see two and three are appended inside our list and by using this plus operator to append our list is called in place operation and it is called in place because it is done immediately in the memory so now let's cover some more methods of python list like here we created this list and we added these values inside so let's run this cell and now our list will be created so now if you want to get the count of a specific value which is present inside your list you can easily do that with the help of this list. count function like if you want to know the count of two like how many times two occurred inside this list then you can easily do that like this so list do count and specify the value and now it will going to check that the two is present two times so we will get the output two here so let's run it so there you can see we got the output is equal to two and if you want to get the count of this three you can simply change the value here and run it again and now you can see we got one here so you can get count of any value which is present inside this list similarly if you want to get the index of any value you can get it with the help of index function and the index method tells you the index of first occurrence of an element like here if we will use this list. index and specify to then it will going to show us the index of two but it will going to show the index of first two which appears in this list so let's run it and we should get the output equal to one because two is present at the index one so there you can see that so now after this index we got this insert function so insert function is used to add a value inside a list at a particular index so there you have seen this a pend function so this function will going to add the value at the end of the list but if you want to add an element at a specific index you can use this insert function so here we are using this list do insert and then we are firstly specifying the index where we want to add the value and then we are specifying the value which we want to add so let's run this cell and there you can see now at index 3 we got the value 111 and earlier inside of our list we got got six elements but now we got seven so it will going to insert the value at the index and move the rest of the values similarly if you want to remove a particular value you can use this list. remove function and then you need to specify the value which you want to remove so let's remove this 111 and there you can see the value is removed and now the next useful function is sorting a list so sort method is used to sort element of a list list so for now in this list you can see our list is not sorted but if you want to sort it you can simply use this list do sort and then print the value so there you can see our list is now sorted in the ascending order but if you want to reverse this list like you want to move the first element to the last and the last to the first and so on then you can use this list. reverse function so when we will do that you will see the output that now our list is is totally reversed so that is a very basic introduction of python list and now the next data type is python tuples so a tuple is another sequence data type that is similar to a list so a tuple consist of number of values separated by commas but unlike list tuples are enclosed within parentheses so the main difference between list and Tuple are list is enclosed with within square brackets and their size and element can be changed while tupal are enclosed within parentheses and they cannot be updated so tuples can be thought of as readon list so based upon this description we can infer that tuples are similar to the list but the only difference is after creating a tuple we cannot make any change inside it so in Python for creating a tuple you will firstly name it and then Within These parentheses you will specify the element of Tuple and there you can see just like list we are specifying elements of different data types here so now let's run this cell and our Tuple will be created so there you can see that and now if you want to get a particular element of a tuple then you can specify the index and get the element like here we are getting the first element so we got 10 here and similarly if you will specify one then you will get this hello here and now if you will try try to change the Tuple you will get an error because tups cannot be changed and after tupal the next data type is python dictionary so dictionaries works on the concept of key value pair so for each value you have a unique key Associated to it so in Python dictionaries are created in the form of key value pair so it means that for each value which you want to add inside a dictionary you need to specify a unique key for it like here we are creating this dictionary and for creating it we will use these curly braces and then inside it for each element you will Define a unique key so here for the first one we are specifying the key K1 and then we are specifying the value equal to 1 and after that for the second element of the dictionary we are defining another key and then we are specifying the value and then you can see we are adding another element with the key K3 and this time we are defining a float value so that's how you can create a dictionary in Python that you need to specify a unique key for each element which you want to add inside that dictionary and then while accessing that element you are going to use that key to get the value like here let's firstly run this cell to create the dictionary and now if we want to get the second element which is a text home then we need to specify the key for it so here we will specify the key K2 and then print it and there you can see we got the value home and similarly if we will specify K3 here and run the cell again then you can see we got the value 30.2 and it is the value specified with the key K3 so that's how you can create dictionary in Python and now the next thing is conditional stat mats and Loops in Python so firstly let's cover the conditional statements so just like any other programming Lang langage the basic conditional statement in Python is if and if you want to use it then you will use the if keyword and after that you will specify your condition and here while specifying the condition you don't need to use parenthesis but after the condition use this colon operator and then on the next line specify the body of if statement so here we are creating two variables V1 and vs2 and then we are checking that if V1 is greater than V2 then print V1 is greater and after that we are adding an lsif block so in Python for lsf we are using the keyword L if and it is equivalent to L if block and then you will specify the condition and then the colon so here we are checking that lse if V2 is greater than V1 then print V2 is greater and then finally we are adding an else block and then the work which we want to do so in the else block we are saying that we V1 is equal to V2 because both of them are equal unless one of the above statement will be true so now let's run this cell and there you can see we got the output V1 is equal to vs2 and the reason is the value for both variable is equal so now let's change the V2 to like 18 and run the code again and there you can see this time this block is executed because V2 is now greater than V1 so we printed the message V2 is greater so that's how you can use IFL statements in Python and after that let's cover the python Loops so the first Loop which we are going to use is a while loop so in Python for using the while loop you will use this while keyword and then inside parenthesis you will specify the condition so here we created a variable with the name count and we set it to five and now we added the condition that while count is less than equal to five print the value of count and increment the count so now let's run it and there you can see it printed 1 2 3 4 and five so those were the values of this count variable inside this Loop so until the count is less than equal to five we printed its value so there you can see that and once the value of count was greater than five then we came out of this Loop so that's how you can use while loop in Python and after that the next Loop is a for Loop so in Python the for Loop is mostly used with python list like there you can see we are creating a python list with these elements and then we are iterating this list with the help of a for Loop so for v in list print the value of v and it will going to print each element of this list one by one so let's run this cell and there you can see it printed the value 1 2 3 4 and finally it printed the name Hamza here so that's how you can iterate list in Python using a far Loop and after that you can see we are using far loop with a string so as I told you earlier that in Python string is actually a list of characters so just like any other list we can iterate it using a far Loop so for v in Python and then we are printing V and it will going to print each character of this string one by one so let's run this cell and there you can see it printed py t h o n so basically it treated this string just like a list and printed it element one by one and now after covering the conditional statements and Loops in Python the next thing is taking user input so there can be the scenarios where we need to take some input from the user so in Python to do that we are going to use this input function and then inside the parenthesis you will specify the message which you want to show and once user will going to enter the value that value will be stored inside this S1 variable and after that we are printing that variable here so let's run this cell and there you can see the box with the message enter your name so you need to type your name here and then press enter and after that it printed the value here because here we are printing that value so that's how you can take user input in Python so now the next thing is dealing with files in Python so while training our machine learning model we can encounter a scenario where we need to deal with files inside python like after training the model if we want to save it inside a TF light format or inside any other format then we need to create that file and similarly there can be the scenarios where we need to read the data from file in Python so it's important to learn that how we can read and write to a file in Python so here at the bottom of this notebook we got this opening and closing file section and there you can see this detail but you can also this error so basically here we have put this comment inside a code cell so that is by mistake and we should put it inside a Tex cell so let's firstly cut the content and then we are going to delete this cell and after that we can add a Tex cell here and paste the content inside it so now now let's read it so while opening file you need to specify the file name and the mode in which you want to open the file so the mode can be R for reading W for writing WB for writing in a binary format RB for reading in a binary format and a for appending an existing file so these are few modes in which you can open files so now let's start by opening and writing to a file so there you can see in this cell we are using this open open function to open this file so firstly you need to specify the name of the file which you want to open and then the mode in which you want to open it so as we want to write to a file so we specified the mod to W and the file name is a.txt so now this open function will try to open this a.txt file and if this file is not existing then it will going to created but where it will going to create the file or from where it will going to try to open the file and the answer is this files pan so you can see this files icon here so just click on it and you will see this pin so here you will see all the files associated with this code notebook so here when we will run it you will see a new file will be created because there is no a.txt file here so there you can see the cell is executed so now when we will refresh it you will see this file a.txt and now to this file you can write anything which you want but we will do that in a minute but now let's check few operators of the file so firstly if you want to check that if a file is open or closed then you can use this F do closed property so now when you will run it you will see an output so there you can see I got FS here which means that our file is not closed yet and it is opened and there you can see this error it is maybe because of this space so I will remove it and theor is gone and after that if you want to close a file then you can use this f. close function and it will going to close our file and then if you will run this F do close you will get true here because now we have closed this a.txt and after that let's start reading and writing to a file so here we are firstly opening this intro. txt file in a writing mode and then we are creating a string variable and putting the text python is fun inside and then we are using this file. WR function and specifying the value which we want to write and after that we are closing the file so let's run this cell and our intro. txt will be created so there you can see that so now if you want to download this file you can simply click on this download button and this file will be downloaded and when you will open it you will see this text python is fun here but if you want to read the content of this intro. txt inside our python code then you can open it inside a reading mode and then you can use this f. read function so this function will going to read the content of this file till the index 10 or it will going to read first 10 characters from the file and we are assigning the result to this s str2 variable and then printing the value of this variable so let's run this cell and you can see we got the output python is and then this space and the reason is we only specify 10 here but if we do not specify any index and run it again now you will see all the content of this file so python is fun so that's how you can write a content to a file in Python and that's how you can read a content from a file in [Music] Python hello guys Hamza here I just want to let you know that this video is just first few hours of my complete train and taner flow light models for course the complete course is about 5 hours long and it includes all source code which we write in this course every section has before and after source code so you can easily code along with me apart from that you will get a certificate upon completion which you can add to your resume and the course comes with a 30 days money back guarantee so if you are not satisfied just ask for a refund so if you are interested interested I will put a link down below and I am offering a discount to first 100 students so enroll now before it's too late now let's continue to the next lecture welcome to this lecture in this lecture we will start learning about few data science libraries and these libraries will help us during our model training process so let's start so the first library of this series is called numai and before learning about this Library you need to open this numpy notebook file inside Google collab so you can check the resources of this lecture or you can go to the course resources and there in the data science libraries folder you need to go inside numpy folder and there you will find this notebook file so you just need to open this file inside Google collab and once you will do that you will be able to see all of this code so now let's start learning about this Library so numai is a library for Python programming language and it provides support for large multi-dimensional arrays and matrices apart from that it provide a large collection of high level mathematical functions to operate on these arrays So based upon this description we can say that numai is a library using which we can create multi-dimensional arrays and we can apply a lot of functions or operations on these arrays and in practice we use use this library in Python for creating our dummy data sets and also applying different operations on our data sets so now let's start learning about this Library so to use this Library firstly you need to import it and for importing a library in Python you need to use this import statement and then the name of the library and after that you will assign an alias to the library so now we are importing numpy as NP and wherever we want to use this Library we are going to use this NP keyword similarly you can use any word here which you like so let's run this cell so that our library will be imported and as it's the first code cell of this notebook so it will going to take some time so there you can see it is executed successfully which means that our library is imported so after importing this Library let's create an array using this Library so to create an array we can use this np. array function and then you need to specify the elements of the array and you will specify them inside these curly braces and then we are printing this array so let's run this cell and there you can see we got this array here and as you can see the output is there for all the cells so you can hide it just like our python notebook so here you can go to the edit and then click on this clear all outputs and now all the outputs will be hidden and now we can learn more effectively so let's run the cell again so that we can see this array and after that you can see in the next C we are printing some information about this numpy array so let's run it and then we will see this detail so firstly we are printing the array just like we did above so there you can see we are getting the values of the array which are one and two and after that we are printing the type of this array so there you can see the type is num. ND array so here this ND array is actually specifying n dimensional array and then we are printing the shape of this array so the shape gives us this output so as it's a single dimensional array with two elements so we are getting this two here and then we are printing the size and we are getting two here because there are two elements present in that array and now let's create a two- dimensional array in numai and to do that we are using this np. array and now to define a multi-dimensional array we are using two square brackets here so here firstly you can see we are specifying the first row and then this second row here here so this will be an array of size 2 into two which means that two rows and two columns so let's run it and our array will be created and now let's print the properties so there you can see firstly we printed the array and we got this data so the first row contain element 1 and two and the second row contain the element three and four and after that we are printing the type of this array and the type of this array is again num. ND array and then we are printing the shape so this time the shape consist of two rows and two columns and then the size so as there are total four elements in this array so the size is four similarly if you want to add another row here in this array then you can add a square brackets here and add the elements like 5 comma 6 and then we are going to run it and after that let's print the properties and there you can see now there are three rows inside our array and two columns and if you want to add one more column then you need to specify the third element inside each row and let's print the properties and there you can see we got three rows and three columns inside our array so that's how you can create an nend dimensional array inside numai and now while creating arrays if you want to specify the data type of the elements then you can also manually do that so there you can see now to specify the data type we will add a parameter D type inside this array function and there we are specifying np. float 32 so basically we are specifying that create an array where each element will be of type float 32 and then we are printing the type of first element so let's run it and there you can see the type of first element is float 32 and that will be the type of each element of this array so while creating these arrays you can also specify the data type which you want to assign to the elements and after creating these arrays let's look at some built-in functions so here in numpy if you want to create an array filled with zero then you can use this mp. zeros then inside these parentheses you need to specify the shape of the array which you want to create and after that we are printing the array so now here we are creating a three-dimensional array so let's run it and there you can see the array and each element of this array is filled with zero similarly if you want to fill them with one then you can use this mp. one's function and then specify the shape so let's run it and there you can see we got this array where each element contain the value one and these functions can be very handy or useful while training of model because there we may need to create some dummy data sets so there we can use them so now let let's see how we can create an array with random values so to do that we will use this num. random. random function and there you will specify the shape of the array which you want to create so now let's run it and you will see a 4x4 array will be created and it is filled with random values so now let's run it again and you will notice different values here so there you can see that so each time you will run it you will get a different value because they are being generated randomly and if you want to fill them with a particular value apart from 0 and one then you can use this numpy do full function and there firstly you will specify the shape and then the value which you want to fill so let's run it and you will see a 4x4 array will be created with nine fi at each index so there you can see that so that's how you can create arrays in numai with a particular value or with random values and after looking at these built-in functions the next thing is reshaping an array so in numai if you want to change the shape of an array then you can do that with the help of this reshape function so as we created this array here and now we are calling this array. reshape function and here we are specifying the output shape and here while specifying this shape you need to make sure that you are specifying a correct shape here so as our input array contain four rows and four columns so there are total 16 values inside this array so while reshaping it we need to make sure that our resultant array can also contain 16 elements so let's run it and you will see the output array and there you can see that so now we change the shape of this array to this particular shape so that's how you can reshape an array and after that if you want to flatten an array which means that you want to convert a multi-dimensional array into a single dimensional array then you can do that with the help of flatten function so here firstly we are creating a 2d array with two rows and four columns so let's create and print it so there you can see this array and now if you want to convert it into a single dimensional array then you can do that with the help of this array. flatten function so there you can see that so now we have changed the shape of this array into a 1D array and now after learning about these functions the the next thing is operators in numai so firstly we are going to look at unary operators so unary operator are such operators which can be applied on single object of numpy so there you can see we are creating a numpy array with these particular values and after that we are getting the minimum value of this array with the help of this array. Min function and if you want to get the maximum value then you can use this Mac function and if you want to get the sum of the elements then you can use this sum function so let's run this cell and you will see the output so the minimum value of this array is 1 and the maximum value is six and the sum of all the values is 21 and after un operator let's look at some binary operators so binary operators are such operators which are applied on multiple objects of numpy arrays so there you can see we are creating two numpy arrays here so firstly this aray which contain 1A 2 and then this array two which contain 3A 4 and after that if you want to add the first element of array 2 into first element of array 1 and the second element of array 2 with the second element of array 1 then you can do that with the help of plus operator so when we will run this cell you will see the output so there you can see the result of this line is four and six so here we get this four by adding this one with three and we got the second value by adding this two with four so there you can see the output and if you want to multiply them element wise then you can use this multiplication operator so here while multiplying one with three we got three and while multiplying two with four we got eight and similarly if you want to perform subtraction or division then you can also do that by specifying the symbol here and after that if you want to get the dot products of these two arrays then you can do that with the help of this array dot dot function and here you are specifying the second array with which you want to get the dot product so after buying the operators the next thing is matrix multiplication so if you are familiar with matrices then you know that there is a specific multiplication which is used while multiplying two matrices so here in numai the arrays are also considered as matrices so here if if you want to multiply two nend dimensional arrays just like matrices then you can do that with the help of this numpy do matm function so here we created this M1 and M2 which are two dimensional arrays and then we are multiplying them just like matrices so here let's run this cell and you will see this output so we got this output by multiplying the first array or first Matrix with this second Matrix but this multiplication is as per rules of matrix multiplication and after that the next thing is sorting an array so in numai if you want to sort an array then you can use this np. sort function so to look at it firstly run this cell where we are creating a two-dimensional array so this array contain four rows and three columns and it is filled with random values as you can see that so now if you want to sort it then you can use this np. sort function so here you will specify the array which you want to sort and after that you need to specify the AES along which which you want to sort it so as it is a two- dimensional array so it will going to ask you whether you want to sort it rowwise or column wise so if you want to sort it rowwise then you will specify the x is equal to 1 so here when we will run it and you will see the output so now you can see all the rows are sorted so the first row contain minimum value and then the value which is bigger than that and then the value which is maximum and same will be the case for all the rows but if you want to sort them column wise then you can specify the x is equal to Zer so let's run it and now you can see they are sorted column wise welcome to this lecture in this lecture we are going to look at the second library of our data science Library series and that library is called pandas so let's start so in order to learn about this library in the course resources you need to go to the pandas folder and this folder is present inside data science libraries and you will also find this folder in the resources of this lecture so in this folder you will find this pandas do notebook file so open this file inside Google collab and you will be able to see this code and now let's start learning about it so in computer programming pandas is a software Library written for Python programming language for data manipulation and Analysis so as this definition suggest pandas is a library used in Python for working with data sets so it provide a number of features using which we can perform different operations on our data sets and these things will be clear once we will cover the working of this library and in pandas there is a specific data type which is called a data frame so Panda's data frame is a two-dimensional heterogeneous tabular data structure with the label AIS so Panda's data frame can be thought of as a table with rows and columns so Panda's data frame consist of three principal components the data rows and columns so now let's start learning about this Library so that these details will be clear for us so in order to use this Library firstly we need to import it so we are importing pandas as PD and we are also importing numpy library because because we are also going to use it so here let's import this Library by running this cell and it will going to take some time as it's the first code cell of this notebook so the resources are being allocated and you can see it here and there you can see we got the resources here and this cell is executed as well and now here firstly we are creating a python list and in this list there are three elements this 10 100 and th000 and after that we are converting this python list into Data frame with the help of this pandas do dataframe function so here we are specifying this python list and we are getting this data frame and then we are also printing it so let's run this cell and you will see this output so here we converted this list into a data frame and once we did that you can see we got a table here and in this table there are three rows and the first row contain the value 10 the second row contain 100 and the third row contain thousand and the reason is we converted our list into a data frame and as we mentioned here it is a tabular data structure so in short it converted our list into a table and in this table there are three rows and a single column and for now these rows and columns are not named with anything but later we can also change the name of the columns as well just like any other table so now after creating this basic data frame let's create an advanced data frame so here let's firstly click on this edit and click on this clear all outputs to hide all the outputs so I clicked on it and now all the outputs are hidden and now let's create a data frame from a dictionary so here firstly we are creating a python dictionary so as we learned earlier that in dictionary the elements are specified in the form of key value pair so the first key is name and the value is this list which contain different names and after that for the second element the key is age and the value is this list which contain these values so now we are creating a python dictionary here and then we are converting it into a data frame so pd. data frame and we are specifying this data here and then we are also printing this data frame so let's run this cell and there you can see the output so in the output we got this table where there are two columns the First Column is name and the second column is age so it contain all these names and it contain the age so this data is looking much more better in the form of data frame and in future we are going to load our data sets for training our machine learning models using this pandas library and now after creating a data frame from a list and also from a dictionary it's time to create a data frame from a CSV file so CSV stands for comma separated values and it is a standard format for having large data sets so now if you want to load a CSV file and convert it into a data frame then you can do that with the help of pandas do read CSV function and there you need to specify the mode in which you want to open the file so there you can see we specify the r mode which is for reading and then you need to specify the path of the file so here we specified this path but we did not uploaded any file on this Google collab but now we are going to do that so here click on this files pin because here we can upload our files and we have learned about it inside our python section and after that open the course resources and in the pandas folder you will find this pandas data set so just open it and you will find this nba. CSV so just drag this file and put it here and now this file will be uploaded in the file spin of our code so there you can see this file and now the path of this file will be content for/ nba. CSV so now let's run it and our file will be loaded and converted into Data frame and now let's print this data frame and there you can see the data it contains so there are 458 rows in the CSV file and each row contain nine columns so as it is the data set of NBA players so we got the name of the player its team name number position age height weight college and salary and we have loaded this data set in the form of data frame with the help of Panda's library and in future while training our machine learning models we are going to load our data sets in the same way so now after looking at this data frame let's print the type of this data frame by using this type function and there you can see the type is data frame so now after looking at the creation of data frame from different things it's time to look at different operations which we can perform on data sets with the help of Panda's library and the first operation which we are going to perform is handling missing values so what does that mean so it means that while collecting our data set there are chances that few rows of our data set contain some missing values like you can see this row of the data set so here we got the value for all the columns except this college column so for college we got n n which is representing a missing value so now if we want to handle all the missing values in a particular way we can also do that with the help of pandas so here we are creating a dictionary and then a data frame from it so let's run this cell and our data frame will be created and there you can see that so in this data frame for the first score column we got a missing value in the third row and we got one missing value here and one here and now if you want to check that which rows contain missing values then you can use this DF do is null function so let's run it and there you can see it is showing you this table and here wherever there is a missing value it is returning true like you can see this true here here here and here and inside our data set we got the missing values present at those positions so now after getting the position of these missing values if you want to fill them with a particular value like if we want to fill them with value 10 then we can do that with the help of DF do fill now and then we are specifying the value which we want to fill so here it will going to fill all these three missing values with 10 so let's run it and there you can see all the values are filled with value 10 here and now if you want to drop those rows which contain these missing values then you can use this DF do drop Now function and it will going to drop the rows which contain missing values so let's run it and now our data set contain only this row where there is no missing value and as in all other three rows there was missing value for some column so it has actually dropped those rows or removed them from our data frame so that's how you can handle missing values in your data set with the help of Panda's data frame and if you want to get the shape of your data frame then you can use this DF do shape and you will get the shape of the data frame so as our data frame consist of four rows and three columns so we got this output here so that is a basic introduction of Panda's library and how we can use this library for manipulating and analyzing our data and you have seen this thing in this small notebook file that here we have loaded our data set and then we have also manipulated our data set by handling those missing values so the first element of First Column contain the minimum value and the last element of First Column contain the maximum value and that is the case for all the columns so that's how you can sort multi-dimensional arrays in numpy and that is a basic introduction of numpy Li d and while training our model you will see we are going to use this library for few operations welcome to this lecture in this lecture we will look at the third library of our data science series and that library is called mat plot LA and by using this Library we are going to visualize our data or plot it in the form of charts and graphs so mat plot lib is an amazing visualization library in Python for 2D plots of array is so now for using this Library firstly you need to open this notebook file inside Google collab so you can check the resources of this lecture or course resources and there in the matplot lib folder you will find this matplot li. notebook file so you need to open this file inside Google collab and you will be able to see this code so now let's start using this Library so Matt blot lib is an amazing visualization library in Python for 2D plots of areas so as the definition suggests this library is used to plot your data in the form of graph s charts so that you can easily visualize your data and analyze it so now let's start using this Library by importing it so to import the library we are going to use this matplot lip. pip plot and we are going to import it as PLT so let's run this cell and our library will be imported so there you can see the cell is executed which means that our library is imported successfully so now let's see how we can plot arrays using this Library so here we are creating two python lists and there the first list contain the elements 10 20 and 30 and the second list contain 3 to 1 and now if we want to plot these two arrays then we can use this PLT do plot function and there you will specify by the X and Y parameters so the X will be the first array which you want to plot and Y will be the second array so here before running this cell let's click on edit and click on this clear all outputs function and it will going to hide all the outputs so now let's run this cell so that we can see the plot and there you can see the output so in the output we got this graph here and here we got this line based upon the points present in those arrays so as the first value of x array is 10 and the first value of y array is three so there you can see on the y axis we got this line starting from three and on x- axis it is starting from 10 and then the second value is 20 and the Y is two So based upon this point our point will be at that position so our line Started From Here reached here and then for the third point of X and Y our point was here so our line reached here here so that's how this plot is being generated based upon these values similarly instead of this line if you want to plot them with the help of bars then you can use this PLT do bar function and it will going to plot it in the form of bars so let's run this cell and there you can see the output so again as our first point was at this particular position so the first bar is starting from 10 and reaching three and the second bar is starting from 20 and it is reaching two and the third bar is starting at 30 and it is reaching one and if you want to plot it some other way like a scatter plot then you can use this PLT do scatter so let's run it and there you can see this time we just got the points and we are not getting any line or bar here so it is indicating the points based upon the data inside our arrays and these graphs are very useful while working with larger data ass sets on which we are going to train our model and after looking at these graphs the next step is working with images using this Library so if you want to load images inside python notebook then you can also do that with the help of this Library so firstly we are importing it using this matplot lip. image as I am so we are loading the image module of this Library so let's run this cell and after that if you want to load some image with which is present in the file section then you can do that with the help of im. IM read function and there you need to specify the path of the image and after that we are using this PLT do IM show function and we are passing this IMG variable here so it will going to print or show our image here but before that we need to add the image in the files pan so in course resources inside this mat plot lib you will also find this images folder so just open it and inside it we got this image.png so just drag it and put it here and now this image will be uploaded here so there you can see that so now let's run this cell and you will see this image here so there you can see that so that's how you can load images inside python using this Library so when we are loading this image using matte blot lip the image is being loaded as nump array like here if you move the cursor to this IMG variable you can see it is actually an ND array with shape 567a 604a 4 so this image is being treated just like a numai array so here if you want to see the shape of this array then you can use this IMG do shape and there you can see this shape here and if you want to view the data of this numpy array in the form of values then you can simply print it and there you can see the data which is actually constructing this image so our image and all the colors and data inside this image is being constructed with these numerical values so here as it's a nump array so if you want to get a particular value which is at particular index then you can also do that so here firstly we are getting the value here by specifying these indexes so let's run it and there you can see we got this output and if you want to get the particular value then you need to specify three indexes here because it is a 3D array so here let's run it and we got this output here and this is the value present at zero index of all the dimensions of this nump array so in short when we load images in Python using mat plot lib the images are being loaded as numpy arrays and then on images we can perform any operations which we can perform or nump array so that is a basic introduction of mat plot library and this Library will be used for visualizing our [Music] data hello guys Hamza here I just want to let you know that this video is just first few hours of my complete TR and taner Flite models for flutter course the complete course is about 5 hours long and it includes all source code which we write in this course every section has before and after after source code so you can easily code along with me apart from that you will get a certificate upon completion which you can add to your resume and the course comes with a 30 days money back guarantee so if you are not satisfied just ask for a refund so if you are interested I will put a link down below and I am offering a discount to first 100 students so enroll now before it's too late now let's continue to the next lecture welcome to this lecture in this lecture we will learn about a library called tensorflow so what is this library and why we are learning about it so taner flow light is a library developed by Google for machine learning and Ai and it is one of the most popular and most used library of this current ERA and the reason is by using this Library we cannot just train machine learning models which run on desktop or on web but the models trained using this Library can also be used on mobile devices and we are going to use this library for training such machine learning models which can be used in mobile web and deop applications so let's start so the first step is opening this notebook file where we got the code for this Library so you can check the resources of this lecture or go to the course resources and there you will find this taner flow folder and inside it you will find this notebook so you need to open this taner flow. notebook file inside Google collab and once you will do that you will be able to see this code and here after opening it the first step is importing this Library so that we can use it so to import this Library use the command import tensorflow SDF and then we are printing the version of the library as well and there you can see the output so it means that the library is imported successfully and we are using the version 2.15.2 so after importing this Library the next step is declaring variables and constants in Tanger flow so there you can see this next section and here we are creating the simple python variable so we are creating V 0 and assigning the value 42 here so this is the Declaration of just a simple python variable but if you want to create a torf flow variable then you need to use this tf. variable function and then specify the value and if you want to create an array in tenser flow then you can use this tf. variable but this time you will specify the values of the arrays like here the array contain two values and if you want to create a multi-dimensional array in Tanger flow then you can declare it like this so you need to use this p do variable and then inside these curly braces you will specify the rows of your multi-dimensional array so now let's run this cell so that all of these four variables will be created and now we will analyze them one by one but before that click on this edit button and select this clear all outputs and it will going to hide all the outputs present in this notebook and now we are going to print the value of each cell and look at the output so firstly let's run this v0 and we got the output 42 because this is just a simple python variable and after that let's print this V1 and as this V1 is a tensorflow light variable so we got this information here so V1 is of type tf. variable and the shape of this variable is not defined because it contains a single value and after that the data type of the variable is integer 30 2 and the actual value of this variable is 42 so while printing a Tanger flow light variable we are getting all of this information and here just like python the data type is assigned automatically based upon the value of the variable so we defined the value 42 so as it's an integer so it assigned the data type to integer 32 so now after printing this V1 let's print this V2 and there you can see we got the information so again it is a variable but this time we got the shape so as it contain an array of size or shape to so we got this shape here and after that the data type is integer 32 and then the values so the value of this transer flow light variable is an array which contain two values and now let's print V3 and this time you can see our shape is two rows and two columns because this V3 contain this multi-dimensional array and now the value is this two dimensional array so that's how you can create variables in taner flow that you need to use this TF do variable and then specify the single value or the array which you want to create in taner flow and after creating a variable if you want to change the value of that variable then you can use the assign function so here if we want to change the value of V1 variable to 33 then we can use this V1 do assign and then specify the new value and after that we are printing V1 here so now let's run this cell and there you can see now we1 contain the value 33 and earlier it was containing the value 42 so that's how you can change the value of a variable in Tanger flow and after working with variables the next thing is working with constants in Tanger flow so to create a constant in Tanger flow you can use this TF do constant and then specify the value and it will going to create a constant here and after that we are also printing the value of this constant here so let's run this cell and now you can see the output so here the value of this constant is 42 and the data type is integer 32 and if you want to specify the data type while creating a variable or a constant then you can also do that and to do that you need to specify this D type variable like here we are creating a tensor flow light constant and we are specifying the data type to float 64 and after that we are printing that constant as well so let's run this cell and there you can see this time the data type is float 64 and the value is 62.0 and you can use this dtype parameter for taner Flite variables as well so that's how you can create variables and constants in taner flow and after that the next step is shaping a tensor so if you want to know the shape of a taner Flite variable then you can use variable. shape property so here we are creating this taner Flite variable which contains a 2d array and then we are printing its shape so let's run this cell so there you can see the tenser shape is equal to 2A 3 which means that this tenser has two rows and three columns and similarly if you want to reshape a tenser just like a nump array then you can use this tf. reshape function and here you need to specify your input tenser and then the output shape so now our T4 variable or T4 tenser will be reshaped into this particular shape and then we are printing the shape again so let's run it and now you can see the shape of our tenser is changed similarly let's print this T5 and now you can see it contain the single row with five items so that's how you can get the shape of a tenser or reshape it and after that the next thing is ranking of a tenser the rank of a tenser is the number of Dimensions it has and that is the number of indices that are required to specify any particular element of that tenser and based upon this description we can say that the rank of a tenser is the number of dimensions of an array and if you want to know the rank of a particular Tanger then you can use this tf. rank function and inside it you will specify a Tanger FL light variable like above we created V3 variable so there you can see that and it is a twood dimensional array and here we are printing its rank so let's print it and there you can see the rank of this tor is two so similar to printing a tenser flow light variable when we are printing the rank we are also getting this information and here the actual value is indicated with this numai key so rank of V3 is two because it was a two- dimensional array and after rank the next thing is specifying an element of a tenser so if we want to get a particular element of a tenser then you can get it using these indices like we created T4 above so there you can see this is T4 and it is a two-dimensional array so now if we want to get the element which is present at the zero row and First Column then we can specify the indexes and it will going to return that element and then we are assigning the result to this T6 and then we are printing this variable and basically it will going to return the element in the form of Tanger Flite constant so let's print it and you will see the information here so there you can see the value present at that index is two and we are getting this TF do taner and we were getting this value when we were printing taner Flite constant so here above we were printing Tanger Flite constants here so there you can see this C1 and we are getting a similar message here so now if you want to get a particular element then you can get it like this and if you want to cost or change the type of taner flow light variable to a numpy variable then you can use this variable and the numpy function so here we are converting T6 to numai so let's print it and you can see we are getting this information so basically it was a tenser fluide constant and now we are changing it into a nump value and after doing that we are printing it and we are only getting this two and not all of this information because this information will be printed for taner Flite variables and constants and after that the next thing is finding the number of elements of a tenser so if you want to get the size of a particular tenser then you can do it like this so This T4 do size and then inside it you will specify the input value so we want to get the size of T4 which is a Tanger Flite variable which we created above and after that we are using this numpy function because we want to get the size in the form of integer or numi value so here let's print it and you will see the information that the size of T4 is 6 which is correct because we got T4 here so there you can see T4 and it contains six values and if we we remove this numpy function from here and print the value again now you can see we are getting a Tanger Flite constant so here the size is six but we want to avoid all of this extra information so we use this numi function so let's add it again so by using this numpy function you can only get the output value for a variable or constant instead of instead of all of that information and basically it is converting that Tanger flow light variable into a num by variable so that's how you can get the number of elements of a taner and after that if you want to get the data type of a tenser then you can use this dtype property so here let's print this T6 do dtype and you can see we got integer 32 so these are some basic operations which will going to help us during our model training process and after that the next thing is specifying element wise Tor operations so here we are creating two tensor Flite variables so this t7 and T8 and now if you want to divide each element of first t with the element of second T then you can do it like this so here basically we are dividing first element of t7 with first element of T8 and then second element of t7 with second element of d8 and after that we are getting or converting it into nump so let's print the result and there you can see our result is 0.5 and 1 so basically when we divided this one with two we got 0.5 and when we divided this two with two we got one and you can also perform other operations like addition subtraction and multiplication like here we are multiplying t7 with 4 and then we are printing the result and it will going to multiply this four with each element of t7 and there you can see the result that now t7 contain 4 and 8 and earlier it was containing 1 and 2 so now after multiplying four with this one we got four and multiplying four with two we got eight so whatever operation you are going to perform on tens of flow light variables using these operators they will be performed on each element of this variable and after that the next thing is transposing and matrix multiplication in Tanger flow so just like numpy in Tanger flow you can also multiply arrays as matrices so to do that here we are creating two Tanger FL light constants so firstly we are creating the C1 with the values 1 and two and then the C2 with values three and four and now if we want to multiply them just like matrices then we can use this TF do matm and here you need to specify both of the matrices which you want to multiply so firstly we we are specifying this C1 and then we should specify C2 but we are not directly specifying C2 here and the reason is in order to multiply matrices the number of rows in first Matrix should be equal to the number of columns in second Matrix but in our case C1 is the first Matrix and it has one row and C2 is the second Matrix but it got two columns so they cannot be multiplied directly so in our to multiply them we are taking transpose of C2 so in matrices there is a term used transpose and when we take transpose of a matrix we are changing its rows with column and column with rows so when we are going to take transpose of this C2 we are going to get a matrix where there will be two rows and one column so right now there is one row and two columns but after taking this transpose we will get two rows and one column and now this C1 can be multiplied with the transpose of C2 because in C1 there is one row and in the transpose of C2 there will be one column so here to take transpose of C2 we are using this tf. transpose and then specifying The Matrix for which we want to get the transpose and after that we are multiplying C1 and C2 here and this multiplication is as per rules of matrix multiplication so let's run it and you will see the result and there you can see the result here is 11 and we got this 11 after multiplying this C1 and C2 as per the rules of matrix multiplication so that's how you can take transpose of Matrix in Tanger flow and multiply matrices and now the next thing is type casting so if you want to change the type of a taner then you can also do that like here firstly we are printing this C1 which we declared here and there you can see it data typee is integer 32 but now if you want to change this data type to some other type like integer 64 or float 32 then you can do that with the help of this tf. cost function and here we are specifying C1 and then we are specifying this D type variable and here you need to specify the data type which you want to assign to the C1 so here let's run it and you will see that now C3 which is the result contain the data type integer 64 so that's how you can change the data type of each element of a tenser and after typ casting the next thing is declaring R tenser so what is a r tenser so when we create multi-dimensional arrays in python or inside any other programming language we know that the number of columns are fixed for each row like if we are creating a multi-dimensional array with three rows and four columns then we know that each row of this array contain four values because there are four columns but in Tanger flow you can create a multi-dimensional array where there will be different numbers of columns in each row and to do that we are going to use this tf. r. constant function and here inside it you can see we are creating a multi-dimension tenser or an array so here the first row contain only single value which is one and then the second row do not have any value and after that the third row has two values and the fourth row contain three values so you can see each row of this multi-dimensional array or taner contain different number of columns and that is a feature provided by taner flow so here let's print this R taner and you will see the result so there you can see in the result we did not get the TF do variable or TF do taner but instead we got the type TF do R tenser because it is a r tenser with different number of columns in each row and then you can see the values so that's how you can create R tensors in tensor flow and now let's look at few more operations which we can perform in taner flow and the first one is getting mean of a value or mean of Tanger flow light variable so if you want to get the mean of a tensor flow light variable then you can use this t f. reduce mean function and inside it you need to specify the variable for which you want to get the mean like here we specified V1 so when we will run it we will get the result equal to 33 and the reason is we declared an initialize V1 above and then we reassigned it to Value 33 so there you can see that but if V1 contain multiple values then we are also going to get the mean of those values so here let's see change the variable name so instead of V1 we will declare V2 and run it so you will get the mean which is equal to 1 and the reason is in V2 there are two values 1 and two and after getting the mean we got an integer value as result which is one and if you want to get the mean of a Tanger FL light variable which contain multiple Dimensions like a 2d array then you can also specify the AIS along which you want to get the mean like here we created a 2d tenser and there are two rows and two columns and now if we want to get the mean across columns then we will specify the x is equal to0 so let's run it and see the mean so the mean which we got is 2 and three and we get it by adding this one with three and dividing it two so we got two and then by adding this two with four so we got six and after dividing it with two we got three and if you want to get the mean rowwise then you can specify the x is equal to 1 so there you can see we specified it here and now let's check the result and there you can see we got the mean equal to 1A 3 so that's how you can take mean in Tanger flow and now let's see how we can generate tensors with random value in tenser flow So Random values are frequently required When developing neural networks so in actual when we create neural networks for training our model the neural network consist of a lot of variables and at start we need to initialize those variables with random values so there we can use these functions of taner flow to create those random values so here to create tenser with random values we can use this tf. random. normal function and then inside it firstly you need to specify the shape of the tenser which you want to generate like if we want to create a t with three rows and two columns then you can specify it like this and then you can also control the values which are being generated by specifying the mean and the standard deviation like if you want that the mean of the values which are being generated is 10 then you can do it like this and if you want to specify the standard deviation then you can also specify it with the help of this variable and after that you can specify the data type of the variables which will be generated so here we specified float 32 so now let's run it and look at our output tenser so there you can see we got a tenser here and it contain three rows and two columns and this data is generated randomly so let's run it again and you will see different values here so there you can see that and if you want to create random values and you want to make sure that the random values are between a maximum and a minimum value then then you can use this random. uniform function and here firstly again you will specify the shape and then you can specify the minan and the max value like if you want to make sure that the random value will be between 0 and five then you can specify the minan value to zero and the max value to five and after that specify the data type so let's run it and see the output so there you can see we got this output here and there you can notice no value is left less than 0o or greater than five similarly you can try these functions by adding different shapes and different ranges and if you are generating random values and you want to make sure that the next time you will get the same random values then you can do that by setting a seed value so here we are using this tf. random. set seed and then you need to specify a value here and after that when you are going to run this uniform function and you are going to generate random values you will notice that upon running this cell again and again we are getting the same random values so here let's run it and now look at the values so now when we will run it again and you will notice we are getting the same values here and the reason is we have set a seed and this seed will going to repeat the random values which were generated for the first time so that's how you can create or Generate random values in Tanger flow and now the next step is adding two tensors so if you want to add two tensors element wise then you can use the plus operator here so we created this V1 and V2 here so now if you want to add first element of V1 with first element of V2 and second element of V1 with second element of V2 then you can use this plus operator here so let's run it and there you can see the result contain 5 comma 5 because adding this three with two we got five and four with one we got five and if you want to concatenate two ters which means that apart from adding the values you want to add the rows or the columns then you can do that with the help of concat function so here we created two tensors and they both contain two rows and two columns and now if you want to concatenate V2 and V1 then you can use this concatenate function and here in the values are you need to specify the variables which you want to concatenate similarly here you can specify more than two variables as well and then you can specify the AIS along which you want to concatenate them so here we specified the XIs zero which means that we want to concatenate them by columns so for now both V1 and V2 has two rows and two columns but after concatenation the resultant answer will going to have two columns but four rows so let's run it and there you can see it is concatenated column wise so now there are four rows and two columns and if you want to concatenate them rowwise then specify the x is one so let's run it we got two rows and four columns so that's how you can add two tensors or concatenate them rowwise or column wise and now the next operation is finding minimum and maximum value of a tenser so here we created a tenser flow light variable so now if you want to get the maximum value then you can get it using this tf. org Max function so here specify the variable in which you want to get the maximum value so let's run it so there you can see it return three here but three is not the maximum value present in this array basically it is returning the index of the maximum value so as five is the the maximum value and it is present at the index 3 so it returned that index and if you want to get the minimum value then you can get it using this tf. argain so now let's run it and look at the output so the output is one and the reason is in this array the minimum value is two and it is present at the index one so that's why we are getting one here which is the index of minimum value so that's how you can get minimum and maximum element of a particular tensor and now the next section is saving and restoring tenser values using a checkpoint so what is a checkpoint so when we train a machine learning model our trained model consist of thousands of variables and that trained model is using those variables to make predictions and while training the model we are basically calculating the values for those variables so in the process of model training tring we are calculating the values for thousands of variables and now while training our model for storing those variables temporarily so that we will have the backup we use checkpoints in Tanger flow so a checkpoint in tenser flow is used to store the progress of model training during our model training process or in other word it is used to store the value of thousands of variables during model training so now let's see how we can create checkpoints in taner flow so here we are creating a taner flow variable and now we are going to store it inside a checkpoint and to do that we will use this tf. train. checkpoint and then in the parameter we will specify our variable which we want to store in the checkpoint and after that we will call this checkpoint do save function and then we are specifying the name of the checkpoint so now let's run this cell and after that this array or variable will be stored inside checkpoint and when you will expand this file pan you will be able to see this checkpoint here so it created these files while storing this array and now if you will print this save path you will get the path here and after that let's assign a different value to this variable which we firstly created so instead of this 1 2 and 3 4 we are going to change the values to Z and then we are printing it so let's run it and now you can see our variable contain the value zero but we have also stored the previous values of this variable inside a checkpoint and now we are going to restore those values so using this checkpoint do restore and then we are going to specify the path here and it will going to restore the values in this variable which we stored in the checkpoint so let's run it and now let's print the value of variable again and there you can see again our variable contain the values 1 2 3 and four and the reason is we have stored the state or the value of this variable inside a checkpoint and after that we have changed the value of the variable but as we have kept the backup or created checkpoint for our variable so at any point we can restore that value so here we restored the value the variable using the checkpoint and now our variable contain the original values and the same mechanism is applied while model training so we are storing the progress of model training inside a checkpoint and after that if while model training there is any error or any problem then we can restore the values or the progress of model training at any point so hopefully you got the idea about the use of checkpoints in Tanger flow that checkpoints are used to store the progress of model training during training any machine learning model welcome to this lecture in this lecture we will look at the basic introduction of taner Flite so what is transer Flite it is an open- Source library for on device machine learning so it lets you run machine learning models on mobile devices without any internet connection so it means that using this Library we can run machine learning models inside our mobile applications without any internet connection so we can take advantage of this library to do classification regression or anything else you might want without a round trip to a server so let's understand the use of this library with the help of an example so let's say we want to train a machine learning model to recognize different fruits like like we want to recognize orange pineapple apple watermelon and banana so to train this model we are going to collect the images of these fruits and pass them to our machine learning algorithm and now we will get our trained machine learning model so now this train model can be used in desktop and web applications but it cannot be used in mobile applications because the processing power of mobile devices is quite Limited so there we cannot perform all the operations which we can perform in desktop or web applications so in order to use this train model inside of our mobile application we use this taner Flite Library so with the help of this Library we convert our model into a TF light format and now we can use this TF light model inside our mobile application similarly you can understand the importance of Tor flow light with the help of this diagram so there you can see we got this box which is indicating a train taner flow light model so this is our train model which we can use on desktop or web but we cannot use it inside mobile so now here we use the converter of this transer flow light library and it converts our model into this TF light format and now we can use this model inside our mobile applications like here we can use it inside Android or iOS and and inside both applications for using this model we got this thing with the name interpreter so this is a taner flow light interpretor using which we are going to load this model inside mobile application and then pass input to the model and get the output so here there are two important things this taner flow light converter which converts our model into this DF light format and then this standard flow light interpretor which is used to load the model inside our mobile application and now let's look at the biggest advantage of this Library which is machine learning at the edge so what does that mean so as mentioned earlier that by using this Library we can perform machine learning inside mobile applications without any internet connection and the reason is that our machine learning model is present in the application itself so we don't need any internet connection to access that model and this thing is called on device machine learning or machine learning at the edge of the network and there are number of advantages of this own device machine learning and the first one is the latency so by latency we mean that the time needed to pass input to the model and get the output so as now our model is present in the application itself so we can quickly access it and get the output so the latency of our application will be low which means that that we will get the results faster similarly the second Advantage is privacy so as there is no data which needs to leave the device so the Privacy will be improved and the next Advantage is connectivity so as our machine learning model is present in the application itself so we don't need any internet connection to access it and the fourth Advantage is power consumption so as we are not using any network so our power consumption will be low which means that our application will not be resource heavy so these are some additional advantages which we get by using this library and the advantage of tensor flow light library is not limited to just Android and iOS but if you get your trained model in Tor Flite format then you can also use it in Raspberry Pi microcontrollers and armm based systems hello guys Hamza here I just want to let you know that this video is just first few hours of my complete TR and taner Flite models for flutter course the complete course is about 5 hours long and it includes all source code which we write in this course every section has before and after source code so you can easily code along with me apart from that you will get a certificate upon completion which you can add to your resume and the course comes with a 30 days money back guarantee so if you are not satisfied just ask for a refund so if you are interested I will put a link down below and I am offering a discount to first 100 students so enroll now before it's too late now let's continue to the next lecture welcome to this section in this section we are going to train a very simple linear regression model and build flutter application using that model and we are training this very basic model and building flutter application so that you can get familiar with the process of training machine learning models and using them in flutter applications so what is the model which we are going to train inside this section so we are going to train a very simple model on this particular data set so you can see there are two columns in our data set firstly this is input and then this output and if the input is 10 then the output is 19 and if the input is 20 then the output is 39 and if the input is 30 then the output is 59 and so on so we have such data set where there is a particular pattern between input and output and as machine learning is all about pattern finding so here the pattern is each output is equal to 2 into input minus 1 so there you can see each output is equal to 2 into input minus one and you can check the values of output so this is a particular pattern in our data set and machine learning algorithm will need to figure out that pattern so we are not going to tell that pattern to our machine learning model but our model will going to figure that out during training so when we are going to pass this particular data set to our machine learning algorithm it will try to figure out the pattern between input and output so we are going to train our model and after that our train model should be able to return us a similar response like if after training our model we will pass 3 to it then it should return 2 into 3 - 1 so it should return a value around five so that will be considered a correct output but that will be only possible if our model successfully extracted the pattern from this data set and after training our model we are going to use this train model inside our mobile application and now inside that application when we are going to pass input to our model it will going to predict the output based upon the pattern it discovered while training so if we are going to pass input is equal to 5 then our output should be close to 9 but this will be only possible if our model is trained well and now inside the section we are going to train that model and then we are going to test that model inside our filter application so let's start welcome to this lecture in this lecture we are going to train our first machine learning model of this course and then we are going to convert that model into a taner flow light format so that it can be used in mobile applications so let's start so the first step is getting the code for for training our model so you need to open course resources and there go to the basic example folder and inside it you will find this regression basic example notebook file so just open this file inside Google collab and you will be able to see this code and you can also get the code of this notebook from the resources of this lecture as well so once this notebook is opened you will be able to see this code and now let's start raining our first model so to train our model the first step is importing the libraries which we are going to use so as earlier we have learned about different libraries like tanzer flow numai and pandas so now here we are going to import fuel so firstly we are going to import taner flow because we are going to use this library for training our model so we are importing it SDF and after that we are importing numpy because we are going to use numpy for creating our data set that so we are importing it as NP and then from this transer flow Library we are importing a module called kiras and by using this kiras module we are going to create neural networks of our model and then we are importing this light module from tensorflow and using this light module we are going to convert our model into a tensorflow light format so that we can use it inside our mobile applications so here let's run this cell so that our Li liaries will be imported and there you can see the execution of this cell is completed which means that the libraries are imported successfully and after importing the libraries the next step is preparing our data set so as in the introduction video of this section you have learned that we are going to train a very simple model where we will have single input and a single output and the relationship between the input and the output will be that each output is equal to 2 into input minus one so here we are creating the data set using numi and there is the same relation between X and Y so each value of y is actually 2 into x value - 1 like here you can take this last value of x so when we will multiply 2 with four we will get 8 and after subtracting one we will get 7even and same is the case with all values of Y so the relationship between X and Y will be that each y is equal to 2 into X - 1 so here firstly we are creating the X array using this np. array and after that we are specifying the values and then we are specifying the data type of the values and after that we are creating the Y array as well so now let's run this cell so that our data set will be ready and after preparing the data set the next step is creating our model so as we have learned about deep de learning or artificial neural networks so we are going to train our model using those artificial neural networks and to do that firstly we are going to create our neural network and as we have learned that a neural network consist of different layers of neurons and each layer has one or more neurons inside it so here to create our neural network we are going to use this Kira's package which we imported from tanzer flow library and then we are using its sequential function and now inside this function we need to pass an array and in this array we are going to specify the layers of neural network so you can specify as many layers as you like like here for now we have specified a single layer of neurons inside this array and that layer is created using this kiras do layer. Dan function and inside this layer we have specified that there will be only one new neuron and the input received by this layer will also be one so we specified the input shape equal to one as well so that's how you can create a layer of neural network using kiras and then you can specify that layer inside this array and if you want to add one more layer then you can simply add a comma here and repeat the same thing here and then you can add more layers if you want but for now we are training a very simple model so we are going to use a single layer of neural network and that layer will going to have only one neuron so here with the help of this first line we are creating our neural network or our model and inside our neural network there is only one layer and inside that one layer there is only one neuron and we are assigning that neural network to this model variable and after that we are calling this model. compile function and here we are specifying two things firstly we are specifying this Optimizer and then this loss so as we have learned about this loss function that this loss function is used to calculate the difference between predicted and actual value so when we are training a machine learning model or a deep learning model then during training We compare the predicted values of the model with the actual values and then we find the difference between these two values and this difference is calculated using this loss function and our goal is to minimize the value of this loss function as our model is being trained so at the start the value of this loss function will be bigger but at the end of our model training the value of this loss function should be smaller and the reason is this loss function is indicating the difference between predicted and actual values so at the end of model training there should be very small difference between predicted and actual value otherwise our model is not trained well so that is the function of this loss function that it is giving us the indication or the difference between predicted and actual value and then we specified this parameter with the name Optimizer and we specified the value equal to SGD and it stands for costic gradient descent and the role of this Optimizer is to update the weights of neural networks in such a way that the value of this loss function will going to decrease as our model is being trained so during training our model we are passing our data set to the algorithm and the algorithm learns from that data set and while learning the weights of the neural networks or the neurons are being updated so this function is used to update those weights in such a way that the value of L function will going to decrease or our model will going to learn from the data set so now after calling this compile function our model will be ready for training so let's run this cell so that our model will be created and compiled and after that the next step is training our model so to rain our model we are going to use this model. fit function and now inside it we are going to pass our data set so firstly we are passing the X array which is the input value and then the Y array which is the output and after that the third parameter is the number of epex so as I explained earlier this number FP means that while training our model we are going to pass our data set to the algorithm 500 times and if you are going to change the value to like thousand then it means that during training our model our data set will be passed to the algorithm thousand time and our model will be trained so now let's run this cell so that our model training will going to start and it will going to finish in just few seconds so there you can see the progress and there you can see in just 8 seconds our model is trained and the reason is our data set is very small with just few values and our neural network is also very simple with just one layer and one neuron and now during training the model our data set was passed to the algorithm 500 times and each time the data set was passed you can see an entry there so here let's scroll to the top when our model training started so there you can see the first EP so this was the first time when our data set was passed to the algorithm and there for each time you can see the value of loss function and as mentioned earlier that if our model is being trained well then the value of this L function will going to decrease as our model training will going to proceed so there you can see for the first epic the value of L function was 20 and it was 16 for the second epic and 12 for the Third epic and then you can notice that for each of the Epic the value of this L function is decreasing and even at the end of our model training you can notice that the value of this loss function is very small so you can see the value of loss function for the last epic is 4.39 power minus5 so it means that the value is decreased a lot and our model has learned from the data set or it has actually found the pattern inside of data set so now after training the model the next step is testing the model and while testing we will get to know that whether our model is trained well or not so as you know that the pattern inside our data set was each y is equal to 2 into x -1 and now if our model has figured that pattern out so when we are going to pass an input value then we should get an output which will be 2 into input minus one like here we are using this model. predict function and passing a single value as input which is 100 so now our output should be close to 2 into 100 - 1 which is 199 so let's run it to check the output and there you can see our output is 198.23 so it means that our model is trained quite well similarly Let's test it for some other Val like 20 and let's run it and there you can see our output is quite close to 39 which is the actual value so it means that our model is trained quite well and we have verified that thing during testing and after testing the model the next step is converting our model into TF light format and to do that we are going to use the light module of torf flow Library so here we are using this tf. light. TF light converter Dot from Kira's model function and inside it we are passing this model which we just trained and now it will going to give us a taner flow light converter object and after that we are calling this converter do convert function and it will going to convert our model into TF light format and after converting the model and getting it in the form of this TF model object the next step is storing this model in the form of file so here we are opening a file with the name linear. tfight and here you can specify any name that you like and we are opening that file in WB mode and WB stands for writing in a binary mode and we have learned this thing while covering file handling section of Python programming language and now we are using it so after opening this file in a binary mode we are writing the content of this DF model inside this file so now when we are going to execute this cell our model will be converted and it will be stored in a file named linear. tfl and there you can see the output so now when you will check this files pin you will be able to see this linear. TF light and this is the model which we just trained and converted it into a TF light form me and now if you want to download that model you can simply click on this download button and our model will be downloaded so there you can see that and the size of this model is just 1 KB because it is a very simple model with just a single layer and single neuron so that's how you can train a very simple linear regression or machine learning model and then convert it into a tensor flow light format so now let's simply review the process for training this model so to train our model firstly we imported the libraries which we are going to use and after that we have created a very simple data set which contain a single input and single output value and in future when we are going to train our Advanced machine learning models then we are going to use large data sets where there will be thousands of rows inside of data set and also multiple input columns but for now we are training a simple model so we got a single input and a single output and after preparing the data set we are creating our neural network and here here we are specifying that we want to create such neural network where there will be one layer of neuron and inside that layer there will be only one neuron and after that we are specifying the optimizer and loss function so this loss function will going to indicate the difference between predicted and actual value during model training and this Optimizer will going to function in such a way that the value of loss function will going to decrease during model training so after creating our neural network we are training our model by passing input and output value here and then we are specifying the number of app and you can also try to change the value and check the model result because it is a parameter which will going to affect the performance of our model so here you can try to change the value to like thousand and check the model performance so now after training the model we are testing the model here byp passing the input values and then we are converting our model into TF light format and writing it into a tfight file welcome to this lecture in this lecture we are going to build our first flutter application in which we are going to use a regression model and the model which we are going to use is our very basic model which we trained earlier so now we are going to use that model inside our flutter application and then we are going to test it so let's start so to do that we are going to build build a new flutter project so open your Android studio and click on this new project button after that click next and then here you need to specify the name of your project like I will name it basic regression and after that you can select the location and then you need to click on this create button and your project will be created so there you can see our new flutter project is created so after creating this project project let's firstly install the stter application inside an iOS simulator and see what does that stter application contain and after that we will build the GUI of our application and then we are going to integrate that regression model so I will install this application inside an iOS emulator similarly if you want to you can also install it inside an Android emulator so now our application is installed inside the emulator so that is the St application which we got by creating a new project and here when you will click on this plus icon this count will going to increase so now after running this application we are going to build the GUI of our regression application so as you know that we have trained a very simple regression model where we are passing a single input to our model and it is returning a single value as output and the relationship between output and input is each output is equal to 2 into input minus one like here if we are going to enter three then it will going to return us an output close to five so now for testing that application we are going to add a text field inside this application where user can enter his input number and then we are going to add a button so that when the user will going to click on that button we are going to take the number which he entered here and pass it to our model and the third thing which we are going to add is a Tex widget where we are going to show the predicted result of the model so that will be the GUI of our application that it will going to have a tax field a button and a tax wget so now let's start adding them inside our build method so in this application code scroll down and you will see the code related to GUI inside this build method but now you can remove everything which is present inside this column widget so here in the childrens of this column widget I am going to remove both of the text widgets similarly we can also remove this floating button because now we don't need it and after doing that when you will press contr s and you will look at the application now you can see the text and buttons are gone and after removing them we are going to add a text field where user can enter his number so here we are going to add a text field so text field and now in this text field you need to specify a controller using which you are going to get the text which user have entered inside that text field so in order to set that controller we are going to create one above this build method so here above this build method now you can remove this code because we are not using it and then you can create a text editing controller so text editing controller and name it number controller and then we are going to initialize it so text editing controller and that's it so after initializing it we are going to pass this controller here so pass number controller here so now after specifying the controller press contrl s and look at the application again and there you can see we got this line or basically we got a text widget here and now you can type anything here so now after adding this text feed let's set some hint text because for now when user will not going to enter the number it will be empty so instead we will display the hint that enter your number here so in order to do that we are going to set a decoration property and then we are going to set this input decoration and inside this input decoration you can set the hint text so there you can see this hint text property and we are going to set the text type here and now after doing this press contrl s and look at the application again and there you can see we got our hint here and after doing this let's also add a button so that when the user will going to enter his number here then he can press on it and we are going to pass that number to our model so here after this text field we are going to add an elevated button so elevated button and inside this elevated button we are are going to set an on press listener so this on press listener will be executed whenever user will going to click on this button and the second thing which we are going to set is the text widget so here we are going to display the text on this button which is PR and after doing that press contrl s again or command s again and you will see now a button is also visible here and after adding this text field and this button here the next thing which we are going to add is a Tex widget where we are going to show the predicted value of the model So Below this elevated button we are going to add a text widget and now in this text widget we are going to show the result so for now we are going to create a result variable above so here we will declare and initialize a result variable and inside it we are going to show results to be shown here and after after creating and initializing this result variable here we are going to pass it inside our text widget so here we are going to pass this result and that's it so now press command us again and look at the application so now you can see we also got this text here so for now inside our application GUI we added this text field where user will going to enter his input number and then he will going to click on this button and after that we are going to take that number and pass it to our model and then our model will going to return the result and we are going to show that result in this text widget but we are going to do that inside our next lecture but for now we have created a very simple UI for our first regression application welcome to this lecture so far now we have created a new flutter project and we have built a very simple GUI for our regression application and and now we are going to start the process of integrating a TF light model inside flutter so to integrate that model inside our flutter application we are going to use a package called TF light flutter so we need to add that package inside a v project so to do that open your browser and go to Google or you can simply type pub. D in your search bar and once you will do that this site will be opened and here you can and search for this DF light flutter package so type it and then enter it and there you can see the result that the first result is this T of light flutter and the popularity of this package is 98% so just click on it and then click on the installing section so that we can add the dependency and here just copy the line of this dependency and then open our project and here open this ppec rml file and then paste the line in the dependency section so here I will paste it below this dependency after that click on this pubg so that the library will be downloaded and added inside our project and there you can see the library is downloaded successfully so after adding the library go to the read me section of the documentation page and here we will read the instructions for using this package so firstly when you will scroll down here you will see the instructions so in order to load our model using this package we need to create a Tor flow light interpreter and then we need to specify the name of the model which we want to load but this thing will be possible once we will add our model inside our project but for now we did not added our train model in this project so to add your model inside this project we need to create a new folder so click on your project name and then press press control click and you will see the option to create a new directory so just select it and now name this directory assets and after creating this directory you need to find your model and put it inside this assets directory or you can also check the course resources and there you will find this linear. TF light file so you need to copy this file and then you need to paste it inside this assets folder so here I will paste it and after pasting it here we need to declare this assets folder inside our pubs spc. uml file so here scroll down and you will see this section commented out about assets so just select it and uncommented and now you should be careful about the spacing so correct the spacing so that it matches with this one and after that as we did not added any images folder so you can remove the these lines so firstly I will remove this and after that I will not remove the second one but I will edit it so here I will rename it to assets and then you need to correct the spacing so just press so just click here and add one backspace similarly after the name add forward slash and now we have declared this assets folder inside our pspec uml file and inside this folder we got our model so after doing that click on this Pub get so that that you can confirm that we have done this change correctly and there you can see we did not get any error about the formating of this pubp rml file so now we have added our model inside this project and we have also declared the folder where we have added our model in the pubs spect rtml file and now after doing that the next thing is loading our model so that we can pass input to the model and get the output and to do that you need to open the documentation page of the library and here you will and here you need to copy this line where we are creating this interpretor so we are going to copy this line and open our application and here go to our main do do file and now above our build method we are going to create another method with the name load model and inside this method we are going to paste the code that we just copied and now now you can remove this dfl because we did not edit the import yet and after removing it you will see two errors so firstly we need to make this method a synchronous because we are adding a weit keyword here so this thing will going to take some time so that's why this method should be executed asynchronously so click on this await button and then select this option add asnc keyword so there you can see this keyword is added and after that we need to add the import for this interpreter so just click on it and then import Library TF light flutter and once you will do that the error is gone so now you can see we are creating a Tanger flow light interpretor using this interpretor Dot from assets function and now here you need to specify the path of your model so as we have put our model in the assets folder but our model name is linear. so change this your model to linear. TF light and if you have named your model something else then you can pass it here and after doing that we need to call this load model function somewhere and we are going to call it inside in it state so as whenever application will be created and user will going to open it the first method which will be called is this init state so here above this load model function we need to override that in it State function function so what you can do is to add an override keyword and then you can create this in it State function so in it State and then add the body for it and that's it so now when this screen will be visible inside your device the first method which will be called is this init State and inside it we can call this load model function and our model will be loaded whenever our application will be installed and that's screen will be visible but there you can notice that we are declaring and initializing this interpreter inside this load model and by doing it we cannot use it outside of this load model function so that's why we need to declare it outside so here I will simply copy this interpreter and then remove this final and after that below this result variable I will declare this variable with the late keyword so late VAR and then I I will paste this interpreter here and that's it so now we are declaring this variable here and initializing it here so now after loading our model the next step is passing input to this model and getting the output so as inside our application we got this text field so when the user will going to enter the number here and he will going to click on this predict button we need to get that number and pass it to our model and there you can see in this elevated but we have set this own press listener but here we are performing nothing but now we need to get the number which user have entered in this text field once the user will going to click on this button but we are going to do it inside a method called perform action and we will create that method Above So after calling this method here we are going to declare it below our load model so perform action and then inside inside this method firstly we are going to get the text which user have entered in this text field and to get it we are going to use this number controller so number controller. text Will going to return us that text and after that we are going to convert that text into an integer or a float value so here for now use this integer. parts and then inside it you can specify this text so here I will specify it and then we are going to assign that integer to a variable so let's name this variable X and now after getting the text which user have entered we need to pass this text to our interpreter or to our model and get the output and to do that you need to open the documentation page of the library and here scroll down and you will find this section where we are performing inference and inference is actually the process of passing input to the model and getting the output so you can copy the code which is present there and open our application and here below this x you can simply paste it and now let's look at it so here firstly we are creating an input array in which we are passing input values and after that we are creating an output array and then we are calling this interpreter. run function and here we are passing both input and output array and the purpose of this interpreter. run method is is to get the input value and pass it to our model and after that it will going to store the output which our model returned in this output variable and then we are printing that output variable here but as in our case our model is taking only single value as input and it is returning only single value as output so here we need to make few changes so firstly we are also going to create this input array but inside this input array we are going to pass only a single value so here we are going to pass our X variable and after that we need to specify the output array where the output will be stored and as you know that our model will going to return only single output so there we need to create an array which will only going to store a single value but here we are creating an array where one row and two columns will be present but our output will be a single value so what we can do is to change this two into one or in other word we are creating an array where there will be only one element and it will be filled with zero by default and then we are reshaping it to a 2d array where only one row and one column will be present and here it's important to reshape our list into this shape one row and one column because our model is expecting a 2d array where he will going to store the result although it's a single value but still we need to pass this 2D array where there will be only one row and one column so it means that only one value will be stored in this output variable so here after creating our input and output array we are calling this interpreted or run method and passing this input and output so now this run method will going to take the input which user have entered in the text field and it will going to pass it to our model and after that our model will going to calculate the result and then it will going to store the result in this output array and then we are printing the value of output so now to confirm the working of our application you can simply click on this run main do Dot and if you did not previously completely install the application again after adding the library then I will recommend to click on this top main do Dot and then install the application again but for now we will click on this green button and now our application will be restarted so now our application is restarted so here we are going to enter an input value like eight and click on this predict button and after that you can check the Run section and there you can see we are getting a value as output and this value is close to 15 and as we have entered 8 here so our output should be 2 into 8 - 1 which is 15 and this value is quite close to 15 so it means that we are getting the prediction correctly but for now we are showing the result in the console but we need to show it inside our application in this text V so to do that here we are going to assign the result to our result variable so result and then firstly we are going to store result and after that we are going to show the value which is stored inside this output so output and then we will specify the row index and then the column index because this output is a 2d array and after doing that you need to call set State block and pass the result variable here and we are doing this so that wherever result variable is being used the changes will apply and we are using this result variable in this tax vet so now it means that we will be able to see the result here here but here before running our application we need to do one thing and that is as this output list is of type double so we need to convert this value to a string so we will call this two string method and that's it so now let's install the application again or hard reload it again and then we are going to test it so now our application is hard reloaded so let's enter a value here like I will add 10 and then click click on this predict button and there you can see we got the result and the result is .98 which is almost 19 so it means that we are able to load and use our model successfully inside our flutter application and as that is a very basic simple model so we have done it quite easily but later we are going to use Advanced regression models inside our flutter application but for now let's enter some larger value like 10,000 and click on this prct button and there you can see again we got quite accurate value which is close to 20,000 similarly you can test this application by yourself welcome to this lecture so far now we are able to load a very simple regression model in flutter and we are able to use it so now in this lecture we will quickly review the process that how we have done that or how you can load a regression model and use it in flutter so to load that model and use it in flutter we are using a package called tflight flutter so firstly inside our pbs. uml file we added the dependency for that library and after that we have added our model in this project inside this assets folder and then we declared that assets folder inside our pspec rml file and after that to load that model we are creating a torf flow light interpreter object and here we are passing the name or path of our model so once this code will be executed our model will be loaded and after loading the model the next step is passing input to the model and getting the output and to pass input to our model you need to know that what is the shape of model input and output so as our model was taking a single value as input and a single value as output so we are creating this input array and we are passing a single value here and then we are creating an output array where only single value can be stored and then we are passing both input and output array to our interpreter and it will going to pass input to the model and store the output returned by the model in this output array and then we are getting the value stored here and showing it to the user so that's how you can use a very simple regression model in [Music] flutter hello guys I'm are here I just want to let you know that this video is just first few hours of my complete TR and taner Flite models for flutter course the complete course is about 5 hours long and it includes all source code which we write in this course every section has before and after source code so you can easily code along with me apart from that you will get a certificate upon completion which you can add to your resume and the course comes with a 30 days money back guarantee so if you are not satisfied just ask for a refund so if you are interested I will put a link down below and I am offering a discount to first 100 students so enroll now before it's too late now let's continue to the next lecture
Info
Channel: Mobile Machine Learning Academy
Views: 2,029
Rating: undefined out of 5
Keywords: machine learning in flutter, machine learning using flutter, how to connect machine learning model to flutter, deploy machine learning model in flutter, flutter machine learning, tensorflow lite flutter, flutter full course, flutter crash course, flutter mobile app development full course, flutter advanced course, flutter course 2024, flutter best course, tensorflow flutter, tensorflow flutter app, tensorflow flutter tutorial, flutter machine learning course, flutter tutorial
Id: sDNLhSg8MQo
Channel Id: undefined
Length: 187min 4sec (11224 seconds)
Published: Fri Feb 09 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.