Hello.
Welcome back.
In machine learning training examples are often denoted by the letter M.
We often break our training examples into two sets the training set and the test set training set is
often denoted by m subscript train and a test set is denoted by m subscript test.
We denote the number of features by n.
You can think of number of features as the number of inputs in our previous examples.
Our neural network had two features in the last example.
The features were hours of rest and hours of work out in our body builders.
Example I mean when we work in with image recognition the number of features becomes the number of pixels
in the image because we will have to find each pixel into the neural network.
So let's say we want to design a neural network for a binary classification problem.
Let's say we want to a neural network to take a sixty four by sixty four pixel image and tell us if
the image has a cat or not to store an image in our computer.
The computer stores three separate matrices corresponding to the red the green and the blue channels
of the image 64 pixels by 64 pixels each.
This means we would have three multiplied by sixty four by sixty four because each image size is sixty
four by sixty four pixels we multiply by three because we have three channels red green and blue to
turn these pixel intensity values into feature vectors.
What we would need to do is en route the m the pixel we need to row the pixel values into a vector like
this.
We simply need to take the red matrix which is a 2D array and convert it to affect or meaning a 1 D
array.
We do that by list in D.
The pixel values vertically we take the first rule we write the first value and then we write the second
value below the first value and then we write the third value below the second value.
Once we are done with the first rule we continue by listing the values of the second row in the same
vector.
We put a second rule of values under the First Rule values.
We continue doing this until we've added all the rows of the red channel.
Once that is done we move on to the green channel and then we list all the pixel values of the green
channel under the red channel.
Once that is done we do it for the blue channel by listing everything under the green one.
Once this is done then we will have twelve thousand two hundred and twenty eight features like we can
see over here.
That is why this vector.
Yes that's from 0 and ends at twelve thousand two hundred and twenty eight which is the same as this
which is the same as sixty four multiplied by sixty four multiplied by three.
We've taken this and essentially converted it to effector the training examples are put together in
a matrix denoted here as couple to X capital X then becomes our input matrix representing all training
examples and features each column in input matrix copy to x represent a single training example the
first row of the input matrix capital x represents the first feature of the training examples I should
remind you that whenever I see features you should simply think of inputs input matrix X shall be processed
by the neural network column by column remember again the columns represent each training example capital
X belongs to real numbers and the dimension of capital X is the number of features by the number of
examples the training labels shall be kept in a vector Capital Y where Y 1 is the answer to the question
is x 1 cuts or not a cut and Y 2 is the answer to the question is x 2 it cuts or not to cut and so on
and so forth why y it is the value that we predicted whereas Y is the value we expected we can see it
a y hat is the probability of Y given that we know X and this is how you write it P Y vertical line
X like that oh no network often has two parameters W and b we shall talk about something else known
as hyper parameters later on in this course W is known as the way to matrix and B is known as the bias
we compute my heart by performing at DOT PRODUCT operation between the transpose of the weight matrix
and the input matrix and the bios.
And then we apply activation function to the resort.
Now let's look at a while logistic regression loss function the loss function is simply the function
for calculating error.
The simplified lost function we saw in our previous lessons looked at is similar to this predicted value
minus expected value.
We square the difference and then multiply by half a more accurate loss function for logistic regression.
As this one over here minus brackets open why log why not.
Plus brackets open 1 minus Y bracket close and then lock 1 brackets open 1 minus Y hot.
You can post the video and take a look at it.
So this a more accurate lost function for our logistic regression.
Remember the lost function is applied to just a single training example D cost function is the cost
of all the parameters.
In other words the cost function is the average of all the lost functions.
This is what the cost function looks like.
We are adding up all the lost functions and then divide into result by the number of training examples.
This is the cost function which we'll use to train our neural network when we go to code.
So um this brings us to the end of this lesson and I shall see you in the next lesson.