Hello.
And this will you.
We will create a very simple single Perceptron model to classify flower species depending on their Bitel
length and pattern.
We will be using a Skillern to create this single Perceptron model.
In the latter part of this course, we will use Get US and 10 SAP flow to create multi-level Perceptron
models, as Skillern is a very popular machine learning liablity for Python.
It is the go to library to create regression classification decision trees or as we are models, we
have separate lectures on all this machine learning models.
So if you are interested in learning any one of these, you can go ahead and check out what courses
on regression classification be Sentry's and SVM.
So let's start first.
We will import numbers and find us.
Now, if you have installed Anakonda.
There is no need to install a skillern separately.
You just have to import Eskinder.
But in case you are facing any error in importing a Skillern, you can install it using BEP or Condah
installed.
So just run this.
Come on, Pip, install a Skillern in your command prompt.
You can open your command prompt by pressing windows odd and write CMB and that one come on and hit
enter there in the command prompt.
You can write this code and execute it to install Escalon.
What else you can directly lead on this code?
And despite the notebook and this will also install Escalon for you.
So if you have installed a Skillern.
First, we will load iris data.
There are various CSP files out there.
You can also import those see as we file to load this data.
But as Skillern have some predefined datasets and we will load our ideas data from there.
So just right from Eskil under datasets.
Import load.
Underscore itis.
And then we are saving the world IRI's data into this variable iris.
So just run this.
Now, let's take a look at the data, you can see there are four columns.
To call, said Sepur Land Sepúlveda by the land and Paton's with, as I have said earlier this year,
data of different types of flowers.
There are three different types of flowers, Sentosa.
What's the color virginica?
And for each of this flower, we have their Sepur length Sepúlveda.
But the length and petals.
So here we have this four variables and that category is stored in Iris Dort Target.
So in our example, we want to create a Perceptron model which would identify whether the flower what
is Sentosa or not using by Dalvik and by the length as the independent variables.
If you want, you can take all the four variables.
But for example, we are just taking these two variables to predict where the flower is Towser or not.
So we want our independent variable to be this petal length and petal look.
We will store this information in another variable which we are calling X.
We are defining X as itis DOT data.
And here we just want the third and fourth column.
That's why we have returned to comment three.
If you remember, the indexing starts with zero.
So the last two columns are two and three.
Just run this.
So over X variable is now ready.
Now let's just look at the target variable.
Here you can see we have different categories, zero one and two zero percent for Sentosa.
One sentence for what Ziggler and two stands for Virginica.
Now, if you have some machine learning knowledge, you may know that to create classification more
than what y variable should be in the form of zero and one.
So ideally we want one and all these records where the flower is set, Oza and zero and all this records
where the flower is vertical or virginica.
So let's just convert this target, we able using some basic operations first.
Let's convert this target variable in the form of true and false.
We want to where the flowery sentosa.
That is the value of target is zero.
And we want false where the flower is Virginica or Cicala.
That is the numerical value is one or two.
So let's just blend this.
Come on.
We are just checking whether the target is equal to zero or not.
If the target is zero, we will get group.
And if the target is not equal to zero, we will get false.
Let's run this.
Now let's look at our very well.
You can see we have converted zeros, two crew and one or two boot false.
Now, in the next step, we want to convert this windfalls falls to one zero.
We want one in place of all.
And we want zero in place of false.
So we will just use as type method and we will convert it to.
And so just on and on look at our way variable.
So as you can see now, our way variable is an array with one and zero.
One means that Dorsa and zero means not sentosa.
Now let's look at our X variable before creating a Perceptron model.
You can see our X variable is a two dimensional array with by the length and patella with.
No one would extend Liberty Bell, said Brady.
We just have to create our Perceptron model and dream that model using this X and Y variables.
We can create a single Perceptron more than using a Skillern, but to create MLP on my level, but it's
separate more than we have to use Cadeaux Intensive.
We will be looking at l.P in the later part of this Goetze.
But now we will create this sub growth model using Escalon only.
Now first we need to import Perceptron from Eskil and Autoline anymore.
Then let's just import it.
And you can also look at the documentation using this link.
This Dubai term notebook is also shared in the resources section of this video.
So you can download it and learn it if you want to practice.
So this is the official document of Perceptron in Skillern.
You can look at all the parameters which we can give, the first one is the penalty.
If you remember, in linear regression, there are regularization terms, L1, a clue also known as
LASO and Rich.
You can also give us a thought that is the variable we use for regularization.
Then there are different other hyper parameters.
We will just stick to basic before hyper parameters.
But you can look at it if you want.
These are just some very basic parameters that we get with most of the machine learning algorithms.
Now, as with any other on machine learning, more than we first have to create an object of that algorithm,
then we have to fit over X and Y variables and to that object and then we can use that object to predict
the future values of way.
So first, let's create an object that is Perceptron classifier.
We are naming Autobody Willis, but underscored see L.F. and then we are using Perceptron that we have
just imported and we are giving only one hyper parameter.
That is a random mistake to equate to 42.
This is basically to reproduce the same result whenever we run this model.
So if you give random set, you will always going to get the same result.
Giving this hyper parameter is not mandatory.
You can skip that also if you want.
And in the next lane, we are putting our X and Y variables into this object.
So let's find this.
So what model is screened?
You can get the values of before you type in.
But I might add here if you want.
Now, let's clear the value using overclassify, our object.
We can just use DOT, predict my.
So this is the word object and we are using DOT predict and we are giving our independent and variable,
which is X as an input.
Let's do that.
You can see this are the predicted values.
We can compare this predicted values with the actual values.
There is no need to manually do that.
That isn't another function.
That is accuracy scored available in Escalon, which will give us the accuracy of what prediction accuracy
score vary between zero and one zero means zero percent accuracy, which means all the predictions are
wrong.
And one means hundred percent accuracy, which meant all the predictions are right.
So let's just first import accuracy score from a scalar, not my cricks.
And then we are going to use accuracy score.
And here there are two arguments.
First, we have to provide the actual values.
And in the next argument, we have put away the predicted values.
So what actual values are restored in just five variable?
And the predicted values?
We have restored in VI underscore pride.
So let's get the accuracy score of forward predictions.
So the accuracy here is one that is hundred percent accuracy or what?
Perceptron was able to identify the speci of the float with 100 percent accuracy.
Now, this is a very simple model.
Usually we don't use Perceptron for any regression or classification tasks.
We usually go for machine learning techniques where the data is not falling.
And in context, Petten and we use really well for an LP.
We're.
The details following a very complex pattern.
Usually you will never find yourself using Perceptron and business settings.
But this is just an introduction.
And we want you to give just some basic idea about running Perceptron models using Escolar.
Now, after training your mother, you will get these two attributes.
That is the coefficient.
And then Sept.
Basically over Perceptron is dividing this space using linear regression line.
So this is the coefficient.
And this is the intercept of that line.
So your equation of that line will be four minus one point four times by the length minus two point
two times.
But Elphick.
So if you want to create that line, you can use coefficient and intercept values to do that, and you
can also see the impact of our different variables on the Y variable.
So this coefficient is giving you the impact of each of those variables.
This is the impact of the land and this the impact of pattern.
That's all for this lecture.
Next, we will look at tensor flow and get us to create our MLP model.
Thank you.