Developing a Machine Learning system Part 2

The goal of every single article is reduce the gap between theoretical machine learning and applied machine learning .If you are following Learncodeonline blogs on machine learning in sequence with which they are being uploaded then you are ready to build a machine learning system from scratch. The goal of this new series of articles is build a working machine learning system which will be able to classify among three types of flowers, for simplicity of this article we will be using one of the most popular toy dataset called iris flower dataset.

Let’s first cover some statistical measures,for most of statistical measures we will be using numpy library. numpy is one of the most popular math library used in python for numerical computations.Applying same method on every flower don’t make sense so we will be only applying operations on setosa flowers.

setosa = iris.loc[iris["species"] == "setosa"];

Mean

Mean tells us about the central point where most of the data points lie , it is the measure of central tendency and denoted by .

There is a big disadvantage that comes with mean , is that it is easily corruptible i.e even a single outlier can affect the mean of the data.

Standard deviation

There is sometimes a need to check how far the data points are deviated from mean of the data i.e range or spread of data from mean , for those situations we use standard deviation as our tool of measure the spread of data.

Observation : spread of median is small and most of data points are not that much deviated from central point.

Median

Median shows the same information as mean does i.e it tell us about central behavior of the data, but the biggest advantage that comes with median is that it is not easily corruptible .The syntax for calculating median is quite simple.

Calculating median : Sort and find the middle value. in case of even find avg of two middle values.

Percentile

In-spite of regular use of percentile there is no proper definition of what percentile is , the most popular definition is that percentile shows how much percentage of scores fell under that or fell before that score. Let’s take a example , if you score 80 marks in exam out of hundred then in that case it does not show any useful information but if you say your sore is in 95th percentile then it is saying you scored better than 95% of the people . By using the concept of percentile you can check performance of a system or service , for e.g if the 90th percentile of the days taken to complete the delivery is 3 , that means 90% of the orders are being delivered in less than 3 days now this is a very good measure of calculating how your logistics service is working . Although the concept of percentile will not show very useful information in case of this flower dataset but it is still worth looking.

Expected output : 1.7 , this means 90% of the satosa flowers have petal length less than 1.7 .

Quantile

The concept of quantile is simple dividing the whole data or probability distribution of data into contiguous intervals with each interval having equal probability, for sake of simplicity of article we will use 4-quantiles or quartiles ,

smallest element

median

middle element between median and largest element

largest element

Quartiles can be used to show what is magnitude of the data points lie under a quartile , like if median is 1.7 then we can say 50% of the points have petal length less than 1.7.

print(np.percentile(iris_setosa["petal_length"],[0,25,50,100]))

the extra parameter which is list gives the percentile method instruction to calculate the value of quartile at 0, 25, 50,100 rather than at some specific scalar value.

This complete our discussion of EDA , in next upcoming article we will cover how to build a simple working machine learning model for this dataset.

Tags list

LearnCodeOnline

Tech Video Courses

We have a simple vision of becoming students favourite place to go when they wants to learn about programming and technology. Best technical training yet affordable rates makes us stand out. Our Library is diverse and there is something for every one to explore on course section.