Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

Machine Learning Prior Part 1 & Data Visualization
Latest

Machine Learning Prior Part 1 & Data Visualization

Last Updated on January 8, 2023 by Editorial Team

Author(s): Gencay I.

Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.

Machine Learning Prior Part 1 & DataVisualization

Matplotlib & Seaborn Briefly Explained andΒ Compared

Photo by Marius Masalar onΒ Unsplash
Content Table
Β·
Introduction
Β· Line Graph
∘ Matplotlib
∘ Seaborn
∘ Animated Line Graph
Β· Histogram
∘ Matplotlib
∘ Seaborn
Β· Scatter Graph
∘ Matplotlib
∘ Seaborn
Β· Violin Graph
∘ Matplotlib
∘ Seaborn
Β· Conclusion

Introduction

Hi toΒ all.

In my Machine learning series, I try to explain to you guys the logic behind Machine Learning.

As it is obvious and I always say, Machine Learning is the combination of different cultures.

MainlyΒ ;

Image byΒ Author

In the following articles, I explain most of the Statistical terms used in Machine Learning.

Now in that brief course, I try to explain to you guys the coding process of machine learning inΒ Python.

In Python, I divide the process intoΒ four.

  • Data Visualization- Matplotlib &Β Seaborn
  • Data Analytics- Pandas
  • Getting familiar with Data Types-Numpy
  • Building Models- Scikit-learn

Also, I divide model types into three, which areΒ ;

  • Regression
  • Classification
  • Clustering

A clustering article is on theΒ way*

Now, data visualization and chart types can really vary, but I decided to explain the most common ones to you because that is a brief explanation article.

And also I will code this graph in Matplotlib and Seaborn, which are the most common visualization tools inΒ Python.

Line Graph

The line graph is used to observe changes, most commonly, inΒ time.

Matplotlib

First, download the data by loading and seaborn and use the load_dataset method.

Then drop the categorical column and draw a graph accordingly.

Image byΒ Author

Seaborn

Like in the latterΒ code,

  • Download the data by loading andΒ seaborn
  • Load_dataset method, drop the categorical columnΒ and
  • Draw a line graph accordingly by selecting x andΒ y.
  • For more
Image byΒ Author

Animated LineΒ Graph

Also if you would like to see an animatedΒ graph;

  • Load the libraries
  • Sort theΒ values
  • Set the size of the number of png, that will create your animated line graph’sΒ gif.
  • Write aΒ loop.
  • Save yourΒ gif.
Image byΒ Author

Histogram

The important graph to look density and distribution ofΒ data.

Matplotlib

Now let's explain step byΒ step

  • Download and load theΒ data
  • Define fig andΒ ax.
  • Define the histogram and theΒ column.
  • Set title, x and yΒ label
  • Define the threshold, and draw the line accordingly.
  • For more arguments.
Image byΒ Author

Seaborn

Here is the source of distplot.

  • Import library.
  • Load dataΒ set
  • Define the columnΒ name
  • kde- draw gaussian kernel density orΒ not.
  • bins- histogram binsΒ width
Image byΒ Author

Scatter Graph

To see data points as a literal points, a scatter graph is a useful graphΒ type.

Matplotlib

  • Download necessary libraries and dataΒ set.
  • Set a title and gridΒ option
  • For more about scatter plots in matplotlib.

Seaborn

  • Download necessary libraries and dataΒ set.
  • Set background style.
  • Set legends and such, forΒ more
Image byΒ Author

Violin Graph

Here is the quick sum of the violinΒ graph.

Reference

Matplotlib

  • Load libraries and downloadΒ data
  • Select the iris sepal length column andΒ observe.
  • For more.
Image byΒ Author

Seaborn

  • Import Seaborn and dataΒ set.
  • Select the first 100 columns to compare setosa and versicolor.
  • Select sepal and petalΒ length.
  • For more.
Image byΒ Author

Conclusion

Now as you can see there are a lot of different ways to visualize yourΒ data.

Data visualization is an important step of the ETL process in Machine Learning.

It helps you to see, sometimes the distribution of the data, and outliers and gives you insight into theΒ data.

Actually, it speaks to you in a different language and knowing that language better, helps you to be a real machine in Machine Learning.

β€œMachine learning is the last invention that humanity will ever need to make.” NickΒ Bostrom


Machine Learning Prior Part 1 & Data Visualization was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