The importance of NumPy, Pandas, Matplotlib & Seaborn in AI/ML

The importance of NumPy, Pandas, Matplotlib & Seaborn in AI/ML

Data must be understood before modeling can take place. This is where the significance of the above-mentioned Python libraries comes into play.

Series: Attention because it's all you need. (14 articles)

  1. …
  2. 4
    The importance of NumPy, Pandas, Matplotlib & Seaborn in AI/ML This article
Machine Learning Engineer | Frontend Developer | Deep Learning & Generative AI | RAG, MLOps & AWS

Why Do We Need NumPy, Pandas, Matplotlib, and Seaborn for AI/ML?

Before proceeding to Machine Learning, there is something I've realized: it is not enough to know the algorithms only. Models are based on data, and before a model starts learning something, we have to know how to deal with the data. That is why we need libraries such as NumPy, Pandas, Matplotlib, and Seaborn.
But these are Data Science libraries, aren't they? Yes these libraries are used mostly in Data Science. However, this does not mean they do not relate to AI/ML at all. Instead, they make up an essential part of the process happening before and around model training.

Why NumPy?

NumPy is a core library for working with numerical data in Python. Machine Learning is a lot about numbers, vectors, matrices, and mathematics operations. Using NumPy allows to do all of that in a much more efficient way. Learning the basics of NumPy also helps understanding such ML concepts as vectors, matrices, dimensions, and numerical transformations.

Why Pandas?

Datasets are not always suitable for analysis. They may include missing values, duplicate entries, wrong data types, unnecessary columns, and other issues. Using Pandas helps to load, inspect, clean, transform, and analyze structured data. But before asking a model to do all of that, we need to do it ourselves.

Why Matplotlib and Seaborn?

Numbers alone may be not enough sometimes. Visualization allows us to see patterns, distributions, correlations, outliers, and anomalies in a dataset. While Matplotlib is a library for fundamental visualization, Seaborn helps to simplify creating some statistical visualizations. For example, visualizing a dataset allows to find some patterns which may not be seen in raw dataset at all.

But Aren't These Data Science Libraries?

Yes, they are. However, AI/ML cannot be done separately from Data Science. For instance, a typical ML pipeline looks as follows:
Data collection → Data cleaning → Data exploration → Data visualization → Feature preparation → Model training → Model evaluation → Model deployment
The libraries we are going to learn help with several of these steps. So, I am not learning NumPy, Pandas, Matplotlib, and Seaborn because I want to become a Data Scientist. Instead, I am learning them because data analysis is a necessary stage for building Machine Learning models.

What Am I Going to Learn as Beginner?

I will not try to remember everything these libraries provide. Instead, I will focus on things which are useful for me in my AI/ML path:
  • NumPy for arrays, dimensions, mathematical operations
  • Pandas for loading, exploring, cleaning, transforming datasets
  • Matplotlib for fundamental plotting and customization
  • Seaborn for statistical visualizations, exploring relationships in data
Having this knowledge, I can proceed with learning Machine Learning algorithms with much greater understanding of what is really going on with the data.

Series: Attention because it's all you need. (14 articles)

  1. …
  2. 4
    The importance of NumPy, Pandas, Matplotlib & Seaborn in AI/ML This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article