Better visualizing tensors thanks to cities
Sure, it is easy to see how a scalar, a vector, or a matrix look like! But when it comes to n-dimensional arrays, our “narrow” three-dimensional mind can get stuck! But there are ways to go beyond that limitation… and cities are one of them!
The importance of Arrays in Data Science
All Data Science projects rely on structured data (at least at some point!) and some of the usual libraries to handle this information are called “Numpy” or “Pandas”.
The first one (NumPy) is more generic as it allows to deal with multi-dimensional datasets whereas Pandas offers a nice way to handle tabular (2 dimensions) datasets with indexes and specific functionalities.
If you are new to Data Science, understanding arrays’ structure is mandatory because, for some specific projects, you might end up with datasets in the following shape:
hard_to_visualize_array.shape
(10, 24, 540, 960, 3)
And how are you supposed to mentally visualize a 5 dimensions dataset?
A typical use-case of pictures processing
To illustrate this concept, let’s take a “computer vision” or “image detection” project which is typically the kind of initiative where you might end up with complex datasets.
Why? Because each picture is already a complex set of information, coded as a combination of multiple layers (also called “channels”) like RGB: Red, Green, Blue:
How do these different layers translate into arrays? The thumbnail below is a 10 x 10 pixels version of…