Matrices and vectors
If you spend much time learning and applying machine learning, you will see a bunch of references to matrices and vectors. In fact, many machine learning algorithms boil down to a series of iterative operations on matrices. What are matrices and vectors, and how do we represent them in our Go programs?
For the most part, we will utilize packages from github.com/gonum
to form and work with matrices and vectors. This is a great series of Go packages focused on numerical computing, and they just keep getting better and better.
Vectors
A vector is an ordered collection of numbers arranged in either a row (left to right) or column (up and down). Each of the numbers in a vector is called a component. This might be, for example, a collection of numbers that represents our company sales, or it might be a collection of numbers representing temperatures.
It's, of course, natural for us to use Go slices to represent these ordered collections of data, as follows:
// Initialize a "vector...