Last updated: April 9th, 2020 at 08:26 pm

To get started in machine learning there are some basics that you need to know and understand before you can ever just start coding out programs.

A few key areas to understand are vectors, matrices and arrays.

First, what is a vector?

Vectors come from linear algebra. And you thought you’d be able to forget that stuff forever right?

An easy way to understand a vector is to imagine a list of numbers and vector algebra are the operations performed on the numbers in the list.

Next, what is a matrix?

Here we are again talking about algebra. In the case of machine learning you will run into a few types of matrices.

The first example we code is a square matrix, which is a matrix where the number of rows (n) equals the number of columns (m).

Next, a sparse matrix which is closer to what you will find yourself running into as a specific type of machine learning problem. There are going to be many instances where you have a zero for your data. Not specific to a binary 0 or 1, but a zero because there is no registered data. For example, how many times did you purchase product X verse Y. Well, you may not have purchased one of those products. One feature is to parse out the non-zeros so you can quickly look at the data. In our small example that may not be a big deal because you can quickly eyeball the zeros but imagine millions of rows of data!

In the example we also show how to get data out of your vector and matrix array. Also learn how to get the shape and size as well as max and minimum. Enjoy!