Call WhatsApp Enquiry

Exploratory Data Analysis on Iris dataset

What is EDA?

Exploratory Data Analysis refers to the critical process of performing initial investigations on data so as to discover patterns, spot anomalies, to test hypotheses and to check assumptions with the help of summary statistics and graphical representations.

It is always good to explore and compare a data set with multiple exploratory techniques. After the exploratory data analysis, you will get confidence in your data to point where you’re ready to engage a machine learning algorithm and another benefit of EDA is to the selection of feature variables that will be used later for Machine Learning.
In this post, we take Iris Dataset to get the process of EDA.

Importing libraries:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt Loading the Iris data iris_data= pd.read_csv("Iris.csv") 




Understand the data: iris_data.shape
(150,5)
iris_data['Species'].value_counts()
setosa        50
virginica     50
versicolor    50
Name: species, dtype: int64 iris_data.columns() Index(['sepal_length', 'sepal_width', 'petal_length', 'petal_width','species'],dtype='object') 1D scatter plot of the iris data: iris_setso = iris.loc[iris["species"] == "setosa"];
iris_virginica = iris.loc[iris["species"] == "virginica"];
iris_versicolor = iris.loc[iris["species"] == "versicolor"];
plt.plot(iris_setso["petal_length"],np.zeros_like(iris_setso["petal_length"]), 'o')
plt.plot(iris_versicolor["petal_length"],np.zeros_like(iris_versicolor["petal_length"]), 'o')
plt.plot(iris_virginica["petal_length"],np.zeros_like(iris_virginica["petal_length"]), 'o')
plt.grid()
plt.show()   2D scatter plot: iris.plot(kind="scatter",x="sepal_length",y="sepal_width")
plt.show()  2D scatter plot with the seaborn library : import seaborn as sns
sns.set_style("whitegrid");
sns.FacetGrid(iris,hue="species",size=4) \
.map(plt.scatter,"sepal_length","sepal_width") \
.add_legend()
plt.show()  

 Conclusion

  • Blue points can be easily separated from red and green by drawing a line.
  • But red and green data points cannot be easily separated.
  • Using sepal_length and sepal_width features, we can distinguish Setosa flowers from others.
  • Separating Versicolor from Viginica is much harder as they have considerable overlap.

Pair Plot:

A pairs plot allows us to see both the distribution of single variables and relationships between two variables. For example, let’s say we have four features ‘sepal length’, ‘sepal width’, ‘petal length’ and ‘petal width’ in our iris dataset. In that case, we will have 4C2 plots i.e. 6 unique plots. The pairs, in this case, will be :

  •  Sepal length, sepal width
  • sepal length, petal length
  • sepal length, petal width
  • sepal width, petal length
  • sepal width, petal width
  • petal length, petal width

So, here instead of trying to visualize four dimensions which are not possible. We will look into 6 2D plots and try to understand the 4-dimensional data in the form of a matrix.

sns.set_style("whitegrid");
sns.pairplot(iris,hue="species",size=3);
plt.show()

Conclusion:

  1. petal length and petal width are the most useful features to identify various flower types.
  2. While Setosa can be easily identified (linearly separable), virginica and Versicolor have some overlap (almost linearly separable).
  3. We can find “lines” and “if-else” conditions to build a simple model to classify the flower types.

Cumulative distribution function:

iris_setosa = iris.loc[iris["species"] == "setosa"];
iris_virginica = iris.loc[iris["species"] == "virginica"];
iris_versicolor = iris.loc[iris["species"] == "versicolor"];
counts, bin_edges = np.histogram(iris_setosa['petal_length'], bins=10, density = True)
pdf = counts/(sum(counts))
print(pdf);
>>>[0.02 0.02 0.04 0.14 0.24 0.28 0.14 0.08 0.   0.04]
print(bin_edges);
>>>[1.   1.09 1.18 1.27 1.36 1.45 1.54 1.63 1.72 1.81 1.9 ]
cdf = np.cumsum(pdf)
plt.grid()
plt.plot(bin_edges[1:],pdf);
plt.plot(bin_edges[1:], cdf) 

Mean, Median, and Std-Dev:

