matrix factorization

NMF


intuition:


The intuition behind using matrix factorization to solve this problem is that there should be some latent features that determine how a user rates an item. For example, two users would give high ratings to a certain movie if they both like the actors/actresses of the movie, or if the movie is an action movie, which is a genre preferred by both users. Hence, if we can discover these latent features, we should be able to predict a rating with respect to a certain user and a certain item, because the features associated with the user should match with the features associated with the item.


assumption:


In trying to discover the different features, we also make the assumption that the number of features would be smaller than the number of users and the number of items.


R=P*Q


for text-mining application, R is of size(N,M), N is number of words, M is number of documents. column r_j represents each document with n words' relationship. P is N*K, Q is K*M, k is the size of the latent feature. 


r_j = P*q_j, that's j-th column of R is the linear combination of column vectors from P, by coefficients from Q, i.e. j-th column vector of Q, and P is called basises, and Q is called coefficients. NMF is a weighted sum of all parts. 


From this perspective of view, 


    1. P is only weight, and q_j is the input(x), r_j is the output(y)


    2. P the mapping transformer/function/basis from the original data/space to the destination data/space




how to solve:


    method1:


        1. loss: least square loss with regularization on every entity of (R-P*Q), 


        2. algorithm: SGD on every p_ik, and q_kj


        this end up with k-means. 


    method2:


        1. loss: KL-divergence


        2. algorithm: 


        this end up with p-LSA




Application




relation to K-Means clustering(when the loss function is the least squres):


    1. q_j which is the feature of the j-th document, is actually its belongingness to the k-th 'cluster'.


    2. p_k which is the words representation of the j-th feature, is actually the centroid of the k-th 'cluster'.


    3. so that is: when R->P*Q, it actually clustering. when P*Q->, it reconstructe the date.




relation to P-LSA(when the loss function is the KL-divergence):




non-stationary speech denoising




two-layer directed graph model




PCA


intuition


it's a unsupervised learning situation, aiming to find the most important or most mass of information. the mass of information can referred to variancy of the data. so the problem transfers to find the main project axises that maintain the most information or get the most variancy. why proejction? because this is transfer from the original data to another data, and under linear transformation circumstance, it is indeed the projection.( consider two vector, a dp b = |a||b|cos(alpha), and |a|cos(alpha) is the radical len of projection to b, if b is unity, then it is the corrdinate, dp means dot product.)


method


Given data X belong to R[n,m], that 's m instances each with n features, we expect a prjection matrix P, sothat maximize the variance.


first X should be centered by row, ie the mean of each feature among all instances should be zero.


then the project Y=PX, where P belongs to R[r, n], each row of p is actually a basis in the proejcted space, and rows of p are orthengor.


variancy of Y is D=YY'/m =PXX'P'/m=PCP'


(1. ' means transpose, 


 2. Y is centered for X is centered already


 3. C=XX'/m, that's the original variance)


our target is maximize D, and the projection should be orhtneog, so D is a diagonse matrix, with large triangle values ordered ahead ( for non-triangle values are cov-variance, and 0 cov means not linear related)


now it seems P is actually the matrix that trianglize the variance matrix of the origina data.


for C is real symmetric matrix, it can be trianglized . and rows of P are the eigen vectores corresponding to the specific eigen values,  also the basises in the projected space.


NOTE. XX' and X'X are both real symmetrix matrix, but what we are going to do is to find a feature sub space, so XX' is the matrix that we get eigen values and eigen vectors(each column is an instance, and each row is a feature of all instances)


Application


data compression


  SVD(LSA in NLP, LSI in IR)

low-rank approximation, denose, high-level feature

for PCA, data should first get feature variance matrix, which is symmetrix. but for any matrix A of shape ( n*m ). there exists a factorization such that 

X=USV'

where U and V are column-ortheogn matrix, and S is a triangle matrix

if use only a subset value of S, then X~X, which is a data compression procedure, also approximation.

existance:

it always hold: X'v_1 = sigma_1u_1. that means linear transformation on vector v in the original space is just a shrinkage or strethen on u in a different space.

