Visualizing Data Part - 1

 Let's talk about features, how can they be visualized.

Do you remember Cartesian plane we studied in our school days? Am pretty sure you do.  A simple plane or space where we can represent our data. Consider a Cartesian plane having x axis and y axis .Now if we plot a data as (3,4) then we are aware that 3 is nothing but 3 units towards x axis from origin and  4 represents 4 units towards y axis from origin. And this point (3,4) is nothing but a scalar term so we used cartesian plane.


But in ML we deal with features as a vectors so we need to know Vector Space. And if you know Cartesian Plane  then Vector Space/Plane is simply the same but with high dimensions representations capability.
 
Okay now that we are cleared with terminologies let's move forward.

Consider that you have been given a task of classifying girls and boys on the basis of height of few students given to you . So we can intuitively say that girls have a somewhat shorter height than boys. Pardon me if I m being biased but this is just an example. So your task is to label all the students greater than some threshold value x as boys and students having heights lesser than x as girls. Over here the feature is height and labels /classes are girls and boys. This is a very simple vanilla classifier. As we have only one feature we say that we have a one-dimensional feature vector given to us.


Do you really feel that only height as a feature is a good way of classifying?? No, not at all.
Let's add another feature to make our classifier more concrete. We add weight as a feature to our already existing data with height as a feature. In order to classify we make an assumption that boys have relatively more weight than girls .
So in order to distinguish between girls and boys only height will not contribute but the combination of height and weight must contribute to classification. Our feature vector consists of height and weight so we call it a 2-dimensional feature vector.


Let's add another feature to make our classifier more robust. Mmmmm...!!!! Okay, let's take hair length as a feature. Our data has now 3 features and 2 labels, so we can call it a 3-dimensional feature vector. it's not possible to draw a 3d diagram in 2d but by our understanding, we can visualize it.
Let the third dimension/feature be in such a way that it is pointing outward the screen toward you. and the value of points closer to you are greater than that of values closer to origin.In the below figure consider that broader red points are away from origin and near to you and green points are small and are near origin . I m pretty sure now that you are able to visualize what I m talking about.

Can we add more features??? Yes, we can ...!!
But then you might wonder if we can't visualize more than 3d then how come we can have more features?
It's absolutely fine if we can't visualize it but it will do its work. Like there are many things we can't visualize but still, they do exist.
Similarly, we can have 4 features as well.
Can we have 10 features?? Yesssss...!!!
Can we have 100 features?? Absolutely yesss...!!!!

You can have as many features as you want. but a very large number of features tends to slow down the algorithm. and this is known as the curse of dimensionality. We must have an optimal number of features neither too less nor too more. Too less features will not be able to map a function properly to classify and excess features might lead to a Curse of Dimensionality. We will talk about this in later blogs in detail.


As of now, you must be able to visualize how features in a vector space look like.
Let's see how to visualize dataset in next part .

Comments

Popular posts from this blog

Covariance and Correlation

Split it up - Part 1

Why activation function is needed in Neural Networks???