What’s a Tensor?

Unpacking a common data science structure

Giovanni Rosati
Towards Data Science

Image licensed from Adobe Stock

The concept of a Tensor was created in 1900 by two Italian mathematicians, Tullio Levi-Civita and Gregorio Ricci-Curbastro, and as is common, they built upon the work of other mathematicians. The Wikipedia page for “Tensor” begins:

In mathematics, a tensor is an algebraic object that describes a (multilinear) relationship between sets of algebraic objects related to a vector space.

For non-mathematicians, that’s a lot to unpack!

Fortunately, it’s a lot easier to grasp what a tensor is in a practical sense and how we manipulate them in data science.

I find it helpful to visualize a tensor as nested “lists” of numbers, with any number of “levels.” Another way of visualizing this is to imagine each cell in an Excel spreadsheet containing all the contents from another entire spreadsheet. Then, in that second spreadsheet, each cell there is also linked to another entire spreadsheet, and so on. Each spreadsheet could be thought of as an additional “dimension.”

A “first-order” tensor has just one dimension. In computer science, this would be called a “vector,” an ordered list of numbers. A “second-order” tensor would be a matrix, like an Excel spreadsheet, and have two dimensions. As the dimensions increase, we can think of…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

What are your thoughts?