Linear Algebra for Machine Learning
- 56Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is the basic idea behind representing data for machine learning?
Arrange information as a vector—a one-dimensional array of numbers—so a computer can process it.
Or swipe the card
56 cards
What is the basic idea behind representing data for machine learning?
Arrange information as a vector—a one-dimensional array of numbers—so a computer can process it.
What is a vector?
A vector is a one-dimensional array of numbers; it can also be pictured as an arrow with magnitude and direction.
What does the dimension of a vector space describe?
A vector space is the collection of vectors with a specified number of entries. For example, vectors with three entries belong to a three-dimensional vector space.
What is a feature vector?
A feature vector is a vector whose entries represent features or measurements of an object.
What is a feature space?
Feature space is another name for the space of feature vectors.
How could a patient's height, weight, and age be represented as data?
A patient's height, weight, and age can be represented as entries in a feature vector.
How can pixel values be used to represent a black-and-white or grayscale image numerically?
Represent each pixel with a number: for example, black-and-white pixels can use 0 and 1, while grayscale pixels can use values from 0 to 255.
How can an image represented as a matrix be converted into a vector?
Flatten the image matrix into a one-dimensional array, for example by placing each row after the previous row.
How can a word be represented as a vector using document counts?
For a word such as “dog,” count its occurrences in each document and place those counts in a vector, with one entry per document.
How can a user's movie ratings or viewing history be represented as a vector?
List a user's ratings or yes/no interactions with items as entries in a vector, with one entry per item.
What is a one-hot encoding?
A one-hot encoding is a vector with one entry equal to 1 and all other entries equal to 0. Each category is assigned a different position for its 1.
What is another mathematical name for one-hot encoding vectors?
One-hot encodings are also called standard basis vectors.
Why can one-hot encodings be considered sparse representations?
One-hot vectors can be very high-dimensional and contain mostly zeros, especially when the vocabulary has many words.
Why might a user–movie data representation contain many zeros?
A user–movie representation can contain many unknown or missing interactions because users typically have not watched every movie; replacing missing entries with zeros can create many zeros.
What semantic drawback do one-hot encodings have for words?
A representation may fail to encode meaningful relationships: one-hot vectors for “cat” and “tiger” are no more similar by their dot product than “cat” and “apple.”
How is the dot product of two vectors calculated?
For equal-length vectors, multiply corresponding entries and add the products: v⋅w=∑i=1nviwi.
What kind of result does a dot product produce?
The dot product produces a number from two vectors, rather than another vector.
How is the dot product used to assess similarity between vectors?
The dot product can serve as an indicator of how similar two vectors are.
What is the geometric shadow interpretation of the dot product?
Geometrically, it is related to the length of one vector's shadow in the direction of the other. When the second vector has length 1, the dot product equals that projection length; otherwise, it is proportional to it.
What dot product do two different one-hot vectors have, and what limitation does this reveal?
The dot product of two distinct one-hot vectors is 0, regardless of whether their categories are semantically related.
Why does the dot product fail to show that “cat” is more related to “tiger” than to “apple” in a one-hot representation?
The dot product of the one-hot vectors for “cat” and “tiger” is 0, just as it is for “cat” and “apple,” so it does not reflect the intuitive similarity between cats and tigers.
What is a vector embedding?
An embedding replaces a vector with another vector in a lower-dimensional vector space, ideally preserving meaningful information.
What is a matrix?
It is a two-dimensional array of numbers.
What does a matrix do to a vector?
A matrix can transform a vector into another vector, for example by stretching, rotating, or scaling it.
How should a matrix transformation be understood beyond its effect on one vector?
A matrix represents a transformation of a whole vector space: it acts on each vector according to the same transformation rules.
What dimension condition must hold to multiply two matrices?
For an n×m matrix multiplied by an m×p matrix, the inner dimensions match; the product has dimensions n×p.
What is the result of multiplying two compatible matrices?
Matrix multiplication combines two matrices to produce another matrix.
What is the basic idea of matrix factorization?
Matrix factorization reverses multiplication: it seeks matrices whose product equals, or approximately equals, a given matrix.
What is the singular value decomposition?
The singular value decomposition (SVD) expresses a matrix as a product of three special matrices, including a diagonal matrix and matrices with orthonormal rows or columns.
What does it mean for vectors to be orthonormal?
Orthonormal vectors have length 1 and are pairwise perpendicular, so the dot product of any two distinct vectors in the set is 0.
How can matrix factorization provide candidate vector embeddings?
The rows or columns of the factor matrices can serve as candidate embeddings for the original data vectors.
How can a neural network produce a vector embedding?
A neural network can take an original data vector as input and output a lower-dimensional vector that serves as a candidate embedding.
What linear-algebra structure is found inside neural networks?
Neural networks contain matrices, often many of them, as well as other components beyond linear algebra.
What is the aim of vector embedding, and what trade-off must be considered?
The goal is to compress high-dimensional data into a smaller, more meaningful space without losing too much information.
How can user–movie viewing data be organized into a matrix?
Use a matrix with users as rows and movies as columns; mark a cell when a user watched the corresponding movie.
How might watched and unwatched movies be encoded in a user–movie matrix?
A watched movie can be marked with a 1 and an unwatched movie with a 0 or, depending on the application, another value. An empty cell can represent no recorded interaction.
How does a row of a user–movie matrix represent a user?
A user's row is a vector whose entries indicate that user's interactions with each movie.
How does a column of a user–movie matrix represent a movie?
A movie's column is a vector whose entries indicate the interactions of different users with that movie.
What is a limitation of representing users and movies directly with rows and columns of the interaction matrix?
The original user and movie vectors are based on observed interactions, but do not necessarily encode underlying features such as audience age or movie style.
What are latent features? Give examples from user–movie data.
Latent features are underlying characteristics hidden in the data that a useful representation aims to reveal, such as audience age group or whether a movie is a blockbuster or arthouse film.
How can matrix factorization create lower-dimensional user and movie embeddings?
Factor the user–movie matrix into smaller matrices whose rows or columns provide lower-dimensional candidate embeddings for users and movies.
What do the example embeddings for user 3 and “Shrek” illustrate?
In the example, user 3's original vector was (1,1,1,0,0) and its candidate embedding was (0.2,−1). The movie “Shrek” went from (1,0,1,0) to (1,−1); their close placement in the embedding space suggests a relationship.
What is an eigenvector?
An eigenvector of a matrix is a nonzero vector whose direction is unchanged by the matrix transformation; the vector is only scaled.
What is an eigenvalue?
The eigenvalue is the scalar by which its eigenvector is scaled under the matrix transformation.
What equation expresses the eigenvector–eigenvalue relationship?
A vector v is an eigenvector of M with eigenvalue λ when Mv=λv.
What happens to an eigenvector when its matrix transformation is applied?
The transformation may change its length but does not change its direction.
Why are eigenvectors useful in data science and machine learning?
Eigenvectors can encode valuable information about data, in addition to describing special directions of a matrix transformation.
Why might a data matrix be multiplied by its transpose before finding eigenvectors?
Eigenvectors are defined for square matrices, so a rectangular data matrix is typically combined with its transpose to form a square matrix for eigenvector analysis.
What is the central goal of dimensionality reduction?
Dimensionality reduction seeks a lower-dimensional space that captures the structure of data that occupies only a small portion of a larger space.
How are a collection of data points prepared for an eigenvector-based dimensionality analysis?
Stack the vectors representing individual data points into a matrix.
Which matrix's eigenvectors are examined in the described approach to finding a data direction?
In the described approach, find eigenvectors of a square matrix formed from the data matrix and its transpose.
What statistical preparation of data may accompany the eigenvector approach?
Center the data by subtracting the mean of each row; the statistical procedure may also scale the resulting matrix by a constant.
What does the eigenvector with the largest eigenvalue indicate about clustered data?
The eigenvector with the largest eigenvalue points in the direction along which the data is most strongly clustered in the described setting.
What is the direction indicated by the leading eigenvector called?
It is the principal direction of the data, also called the principal eigenvector.
What does PCA stand for, and what does it use to characterize data?
Principal component analysis (PCA) is the name for the analysis that uses principal directions or components to characterize data structure.
What are three benefits of finding a lower-dimensional space for data?
Finding a lower-dimensional space can improve efficiency, save computational resources, and reveal relevant structure in the data.

Ask anything
We've read this whole study set, so questions about it get the best answers.