print("Means:")
print(np.mean(iris_setosa["petal_length"]))
print(np.mean(np.append(iris_setosa["petal_length"],50)));
print(np.mean(iris_virginica["petal_length"]))
print(np.mean(iris_versicolor["petal_length"]))
print("\nStd-dev:");
print(np.std(iris_setosa["petal_length"]))
print(np.std(iris_virginica["petal_length"]))
print(np.std(iris_versicolor["petal_length"])) OutPut: - Means: 1.464 2.4156862745098038 5.5520000000000005 4.26

Std-dev:
0.17176728442867112
0.546347874526844
0.4651881339845203

Learnbay provides industry accredited data science courses in Bangalore. We understand the conjugation of technology in the field of Data science hence we offer significant courses like Machine learning, Tensor Flow, IBM Watson, Google Cloud platform, Tableau, Hadoop, time series, R and Python. With authentic real-time industry projects. Students will be efficient by being certified by IBM. Around hundreds of students are placed in promising companies for data science roles. Choosing Learnbay you will reach the most aspiring job of present and future.
Learnbay data science course covers Data Science with Python, Artificial Intelligence with Python, Deep Learning using Tensor-Flow. These topics are covered and co-developed with IBM.

Artificial Intelligence in E-commerce

The internet has opened the door for revolutionizing various sectors. E-commerce sector is one of them. E-commerce sectors have unlocked new opportunities and scope for retailers. Retailers also have never seen such a growth in their sales. Artificial intelligence is taking E-commerce to the next level. In this article, we are going to discuss 10 applications of artificial intelligence in E-commerce.

  1. Chatbots
    E-commerce websites are using chatbots to improve the customer support service. Chatbots are providing 24/7 customer support to buyers. Visit any recognized E-commerce website. You will be prompted with a chat box asking what do you want or how can I help. You can tell your requirements in the chatbox and you will be served with highly filtered results. Chatbots are built using artificial intelligence and are able to communicate with humans. They can also collect your past data and provide you with a very personalized user experience.
  2. Image search
    Ever come across a situation where you liked any product or item but don’t what it is called or what it is? Artificial intelligence service eases this task for you. The concept of image search is implemented in E-commerce websites with the application of artificial intelligence. Artificial intelligence has made it possible to understand images. Buyers can make a search on the basis of images. Mobile apps of E-commerce websites can find the product by just pointing the camera towards the product. This eliminates the need for keyword searches.
  3. Handling Customer Data
    E-commerce platforms have two things in abundance. On is an endless list of products and other is data. E-commerce has to deal with a lot of data every day. This data can be anything like daily sales, the total number of items sold, the number of orders received in an area or as a whole and what not. It has to take care of customer data also. Handling that amount of data is not possible for a human. Artificial intelligence can not only collect this data in a more structured form but also generate proper insights out of this data.This helps in understanding the customer behaviour of the whole populations as well as of the individual buyer. Understanding the customer buying pattern can make E-commerce to make changes wherever needed and predicting the next buy of the user also.
  4. Recommendation SystemsHave you ever experienced how E-commerce websites like Amazon are constantly showing the products similar you just checked? Well, this is the application of artificial intelligence in E-commerce. AI and machine learning algorithms can predict the behaviour of the buyer from its past searches, likings, frequently bought products. By predicting the behaviour of the user, E-commerce websites are able to recommend the products that user is highly interested in. This improves the user experience as the user no longer have to spend hours searching the product. It also helps the E-commerce websites to improve their sales.
  5. Inventory management
    The inventory management is one of the most important areas in any business. You have to keep yourself updated on how much inventory you are holding and how much more is needed. There are thousands of product categories over the E-commerce websites. Keeping an eye on the inventory of all the products daily is not possible for a human. This is where artificial intelligence comes into the picture. Artificial intelligence applications have helped E-commerce in managing the inventory. Moreover, the inventory management system will get better over the time. AI systems build a correlation between the current demand and the future demand.
  6. Cybersecurity
    Artificial intelligence has also improved the cybersecurity of the E-commerce websites. It can prevent or detect any fraudulent activities. E-Commerce has to deal with a lot of transactions on daily basis. Cybercriminals and hackers can hack the user account to gain unauthenticated access. This can lead to the exposure of private data and online fraud. The reputation of the business also gets a big blow. To prevent this, Artificial intelligence and machine learning algorithms are developed that can mitigate the chances of fraud activities over the website
  7. Better Decision Making
    E-commerce can make better decisions with the application of Artificial intelligence. Data analysts have to handle a lot of data every day. This data is too huge for them to handle. Moreover, analyzing the data also becomes a difficult task. Artificial intelligence has fastened the decision-making process of E-Commerce. AI algorithms can easily identify the complex patterns in the data by predicting user behaviour and their purchasing pattern.
  8. After Sales Service
    Selling the product is not enough. Businesses have to aid the customer in the complete buying cycle. After sales service is an integral part of after-sales service. Artificial intelligence applications can automate the feedback form, replacements and handling any other ambiguity in the product. By solving the buyer’s issues, the brand value of the website gets improved.
  9. CRM
    In the past, Customer Relationship Management (CRM) relied on the people to collect a huge amount of data in order to collect the data and serve the clients. But today, artificial intelligence can predict which customers are most likely to make a purchase and how can we better engage with them. Artificial intelligence applications can help in identifying the trends and plan the actions according to the latest trends. With the help of machine learning algorithms, advanced CRM can learn and improve over time.
  10. Sales Improvement
    Artificial intelligence applications can generate and predict the accurate forecast of the E-commerce business. The study of historical data, data analytics, and latest trends can help in optimizing the resource allocation, build a healthy pipeline and analyze the team performance. The managers can get a better insight into the latest trends in sales. They can analyze the trends and can improve the sales by making strategies well before time.

