tag:blogger.com,1999:blog-8540876.post112506257981598112..comments2024-07-27T09:33:11.445+03:00Comments on Deniz Yuret's Homepage: Singular Value Decomposition NotesDeniz Yurethttp://www.blogger.com/profile/00578023665603100985noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-8540876.post-12644340098619871162008-09-29T14:11:00.000+03:002008-09-29T14:11:00.000+03:00In my comment of Aug 26, 2005 I wrongly claimed th...In my comment of Aug 26, 2005 I wrongly claimed that a matrix takes the edges of the unit sphere to the edges of the hyper-ellipse. That is not true in general, the whole unit sphere goes to the whole hyper-ellipse, but edges are not necessarily mapped to one another. This does not invalidate the rest of my observations about the SVD of the data matrix. <BR/><BR/>In fact edges of the unit sphere correspond to unit length vectors in the row space. When the matrix is multiplied with a unit length vector, what comes out is a linear combination of its columns where the squares of the coefficients add up to one.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-34082592384139886752008-08-08T20:21:00.000+03:002008-08-08T20:21:00.000+03:00Nice posts !Informative ..I have a doubt ..assume ...Nice posts !<BR/>Informative ..<BR/><BR/>I have a doubt ..<BR/><BR/>assume <B>A</B> ,is a matrix which is the sum of I(Identity) and a*b' for some vectors <B>a</B> and <B>b</B>.<BR/><BR/>What can u say about (A'*A)'s eigen vectors, values <BR/><BR/>and also SVD'sChetan Jhttps://www.blogger.com/profile/10012161057511130758noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-76453785459025587352008-02-22T03:15:00.000+02:002008-02-22T03:15:00.000+02:00I wrote up a little primer on SVD that includes li...I wrote up a little primer on SVD that includes link to Matlab code I wrote for visualizing the SVD that can be found <A HREF="http://neurochannels.blogspot.com/2008/02/visualizing-svd.html" REL="nofollow">here</A>.<BR/><BR/>Your site provided some useful references.Eric Thomsonhttps://www.blogger.com/profile/06847717704454032165noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1132951319745800382005-11-25T22:41:00.000+02:002005-11-25T22:41:00.000+02:00To stop confusing rows and columns this note will ...To stop confusing rows and columns this note will summarize what to do to get compressed vectors:<BR/><BR/>1. A is mxn, columns are objects, rows are attributes. So there are n objects with m attributes. A transforms Rn -> Rm. SVD produces A=USV'. Columns of U are orthonormal vectors in R^m. When reduced, U has r column vectors in R^m, S is rxr, and V has r column vectors in R^n (if not reduced => r=n). To reduce an object v from m dimensions to r dimensions we use U'v. To reduce all n objects to the new r dimensional coordinate system use U'A. We can just use transpose because the columns of U are orthonormal.<BR/><BR/>2. B is nxm, rows are objects, columns are attributes. So there are n objects with m attributes. B transforms Rm -> Rn. SVD produces B=USV'. Columns of U are orthonormal vectors in R^n. When reduced, U has r column vectors in R^n, S is rxr, and V has r column vectors in R^m (if not reduced => r=n). In fact, B=A' since (USV')' = VSU', we obtain the same three matrices for A and B, except U and V have changed roles. To reduce an object v (row vector) from m dimensions to r dimensions we can use vV. To reduce all objects to r dimensions we can use BV (which is just the transpose of U'A from last example.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1129906434591417642005-10-21T17:53:00.000+03:002005-10-21T17:53:00.000+03:00SVD vs PCA:A = USV'A'A = VSU'USV' = V(S^2)V'A'A is...SVD vs PCA:<BR/><BR/>A = USV'<BR/>A'A = VSU'USV' = V(S^2)V'<BR/><BR/>A'A is the covariance matrix and V(S^2)V' is its Eigen decomposition. Still would be nice to have a geometric interpretation.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1126711254220544782005-09-14T18:20:00.000+03:002005-09-14T18:20:00.000+03:00Some observations from looking at the spectral clu...Some observations from looking at the spectral clustering slides by Ding with Alkan yesterday:<BR/><BR/>1. There is incredible symmetry in the problem. No wonder why I am so confused. Take the data matrix. Find cross products between features. That is the covariance matrix. Find cross products between observations. That is the similarity matrix. They are duals of each other. (Guess you have to make the means zero first.)<BR/><BR/>2. The eigens of the covariance matrix are the same as the singular vectors of the data matrix. I bet the eigens of the similarity matrix are the other singular vectors. Spectral clustering works basically by finding the eigen vectors of the laplacian matrix of a graph. Laplacian matrix is the adjacency matrix with (negative) degree information on the diagonal. A similarity matrix is sort of a continuous analogue of the adjacency matrix. (At least I am guessing that's how people use spectral clustering.) Interestingly it is the vectors with smallest eigen values that is of interest in spectral clustering.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1126420006244439592005-09-11T09:26:00.000+03:002005-09-11T09:26:00.000+03:00Some thoughts from last night:1. I need to go over...Some thoughts from last night:<BR/><BR/>1. I need to go over the proofs but basically both Ripley and Trefethen books seem to suggest SVD and PCA based on covariance matrix give the same results, and the SVD solution is more stable<BR/><BR/>2. I have been thinking about irrelevant and redundant features. Here are two simple observations: If you add extra dimensions to a data set (a) distances always increase, (b) separable points stay separable, non-separable ones may become separable (x^2 SVM example). The opposite is true for decreasing dimensions naturally. Sets that are not separable will not become separable when you get rid of dimensions. This argues that discriminant approaches like SVMs will probably do well in the presence of extra dimensions, whereas nearest neighbor, clustering type approaches will be misled. (SVM will find a separation along the correct dimensions if one exists but the random dims may prevent it from finding the largest margin one).<BR/><BR/>3. Why would you ever want to decrease the number of dimensions? It obviously doesn't help separability. Some ideas:<BR/>- to get better similarity: irrelevant dims may make similar points look different (but then how do you know SVD gives the right solution, maybe the highest variation directions are the noise)<BR/>- to uncover correlations: the astronaut text example from manning.<BR/>- fight with sparse data: if the data is the tip of a histogram, sparseness prevents the real distribution difficult to estimate. (again astronaut text example). I think in that case dimensions of SVD correspond to whole distributions, and the mapping to lower dimensions allows the tip of histograms to be classified as the right histogram learnt from more frequent words. (I should look at the dims of the SVD in peter's data to see what sort of distributions they give)<BR/><BR/>4. this may argue that SVD actually performs clustering. Imagine n word distributions which have no intersection (orthogonal). Wouldn't SVD have the first n vectors point to the centers of these clusters?<BR/><BR/>5. SVD is just one way to project data. If we have a quality metric (like how well similar pairs can be distinguished from dissimilar pairs), one can numerically search for dimensions along which this distinction can be made better. See projection pursuit.<BR/><BR/>6. Finally our data may be such that each semantic relation is represented along distinct dimensions, rather than by some linear combination of common dimensions. Will any kind of projection work in such a problem?Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1126273296342726792005-09-09T16:41:00.000+03:002005-09-09T16:41:00.000+03:00Here is another excerpt that tries to explain the ...Here is another excerpt that tries to explain the relation of SVD, PCA and Eigen decomposition:<BR/><BR/>Formally: There is a direct relation between PCA and SVD in the case where principal components are calculated from the covariance matrix. If one conditions the data matrix X by centering each column, then X'X = sum gi gi' is proportional to the covariance matrix of the variables of gi. By diagonalization of X'X yields V', which also yields the principal components of {gi}. So, the right singular vectors {vk} are the same as the principal components of {gi}. The eigenvalues of X'X are equivalent to s_k^2, which are proportional to the variances of the principal components. The matrix US then contains the principal component scores, which are the coordinates of the activations in the space of principal components.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1126185798973272772005-09-08T16:23:00.000+03:002005-09-08T16:23:00.000+03:00Next step is to understand covariance matrices and...Next step is to understand covariance matrices and the statement "PCA is equivalent to performing SVD on the covariance matrix". There is also the relation with clustering. http://crd.lbl.gov/~cding/Spectral talks about the equivalence of K-means clustering and the PCA.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1125063331819835282005-08-26T16:35:00.000+03:002005-08-26T16:35:00.000+03:00SVD on ImagesSVD can also be applied to images (re...<B>SVD on Images</B><BR/><BR/>SVD can also be applied to images (represented as a matrix of pixels) to compress them. This is very different from data matrices where each column represents an individual object of interest. The reason SVD works in the image application is that when one eliminates the smallest singular values and computes the reduced rank matrix, the result is the closest possible to the original for that rank. It is closest in various definitions of close, but the relevant one for images is the least squares of individual pixel value differences. Here is an applet to demonstrate:<BR/><BR/>Use the arrow keys of your keyboard to change the rank of the matrix, left/right goes by one, up/down goes by factors of two. You may have to click on the image first.<BR/><BR/><A HREF="http://home.ku.edu.tr/~dyuret/java/svd.html" REL="nofollow"><BR/>http://home.ku.edu.tr/~dyuret/java/svd.html </A>Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1125063082316276432005-08-26T16:31:00.000+03:002005-08-26T16:31:00.000+03:00Data MatricesComing back to the question of why SV...<B>Data Matrices</B><BR/><BR/>Coming back to the question of why SVD makes sense for data matrices (matrices whose columns are high dimensional data points, e.g. documents expressed as word frequency vectors, or experiments expressed as gene expression vectors). At first visualizing the geometric interpretation of the SVD (the unit sphere being transformed into a hyper-ellipsoid) on an arbitrary data matrix proved difficult. What is the action of a data matrix? According to the standard transform concept, a matrix transforms vectors in its row space into vectors in its column space. This meant a term-document matrix transforms a term into a document, or a gene matrix transforms a gene into an experiment, which made no sense.<BR/><BR/>The great Trefethen book starts with one simple observation: Ax is a linear combination of columns of A. This is an alternative viewpoint to the usual: Ax is a transformation of x into a new vector. But it makes certain things easier to understand. For example a matrix transforms unit vectors into its column vectors. The alternative is that a unit vector selects a column of the matrix. This may sound like hair splitting but let's look at its consequence for the data matrices. Each unit vector (do not interpret these as entities in the row space like a new gene or a new term, but just as a selector), picks a column (i.e. one of the data points). Thus the images of these unit vectors give us the cloud of data points (documents or gene experiments) in their multidimensional space. Back to the SVD concept of the unit sphere going into the ellipsoid. The cloud of data points all lie at the edges of our ellipsoid (because all the unit vectors they come from lie at the edges of the unit sphere). They determine its outline. We would expect the extent of the ellipsoid along a certain direction to be related to the spread of our data along that direction.<BR/><BR/>What does reduced SVD do? Well imagine an ellipsoid shaped like a convex lens. i.e. one of its dimensions is dwarfed by the others. Reducing SVD will get rid of that dimension and turn the thing into a circle. Why would you have a dwarf dimension to start with? Well, maybe one of the genes is expressed very little compared to others. One of the document terms is seen very rarely. In that case you may not want the elimination, so maybe you should rescale that dimension. Another reason may be several terms or genes that are correlated. In the perfect correlation case our ellipse would lie on the 45 degree hyperplane between those two axes, thus both terms expressed as a single dimension. I imagine this is the more relevant effect everybody is after. Manning's document term example has two docs that have no words in common, so originally they look orthogonal with 0 similarity. But words from both documents co-occur frequently in other documents, so SVD collapses them and in the modified space the two docs look pretty similar.Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1125063037679256652005-08-26T16:30:00.000+03:002005-08-26T16:30:00.000+03:00Trefethen BookThis book seems to have a good expla...<B>Trefethen Book</B><BR/><BR/>This book seems to have a good explanation and chapters 4 and 5 are available online. Basically, a matrix can be identified with the hyper-ellipse it takes the unit sphere to. The unit vectors along the principle axes of the ellipse form the columns of the U matrix (left singular vectors), their magnitudes form the diagonal S matrix (singular values), and their pre-images on the unit sphere form the columns of the V matrix (right singular vectors). The action of any matrix can be summarized as rotate-stretch-rotate. A=USV* means first rotate the pre-images to align with the axes (V* is the inverse of V. V, like any matrix, takes the unit vectors to its columns), then stretch the axes by amounts specified in S, then rotate to the target orientation using U. Both U and V are unitary matrices (their rows and columns form orthonormal bases). U is defined to be that way, but I am not sure why V has to be.<BR/><BR/>One confusion is there is more than one way to define the dimensions of U, V, S. Standard is to define U and V as square and S has the same dimensions as A. Another is to define S as square and adjust U and V accordingly. There are only rank(A) non-zero entries on S, so the rest of the values are padded with zeros. We can further reduce S by throwing away the smallest values, in which case we have a lower rank object which is the closest approximation (by several measures) to A.<BR/><BR/>SVD is different than eigen decomposition since eigen-vectors do not have to be orthogonal. (A matrix takes eigen-vectors to their own multiples). When they are orthogonal, eigens are just a special case of SVD.<BR/><BR/>Now that we got the geometric interpretation pat, all that is left is to figure out what goes on when we have a covariance matrix or a data matrix. These matrices are not very intuitive to think about as geometric transforms.<BR/><BR/>Link: <A HREF="http://web.comlab.ox.ac.uk/oucl/work/nick.trefethen/text.html " REL="nofollow"><BR/>http://web.comlab.ox.ac.uk/oucl/work/nick.trefethen/text.html </A>Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1125062972090415522005-08-26T16:29:00.000+03:002005-08-26T16:29:00.000+03:00Singular Value Decomposition IFrom wikipedia: "The...<B>Singular Value Decomposition I</B><BR/><BR/>From wikipedia: "The geometric content of the SVD theorem can thus be summarized as follows: for every linear map T: Kn → Km one can find orthonormal bases of Kn and Km such that T maps the i-th basis vector of Kn to a non-negative multiple of the i-th basis vector of Km, and sends the left-over basis vectors to zero. With respect to these bases, the map T is therefore represented by a diagonal matrix with non-negative real diagonal entries."<BR/><BR/>What does this mean when the matrix is an incidence matrix of words and documents?<BR/><BR/>Here are a bunch of statements about SVD from various sources:<BR/>- The SVD represents an expansion of the original data in a coordinate system where the covariance matrix is diagonal.<BR/>- Performing PCA is the equivalent of performing Singular Value Decomposition (SVD) on the covariance matrix of the data.<BR/>- The ith singular value indicates the amount of variation along the ith axis.<BR/><BR/>Link: <A HREF="http://en.wikipedia.org/wiki/Singular_value_decomposition " REL="nofollow"><BR/>http://en.wikipedia.org/wiki/Singular_value_decomposition </A>Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1125062863466680512005-08-26T16:27:00.000+03:002005-08-26T16:27:00.000+03:00Latent Semantic Analysis Latent Semantic Analysis ...<B>Latent Semantic Analysis</B><BR/><BR/> Latent Semantic Analysis (LSA) is a mathematical/statistical technique for extracting and representing the similarity of meaning of words and passages by analysis of large bodies of text. It uses singular value decomposition, a general form of factor analysis, to condense a very large matrix of word-by-context data into a much smaller, but still large-typically 100-500 dimensional-representation (Deerwester, Dumais, Furnas, Landauer & Harshman, 1990). The right number of dimensions appears to be crucial; the best values yield up to four times as accurate simulation of human judgments as ordinary co-occurence measures.<BR/><BR/>Link: <A HREF="http://lsa.colorado.edu/" REL="nofollow"><BR/>http://lsa.colorado.edu</A>Deniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.comtag:blogger.com,1999:blog-8540876.post-1125062707218292662005-08-26T16:25:00.000+03:002005-08-26T16:25:00.000+03:00Latent Semantic IndexingLatent Semantic Indexing i...Latent Semantic Indexing<BR/><BR/>Latent Semantic Indexing is an idea to improve document retrieval performance by making the system less sensitive to word choice. "LSI explicitly represents terms and documents in a rich, high-dimensional space, allowing the underlying (``latent''), semantic relationships between terms and documents to be exploited during searching." A large incidence matrix is constructed where rows correspond to words, columns to documents, and entries to the number of times the words occurs in the documents. The entries are rescaled according to some weighting scheme. Then (this is the important step) the matrix is reduced in dimensionality using Singular Value Decomposition. Now why should this work?<BR/><BR/>Documents, terms, and queries are represented as points in the same reduced dimension term-document space. Queries are just mini documents. What about terms? And what does it mean for a document to be a "point" in the reduced term-document space while it was a whole column in the original incidence matrix? We need to understand SVD first to figure the rest out. The oft cited reference seems to be:<BR/><BR/>http://www.cs.utk.edu/~library/TechReports/1994/ut-cs-94-270.ps.Z<BR/>Using Linear Algebra for Intelligent Information Retrieval. Michael W. Berry, Susan T. Dumais, and Gavin W. O'Brien, December 1994. Published in SIAM Review 37:4 (1995), pp. 573-595.<BR/><BR/>Link: http://www.cs.utk.edu/~berry/lsi++/node8.htmlDeniz Yurethttps://www.blogger.com/profile/00578023665603100985noreply@blogger.com