Any two-dimensional array of numbers may be interpreted as a matrix, although this is certainly not the only representation of such data.
Matrix-related mathematical and computational tools are universally applicable and often applied with great success.
Tables are used to represent variation of a quantity with respect to two variables. These variables may be encoded as the rows and columns of a matrix.
Example: A corpus is a collection of text documents. A term-document matrix has one column for each document and one row for each unique term appearing in the corpus. The \((i,j)\) entry of the matrix is the number of times term \(i\) appears in document \(j\). Matrix decomposition methods are often applied in this application. The SVD leads to an important method known as latent semantic analysis.
Example: Each vote cast in the U. S. Congress is available for download. We can put members of Congress along the columns of a matrix and bills along the rows, recording a number that codes for “yea,” “nay,” “none,” etc. The SVD reveals an analysis of the partisanship and cooperation of individual members.
Example: In 2006, Netflix started an open competition for a $1 million prize. They provided a 17,770 movie-by-480,189 user matrix dataset, with each entry a 1-5 star rating. The object was to predict a user’s ratings for movies they had not rated. This is known as a matrix completion problem. Teams nearly immediately improved Netflix’s approach, and in 2009 the prize was awarded for 10% improvement using techniques related to NMF.
We saw briefly in Lecture 6 that graphs lead us to (sparse) matrices.
Definition: Graphs and adjacency matrices
A graph or network consists of a set \(V\) of nodes and a set \(E\) of edges, each of which is an ordered pair of nodes. The graph is undirected if for every edge \((v_i,v_j)\), the pair \((v_j,v_i)\) is also an edge; otherwise the graph is directed.
The adjacency matrix of a graph with \(n\) nodes \(V\) and edge set \(E\) is the \(n\times n\) matrix whose elements are
\[A_{ij} = \begin{cases} 1 & \text{if $(v_i,v_j)\in E$ (i.e., there is an edge from node $i$ to node $j$)},\\ 0 & \text{otherwise}. \end{cases}\]
Applications:
Here are some elementary results about adjacency matrices.
Theorem:
For any graph with adjacency matrix \(\mathbf{A}\),
Here we create an adjacency matrix for a graph on four nodes.
Here are the counts of all walks of length 3 in the graph:
The representation of a graph by its adjacency matrix opens up the possibility of many kinds of analysis of the graph. One might ask whether the nodes admit a natural partition into clusters, for example. Or one might ask to rank the nodes in order of importance to the network as determined by some objective criteria—an application made famous by Google’s PageRank algorithm.
All of these are mathematically stated as problems about matrices.
Computers typically represent images as rectangular arrays of pixels, each of which is colored according to numerical values for red (R), green (G), and blue (B) components of white light. In Julia, we can work with an \(m\times n\) matrix of 3-vectors (or tensor).
Representation of an image as a matrix allows us to describe some common image operations in terms of linear algebra. For example, we will use the SVD to compress the image data, and we will use Krylove methods to apply and remove blurring effects.