61
Coding the Matrix! Divya Padmanabhan Intelligent Systems Lab, Dept. of CSA, Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1

Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Coding the Matrix!

Divya Padmanabhan

Intelligent Systems Lab,Dept. of CSA,

Indian Institute of Science,Bangalore

June 28, 2013

Divya Padmanabhan Coding the Matrix! June 28, 2013 1

Page 2: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

How does the most popular search engine work?

Google it!

Search more than 8 billion pages ..

Results in less than a second..

How is it possible???

What is Google doing in that 1 second?

Divya Padmanabhan Coding the Matrix! June 28, 2013 2

Page 3: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

How does Facebook manage information about you?

Friend network matrixU1 · · · Un

U1 · · ·U2 · · ·...Un · · ·

Divya Padmanabhan Coding the Matrix! June 28, 2013 3

Page 4: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

How does Flipkart recommend products for you?

How does Flipkart know what you require?

How does Flipkart keep track of so many users and find theirinterests?

Divya Padmanabhan Coding the Matrix! June 28, 2013 4

Page 5: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Some BASICS!!!

Divya Padmanabhan Coding the Matrix! June 28, 2013 5

Page 6: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Preliminaries

Vectors

eg. How well can you sing? paint? play? ..

Professional singer :(1 · · · )

. Amateur :(0.1 · · · )

Norm |~x | =√x21 + x22 + · · ·+ x2n

Dot product ~x .~y = |~x ||~y | cos θ = x1y1 + x2y2 + · · ·+ xnyn

Divya Padmanabhan Coding the Matrix! June 28, 2013 6

Page 7: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Preliminaries

Vectors

eg. How well can you sing? paint? play? ..

Professional singer :(1 · · · )

. Amateur :(0.1 · · · )

Norm |~x | =√x21 + x22 + · · ·+ x2n

Dot product ~x .~y = |~x ||~y | cos θ = x1y1 + x2y2 + · · ·+ xnyn

Divya Padmanabhan Coding the Matrix! June 28, 2013 6

Page 8: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Orthogonality and Projections

Figure: Orthogonal vectors ~xT~y = ||x ||||y || cos θ = 0

~x

~y

θ

Figure: Projection of ~x on ~y = ~x.~y||~y ||

O

Z

~x

~y

~x.~y||y||

Divya Padmanabhan Coding the Matrix! June 28, 2013 7

Page 9: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Orthogonality and Projections

Figure: Orthogonal vectors ~xT~y = ||x ||||y || cos θ = 0

~x

~y

θ

Figure: Projection of ~x on ~y = ~x.~y||~y ||

O

Z

~x

~y

~x.~y||y||

Divya Padmanabhan Coding the Matrix! June 28, 2013 7

Page 10: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Linear Combination and Independence

Linear Combination

c1~x + c2~y , c1 ∈ R, c2 ∈ R

Linear Independence of vectors ~x and ~y

c1~x + c2~y = 0⇒ c1 = 0, c2 = 0

Can’t express ~x in terms of ~y .

Eg.

[10

],

[23

], c1 = 0, c2 = 0

Linearly dependent :[12

],

[24

], c1 = 2, c2 = −1

Divya Padmanabhan Coding the Matrix! June 28, 2013 8

Page 11: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Linear Combination and Independence

Linear Combination

c1~x + c2~y , c1 ∈ R, c2 ∈ R

Linear Independence of vectors ~x and ~y

c1~x + c2~y = 0⇒ c1 = 0, c2 = 0

Can’t express ~x in terms of ~y .

Eg.

[10

],

[23

], c1 = 0, c2 = 0

Linearly dependent :[12

],

[24

], c1 = 2, c2 = −1

Divya Padmanabhan Coding the Matrix! June 28, 2013 8

Page 12: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Linear Combination and Independence

Linear Combination

c1~x + c2~y , c1 ∈ R, c2 ∈ R

Linear Independence of vectors ~x and ~y

c1~x + c2~y = 0⇒ c1 = 0, c2 = 0

Can’t express ~x in terms of ~y .

Eg.

[10

],

[23

], c1 = 0, c2 = 0

Linearly dependent :[12

],

[24

], c1 = 2, c2 = −1

Divya Padmanabhan Coding the Matrix! June 28, 2013 8

Page 13: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Matrix Multiplication

A︷ ︸︸ ︷[2 34 5

] B︷︸︸︷[12

]=

C︷︸︸︷[8

14

]

1

[24

]+ 2

[35

]=

[8

14

]

Divya Padmanabhan Coding the Matrix! June 28, 2013 9

Page 14: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Matrix Multiplication

A︷ ︸︸ ︷[2 34 5

] B︷︸︸︷[12

]=

C︷︸︸︷[8

14

]

1

[24

]+ 2

[35

]=

[8

14

]

Divya Padmanabhan Coding the Matrix! June 28, 2013 9

Page 15: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Row and column vectors

A =

[2 1 03 −1 4

]