from

1. X'v_1 = sigma_1u_1

2. X'v_2 = sigma_2u_2, where v_1 and v_2 are orthgo basises

3. x is a data point in the space of v1,v2

so we get x = (v1'x)v_1 + (v2'x)v_2. for v1'x is the radical projecton on v1

and so X'x = (v1'x)X'v1+(v2'x)X'v2 = (v1'x)s1u1+(v2'x)s2u2 = (u1s1v1'+u2s2v2')x

and so X' = USV'

meanings

if X belongs to R[n,m],ie each column is a vector of instance, and each row is a feature of all instances. Then each row is an instance for X' belonging to R[m, n]

then U is of shape [m,r], called left singular matrix, ie each row is a representation of instance, and the r columns are actually the r clusters, this results in belongingness of m instances to r clusters, or instance similarity.

then V is of shape [n,r], called right singular matrix, ie each row is a representation of feature, and this results in feature similarity.

then S is a triangle matrix of shape [r,r], each triangle value is called singular value, and is sqrt of (eigen value multiplied by m).

Given new data a(say document), the new featured data a'=SU'a. Comprehension: SU' illustrates the relationship between words and topics.

relation to PCA


A = USV', A'A=VDV' (think A is of shape [m, n], each column is an instance)

so columns of V is actually the eigen vectors of A'A, and is the eigen vectors of the instance space.

AA'=UDU', so columns of U is actually the eigen vectors of AA', and is the eigen vectors of the feature space. So for original data set X, the projected data Y=U'X=U'USV'=SV'. That's meaningful, for if X have 200,000,000 features, and 1000 instances, the cov matrix will be 200,000,000*200,000,000, which is hard to solve, but SV' just have dimension of r*r, r*1000, so PCA can be solved using SVD. when one want to project a data, say x into another feature space, just use y=U'x

note that this relation holds no matter A is centered or not, and no matter A'A is divided by m. when center A on PCA, we should also center A on SVD, and we always do this. if we divide A'A by m, then sigma is sqrt of (eigen value multiplied by m), else is just sqrt of (eigen value), and we alway divide by m when PCA.


applicatoin


1. data compression


2. denosing: think that the main information should have large variance, and the noise is alway exists every, and thus have lower variance, so just maintain the large sigular value and the corresponding matrix is ok


3. data analysis, recomandation: we can use the relationship in the matrix.

PCA, SVD, NMF

NMF having physical meanings as described above, so often used in nmf

PCA/SVD related to eigen vectors, so usually used in another space or sub-space, where its meaning is hard to describe.

PCA/SVD yeilds unique result, but nmf can yeild different results(for sgd get local minimum)

how to garunate non-negative: SGD garuantation




-- ============================================= --




R = P*Q for three matrix factorization


VQ vs PCA vs NMF


under face recognition background, column p_i is a face vector of planed, column q_j is the coefficient vector


1. VQ: hard coded, 1-hot representation, that's there is only one entity being 1, say q_kj=1, other entity are 0 in q_j, so r_i = P*q_j = p_k, that means r_i only relates to p_k. That is the case of K-Means clustering.


It can also be used for lossy data correction and density estimation


2. PCA: use all the eigen faces, and allow subtractions, so each of the basis image is a whole face, and the cofficient matrix may use them all.




???


PCA constrains the columns of W to be orthonormal and the


rows of H to be orthogonal to each other. This relaxes the unary


constraint of VQ, allowing a distributed representation in which


each face is approximated by a linear combination of all the basis


images, or eigenfaces6


???




3. NMF: no negative values in the matrix, so no subtraction can occur, this results in a combinition of only a subset of basis images.


    3.1 each basis image is a part-based representation. although multiple mouth/eye may occur, but this is because they are in different place or conditions.


    3.2 cofficient matrix is sparse for it need only a subset of basises


resources:
http://www.quuxlabs.com/blog/2010/09/matrix-factorization-a-simple-tutorial-and-implementation-in-python/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值