If you want to learn Artificial Intelligence, know the Artificial Intelligence course of Learnbay in here.

#iguru_button_6174839bdb070 .wgl_button_link { color: rgba(255,255,255,1); }#iguru_button_6174839bdb070 .wgl_button_link:hover { color: rgba(255,255,255,1); }#iguru_button_6174839bdb070 .wgl_button_link { border-color: transparent; background-color: rgba(255,149,98,1); }#iguru_button_6174839bdb070 .wgl_button_link:hover { border-color: rgba(230,95,42,1); background-color: rgba(253,185,0,1); }#iguru_button_6174839bdc548 .wgl_button_link { color: rgba(255,255,255,1); }#iguru_button_6174839bdc548 .wgl_button_link:hover { color: rgba(255,255,255,1); }#iguru_button_6174839bdc548 .wgl_button_link { border-color: rgba(218,0,0,1); background-color: rgba(218,0,0,1); }#iguru_button_6174839bdc548 .wgl_button_link:hover { border-color: rgba(218,0,0,1); background-color: rgba(218,0,0,1); }#iguru_button_6174839be09a6 .wgl_button_link { color: rgba(241,241,241,1); }#iguru_button_6174839be09a6 .wgl_button_link:hover { color: rgba(250,249,249,1); }#iguru_button_6174839be09a6 .wgl_button_link { border-color: rgba(102,75,196,1); background-color: rgba(48,90,169,1); }#iguru_button_6174839be09a6 .wgl_button_link:hover { border-color: rgba(102,75,196,1); background-color: rgba(57,83,146,1); }#iguru_soc_icon_wrap_6174839be9c75 a{ background: transparent; }#iguru_soc_icon_wrap_6174839be9c75 a:hover{ background: transparent; border-color: #3aa0e8; }#iguru_soc_icon_wrap_6174839be9c75 a{ color: #acacae; }#iguru_soc_icon_wrap_6174839be9c75 a:hover{ color: #ffffff; }#iguru_soc_icon_wrap_6174839be9c75 { display: inline-block; }.iguru_module_social #soc_icon_6174839be9ca51{ color: #ffffff; }.iguru_module_social #soc_icon_6174839be9ca51:hover{ color: #ffffff; }.iguru_module_social #soc_icon_6174839be9ca51{ background: #44b1e4; }.iguru_module_social #soc_icon_6174839be9ca51:hover{ background: #44b1e4; }
Get The Learnbay Advantage For Your Career
Note : Our programs are suitable for working professionals(any domain). Fresh graduates are not eligible.
Overlay Image
GET THE LEARNBAY ADVANTAGE FOR YOUR CAREER
Note : Our programs are suitable for working professionals(any domain). Fresh graduates are not eligible.