Row vectors =

r1 =

210

, r2 =

3−14

Column vectors =

{c1 =

[23

], c2 =

[1−1

], c3 =

[04

]}

Divya Padmanabhan Coding the Matrix! June 28, 2013 10

Page 16: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Row and column vectors

A =

[2 1 03 −1 4

]Row vectors =

r1 =

210

, r2 =

3−14

Column vectors =

{c1 =

[23

], c2 =

[1−1

], c3 =

[04

]}

Divya Padmanabhan Coding the Matrix! June 28, 2013 10

Page 17: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Row and column vectors

A =

[2 1 03 −1 4

]Row vectors =

r1 =

210

, r2 =

3−14

Column vectors =

{c1 =

[23

], c2 =

[1−1

], c3 =

[04

]}

Divya Padmanabhan Coding the Matrix! June 28, 2013 10

Page 18: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Fundamental spaces

Row space and column space of A

Row Space: Linear combination of r1, r2.

Column space : Linear combination of c1, c2, c3

Null space: Vectors orthogonal to row space of A.

Row Space (A) = Col space (AT )

Divya Padmanabhan Coding the Matrix! June 28, 2013 11

Page 19: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Representatives of a space

Basis and dimensions of a space

Basis : Smallest no. of linearly independent vectors whose linearcombination gives the entire space.

[−21

]= −2

[10

]+ 1

[01

]Dimension : No. of vectors in the basis.

Divya Padmanabhan Coding the Matrix! June 28, 2013 12

Page 20: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Redundancy elimination

Rank and nullity of matrix A

Rank(A)= no. of linearly independent column vectors of A.

Nullity(A) = dimension of nullspace of A.

Rank measures redundancy in the matrix.

[1 0 −4 −28 −150 1 −1 −2 −6

]Rank-Nullity Theorem: Rank(A) + Nullity(A) = n

Divya Padmanabhan Coding the Matrix! June 28, 2013 13

Page 21: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Redundancy elimination

Rank and nullity of matrix A

Rank(A)= no. of linearly independent column vectors of A.

Nullity(A) = dimension of nullspace of A.

Rank measures redundancy in the matrix.[1 0 −4 −28 −150 1 −1 −2 −6

]

Rank-Nullity Theorem: Rank(A) + Nullity(A) = n

Divya Padmanabhan Coding the Matrix! June 28, 2013 13

Page 22: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Redundancy elimination

Rank and nullity of matrix A

Rank(A)= no. of linearly independent column vectors of A.

Nullity(A) = dimension of nullspace of A.

Rank measures redundancy in the matrix.[1 0 −4 −28 −150 1 −1 −2 −6

]Rank-Nullity Theorem: Rank(A) + Nullity(A) = n

Divya Padmanabhan Coding the Matrix! June 28, 2013 13

Page 23: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )(A− λI )x = 0det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 24: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→

x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )(A− λI )x = 0det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 25: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )(A− λI )x = 0det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 26: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )

(A− λI )x = 0det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 27: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )(A− λI )x = 0

det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 28: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )(A− λI )x = 0det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 29: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Eigen values and eigen vectors

x

Resear h

1

0.8

Publi

Speaking

A2×2−−−→x

Ax = λx

Resear h

Publi

Speaking

1

0.8

2

1.6

How do you determine the x and λ given a matrix A?

Ax = λx , x 6= ~0 ( or xTAT = λxT , x 6= ~0 )(A− λI )x = 0det(A− λI ) = 0

Divya Padmanabhan Coding the Matrix! June 28, 2013 14

Page 30: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Now for the FUN stuff!!!

Divya Padmanabhan Coding the Matrix! June 28, 2013 15

Page 31: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

A Typical Search Activity : Random surfer

Jump−−−→

Divya Padmanabhan Coding the Matrix! June 28, 2013 16

Page 32: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

A Typical Search Activity : Random surfer

Jump−−−→

Divya Padmanabhan Coding the Matrix! June 28, 2013 16

Page 33: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Importance of pages

Divya Padmanabhan Coding the Matrix! June 28, 2013 17

Page 34: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Importance of pages

Divya Padmanabhan Coding the Matrix! June 28, 2013 17

Page 35: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 36: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 37: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 38: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 39: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]

Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 40: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 41: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Anything particular about H?

H : row stochastic

Vt(A) : Probability of being at page A at time tVt : row vector. eg.

[0.1 0.3 · · ·

]Vt(A) = Vt−1(A)HAA + Vt−1(B)HBA + . . .

Vt = Vt−1H

Divya Padmanabhan Coding the Matrix! June 28, 2013 18

Page 42: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

V0 =

1/41/41/41/4

,

V1 = V0H =

9/245/245/245/24

, V2 = V1H =

15/4811/4811/4811/48

Divya Padmanabhan Coding the Matrix! June 28, 2013 19

Page 43: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

V0 =

1/41/41/41/4

, V1 = V0H =

9/245/245/245/24

,

