liveBook · Manning

Vector

As explained in Grokking Machine Learning, Second Edition

A vector is an ordered sequence of numerical entries representing a mathematical quantity or data point.

A vector is an ordered sequence of numerical entries representing a mathematical quantity or data point. Each position stores one feature, such as a word count or pixel value. section 5.9

Turning an image into a vector

A 28-by-28 grayscale image becomes a vector with 784 entries by joining its rows. A digit label becomes a length-10 vector with one nonzero entry marking the digit. section 10.19

Figure 10.24 Before training the neural network, we preprocess the images and the labels in the following way. We shape the rectangular image into a long vector by concatenating the rows. We then convert each label into a vector of length 10 with only one non-zero entry in the position of the corresponding label.

Follow the visual transformation from a rectangular handwritten digit to a long input vector and from a label to a one-entry output vector. section 10.19

Representing a sentence

A sentence with three words appearing 5, 8, and 3 times becomes the vector (5, 8, 3). A perceptron combines these entries with word weights and a bias. section 5.9

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Explains vectors through word counts, pixel flattening, label encoding, and classifier outputs without developing vector operations.
Examples
Uses MNIST pixel and digit-label vectors alongside three-word sentence vectors based on word appearance counts.
What you can do after
Apply vectors via NumPy and Keras by reshaping images, encoding labels, and reading classifier predictions.
How it connects
Connects vectors to neural networks, perceptron classifiers, sentiment analysis, image recognition, weights, and hyperplanes.

Also explained in

Compare how 14 books explain vector →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.