Google PageRank Francesco Ricci Faculty of Computer Science Free University of Bozen-Bolzano fricci@unibz.it 1
Content p Linear Algebra p Matrices p Eigenvalues and eigenvectors p Markov chains p Google PageRank 2
Literature p C. D. Manning, P. Raghavan, H. Schütze, Introduction to Information Retrieval , Cambridge University Press, 2008. Chapter 21 p Markov chains description on wikipedia p Amy N. Langville & Carl D. Meyer, Google's PageRank and Beyond: The Science of Search Engine Rankings, Princeton University Press, 2006. 3
Google p Google is the leading search and online advertising company - founded by Larry Page and Sergey Brin (Ph.D. students at Stanford University) p “googol” or 10 100 is the mathematical term Google was named after p Google’s success in search is largely based on its PageRank™ algorithm p Gartner reckons that Google now make use of more than 1 million servers, spitting out search results, images, videos, emails and ads p Google reports that it spends some 200 to 250 million US dollars a year on IT equipment. 4
Matrices p A Matrix is a rectangular array of numbers a a a 1 2 3 ⎛ ⎞ ⎛ ⎞ 11 12 13 A ⎜ ⎟ = = ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ a a a 4 5 6 ⎝ ⎠ ⎝ ⎠ 21 22 23 p a ij is the element of matrix A in row i and column j p A is said to be a n x m matrix if it has n rows and m columns p A square matrix is a n x n matrix p The transpose A T of a matrix A is the matrix obtained by exchanging the rows and the columns ! $ ! $ ! $ T T a 11 a 12 a 11 a 21 # & # & 1 4 # & # & # & # & A T = # & # & T T a 21 a 22 a 12 a 22 2 5 = = # & # & # & # & # & # & 3 6 # & T T a 31 a 32 a 13 a 23 # & # & 5 " % " % " %
Exercise p What is the size of these matrices p Compute their transpose 6
Exercise p What is the size of these matrices 2x3 3x1 3X4 p Compute their transpose " % 0 1 2 $ ' " % $ ' 1 20 $ ' − 1 0 1 $ ' ! # $ ' 4 1 8 9 5 $ ' " $ $ ' − 2 − 1 0 $ ' $ ' − 13 − 6 $ ' $ ' # & − 3 − 2 − 1 $ ' # & 7
Matrices p A square matrix is diagonal iff has a ij = 0 for all i ≠ j a 0 ⎛ ⎞ 11 A ⎜ ⎟ = ⎜ ⎟ 0 a ⎝ ⎠ 22 p The Identity matrix 1 is the diagonal matrix with 1´s along the diagonal 1 0 ⎛ ⎞ A ⎜ ⎟ = ⎜ ⎟ 0 1 ⎝ ⎠ p A symmetric matrix A satisfy the condition A=A T 8
Exercise p Is a diagonal matrix symmetric? p Make an example of a symmetric matrix p Make an example of a 2x3 symmetric matrix 9
Exercise p Is a diagonal matrix symmetric? n YES because if it is diagonal then a ij = 0 for all i ≠ j, hence a ij = a ji for all i ≠ j p Make an example of a symmetric matrix ! $ 1 2 # & 2 3 " % p Make an example of a 2x3 symmetric matrix n Impossible, a symmetric matrix is a square matrix 10
Vectors p A vector v is a one-dimensional array of numbers (is an n x 1 matrix – column vector) p Example: ! $ 3 # & v = 5 # & # & 7 " % p The standard form of a vector is a column vector p The transpose of a column vector v T =(3 5 7) is a row vector. 11
Operation on matrices p Addition: A =(a ij ), B =(b ij ), C =(c ij ) = A + B n c ij = a ij + b ij p Scalar multiplication: λ is a number, λ A = ( λ a ij ) p Multiplication: if A and B are compatible, i.e., the number of columns of A is equal to the number of rows of B , then n C =(c ij )= AB n c ij = Σ k a ik b kj 12
Examples ! $ 1 4 # & ! $ ! $ ! $ 1 2 3 # & # & 1*1 + 2*2 + 3*3 1*4 + 2*5 + 3*6 14 32 2 5 = # & = # & # & # & 4*1 + 5*2 + 6*3 4*4 + 5*5 + 6*6 32 77 # & " % " % 4 5 6 # & " % 3 6 # & " % It is symmetric. ! $ ! $ ! $ 1 1 1 − 1 1 0 Is it a general & = # & # # & fact? 0 1 0 1 0 1 " % " % " % Is AA T always symmetric? p If AB = 1 , then B is said to be the inverse of A and is denoted with A -1 p If a matrix has an inverse is called invertible or non singular 13
Exercise p Compute the following operations 14
Exercise p Compute the following operations 15
Rank of a Matrix p The row (column) rank of a matrix is the maximum number of rows (columns) that are linearly independent p The vectors v 1 , …, v n are linearly independent iff there is no linear combination a 1 v 1 + … + a n v n (with coefficients a i not all 0) of the vectors that is equal to 0 p Example 1: (1 2 3), (1 4 6), and (0 2 3) are linearly dependent: show it p Example 2: (1 2 3) and (1 4 6) are not linearly dependent: show it p The kernel of a matrix A is the subspace of vectors v such that Av =0 16
Exercise solution p 1*(1 2 3) T -1*(1 4 6) T + 1*(0 2 3) T =(0 0 0) T ! $ ! $ ! $ 1 1 0 1 0 # & # & # & 2 4 2 − 1 0 = # & # & # & # & # & # & 3 6 3 1 0 " % " % " % p (1 -1 1) T is in the kernel of the matrix: ! $ 1 1 0 # & 2 4 2 # & # & 3 6 3 " % p a*(1 2 3) + b*(1 4 6) = (0 0 0) n Then a=-b and also a = -2b, absurd. 17
Rank and Determinant p Theorem. A n x n square matrix is nonsingular iff has full rank (i.e. n). p Theorem. A matrix has full column rank iff it does not have a null vector p Theorem. A n x n matrix A is singular iff the det( A )=0 a ⎧ 11 if n 1 = ⎪ = ∑ n det( A ) ⎨ 1 j ( 1 ) a det( A ) + − if n 1 > 1 j [ 1 j ] ⎪ ⎩ j 1 = p A [ij] is the ij minor, i.e., the matrix obtained by deleting the i-th row and the j-th column from A. 18
Exercise p Compute the determinant of the following matrices ! $ 1 1 # & 2 4 " % ! $ 1 1 0 # & 2 4 2 # & # & 3 6 3 " % 19
Exercise p Compute the determinant of the following matrices ! $ 1 1 = 1*4-1*2 = 2 # & 2 4 " % ! $ 1 1 0 # & 2 4 2 # & = 1*(4*3-2*6)-(2*3-2*3)=0 # & 3 6 3 " % http://www.bluebit.gr/matrix-calculator/ 20
Eigenvectors and Eigenvalues p Definition . If M is a square matrix, v is a nonzero vector and λ is a number such that n M v = λ v p then v is said to be an (right) eigenvector of A with eigenvalue λ p If v is an eigenvector of M with eigenvalue λ , then so is any nonzero multiple of v p Only the direction matters. 21
Example Is it singular? p The matrix 2 3 − ⎛ ⎞ M ⎜ ⎟ = ⎜ ⎟ 1 2 − ⎝ ⎠ p Has two (right) eigenvectors: n v 1 =(1 1) t and v 2 = (3 1) t Prove that 22
Example Is it singular? p The matrix 2 3 − ⎛ ⎞ M ⎜ ⎟ = ⎜ ⎟ 1 2 − ⎝ ⎠ p Has two eigenvectors: n v 1 =(1 1) t and v 2 = (3 1) t Prove that p Mv 1 = (-1 -1) t = -1 v 1 n The eigenvalue is -1 p Mv 2 = (3 1) t = 1 v 2 n The eigenvalue is 1 23
Transformation 2 3 − ⎛ ⎞ M ⎜ ⎟ = ⎜ ⎟ 1 2 − ⎝ ⎠ p There is a lot of distortion in these directions (1 0) t , (1 1) t , (0 1) t 24
Transformation along eigenvectors p There are two independent directions which are not twisted at all by the matrix M : (1 1) and (3 1) p one of them is flipped (1 1) p We see less distortion if our box is oriented in the two special directions. 25
Results p Theorem: every square matrix has at least one eigenvector p The usual situation is that an n x n matrix has n linearly independent eigenvectors p If there are n of them, they are a useful basis for R n . p Unfortunately, it can happen that there are fewer than n of them. 26
Finding Eigenvectors p M v = λ v n v is an eigenvector and is λ an eigenvalue p If λ = 0, then finding eigenvectors is the same as finding nonzero vectors in the null space – iff det( M ) = 0, i.e., the matrix is singular p If λ != 0, then finding the eigenvectors is equivalent to finding the null space for the matrix M – λ 1 ( 1 is the identity matrix) p The matrix M – λ 1 has a non zero vector in the null space iff det( M – λ 1 ) = 0 p det( M – λ 1 ) = 0 is called the characteristic equation . 27
Exercise 2 3 − Find the eigenvalues and the ⎛ ⎞ M ⎜ ⎟ = ⎜ ⎟ 1 2 eigenvectors of this matrix − ⎝ ⎠ 1) Find the solutions λ of the characteristic equation (eigenvalues) 2) Find the eigenvectors corresponding to the found eigenvalues. 28
Exercise Solution 2 3 − Find the eigenvalues and the ⎛ ⎞ M ⎜ ⎟ = ⎜ ⎟ 1 2 eigenvectors of this matrix − ⎝ ⎠ p det( M – λ 1 ) = 0 n (2 - λ )(-2 - λ ) + 3 = λ 2 - 1 p The solutions are +1 and -1 29
Recommend
More recommend