V2 = V1H =

15/4811/4811/4811/48

Divya Padmanabhan Coding the Matrix! June 28, 2013 19

Page 44: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

V0 =

1/41/41/41/4

, V1 = V0H =

9/245/245/245/24

, V2 = V1H =

15/4811/4811/4811/48

Divya Padmanabhan Coding the Matrix! June 28, 2013 19

Page 45: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

...Vn = Vn−1H

...

vH = 1v

v is the eigen vector of H corresponding to eigen value 1 !!!

Divya Padmanabhan Coding the Matrix! June 28, 2013 20

Page 46: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

...Vn = Vn−1H

...

vH = 1v

v is the eigen vector of H corresponding to eigen value 1 !!!

Divya Padmanabhan Coding the Matrix! June 28, 2013 20

Page 47: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

...Vn = Vn−1H

...

vH = 1v

v is the eigen vector of H corresponding to eigen value 1 !!!

Divya Padmanabhan Coding the Matrix! June 28, 2013 20

Page 48: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

H : row stochastic, guaranteed to have eigen value 1, under someconditions.

...Vn = Vn−1H

...

vH = 1v

v is the eigen vector of H corresponding to eigen value 1 !!!Divya Padmanabhan Coding the Matrix! June 28, 2013 20

Page 49: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - conditions on H

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Row stochastic

Irreducible :Possible to reach a page from any other page.

Aperiodic : Not periodic

Divya Padmanabhan Coding the Matrix! June 28, 2013 21

Page 50: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - conditions on H

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Row stochastic

Irreducible :Possible to reach a page from any other page.

Aperiodic : Not periodic

Divya Padmanabhan Coding the Matrix! June 28, 2013 21

Page 51: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - conditions on H

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Row stochastic

Irreducible :Possible to reach a page from any other page.

Aperiodic : Not periodic

Divya Padmanabhan Coding the Matrix! June 28, 2013 21

Page 52: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - conditions on H

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1 0 0 0D 0 1

212 0

Row stochastic

Irreducible :Possible to reach a page from any other page.

Aperiodic : Not periodic

Divya Padmanabhan Coding the Matrix! June 28, 2013 21

Page 53: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - Dangling nodes

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1

2 0 0 12

D 0 0 0 0

S = H + Y

=

A B C D

A 0 13

13

13

B 12 0 0 1

2

C 12 0 0 1

2

D 14

14

14

14

Divya Padmanabhan Coding the Matrix! June 28, 2013 22

Page 54: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - Dangling nodes

Transition Matrix HA B C D

A 0 13

13

13

B 12 0 0 1

2C 1

2 0 0 12

D 0 0 0 0

S = H + Y

=

A B C D

A 0 13

13

13

B 12 0 0 1

2

C 12 0 0 1

2

D 14

14

14

14

Divya Padmanabhan Coding the Matrix! June 28, 2013 22

Page 55: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm - Entering a new destination

S =

A B C D

A 0 13

13

13

B 12 0 0 1

2C 1

2 0 0 12

D 14

14

14

14

B :

1/n · · · 1/n· · ·

1/n · · · 1/n

n×n

Google matrix!

Surfer follows the link structure 60 % of timeOtherwise to a random page!

G = αS + (1− α)B

Divya Padmanabhan Coding the Matrix! June 28, 2013 23

Page 56: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Search Engines

Get pages containing query words.

Use page rank to determine the order of pagesto be displayed.

Ford 0.1Maruti 0.7Volkswagen 0.05Hyundai 0.15

Divya Padmanabhan Coding the Matrix! June 28, 2013 24

Page 57: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Page Rank Algorithm

Search Engines

Get pages containing query words.

Use page rank to determine the order of pagesto be displayed.

Ford 0.1Maruti 0.7Volkswagen 0.05Hyundai 0.15

Divya Padmanabhan Coding the Matrix! June 28, 2013 24

Page 58: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Recommender Systems

Divya Padmanabhan Coding the Matrix! June 28, 2013 25

Page 59: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

Recommender Systems

Matrix Factorization

Original matrix Xd×n (d users, n movies)

X ≈ X̂ = Md×k × Hk×n

Find M,H.

Divya Padmanabhan Coding the Matrix! June 28, 2013 26

Page 60: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

References

1 Gilbert Strang, “Linear Algebra and its Applications”, Fourth Edition.

2 Langville and Meyer,“Google’s PageRank and Beyond”.

3 Gene H. Golub, Charles F. Van Loan, “Matrix Computations”.

4 Howard Anton, Chris Rorres, “Elementary Linear Algebra”.

Divya Padmanabhan Coding the Matrix! June 28, 2013 27

Page 61: Coding the Matrix! - Events Server Dept., CSA, IISc · Indian Institute of Science, Bangalore June 28, 2013 Divya Padmanabhan Coding the Matrix! June 28, 2013 1. How does the most

THANK YOU!

Divya Padmanabhan Coding the Matrix! June 28, 2013 28