42
An Introduction to Latent Semantic Analysis

An Introduction to Latent Semantic Analysis

  • Upload
    asa

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

An Introduction to Latent Semantic Analysis. Matrix Decompositions. Definition: The factorization of a matrix M into two or more matrices M 1 , M 2 ,…, M n , such that M = M 1 M 2 … M n . Many decompositions exist… - PowerPoint PPT Presentation

Citation preview

Page 1: An Introduction to Latent Semantic Analysis

An Introduction to Latent Semantic Analysis

Page 2: An Introduction to Latent Semantic Analysis

2

Matrix Decompositions

• Definition: The factorization of a matrix M into two or more matrices M1, M2,…, Mn, such that M = M1M2…Mn.

• Many decompositions exist…– QR Decomposition – Orthogonal and Triangular: LLS,

eigenvalue algorithm– LU Decomposition – Lower and Upper Triangular: Solve

systems and find determinants– Etc.

• One is special…

Page 3: An Introduction to Latent Semantic Analysis

3

Singular Value Decomposition

• [Strang]: Any m by n matrix A may be factored such that

A = UVT

• U: m by m, orthogonal, columns are the eigenvectors of AAT

• V: n by n, orthogonal, columns are the eigenvectors of ATA

• : m by n, diagonal, r singular values are the square roots of the eigenvalues of both AAT and ATA

Page 4: An Introduction to Latent Semantic Analysis

4

SVD Example

• From [Strang]:

10

01

0

3

0

0

0

2

100

010

001

0

3

0

0

0

2

Page 5: An Introduction to Latent Semantic Analysis

5

SVD Properties

• U, V give us orthonormal bases for the subspaces of A:– 1st r columns of U: Column space of A– Last m - r columns of U: Left nullspace of A– 1st r columns of V: Row space of A– 1st n - r columns of V: Nullspace of A

• IMPLICATION: Rank(A) = r

Page 6: An Introduction to Latent Semantic Analysis

6

Application: Pseudoinverse

• Given y = Ax, x = A+y• For square A, A+ = A-1

• For any A…

A+ = V-1UT

• A+ is called the pseudoinverse of A.• x = A+y is the least-squares solution of y = Ax.

Page 7: An Introduction to Latent Semantic Analysis

7

Rank One Decomposition

• Given an m by n matrix A:nm with singular values {s1,...,sr} and SVD A = UVT, define

U = {u1| u2| ... |um} V = {v1| v2| ... |vn}T • Then…

i

r

iiis vuA

1 |

|A may be expressed as the sum of r rank one matrices

Page 8: An Introduction to Latent Semantic Analysis

8

Matrix Approximation

• Let A be an m by n matrix such that Rank(A) = r• If s1 s2 ... sr are the singular values of A,

then B, rank q approximation of A that minimizes ||A - B||F, is

i

q

iiis vuB

1 |

|Proof: S. J. Leon, Linear Algebra with Applications, 5th Edition, p. 414 [Will]

Page 9: An Introduction to Latent Semantic Analysis

9

Application: Image Compression

• Uncompressed m by n pixel image: m×n numbers

• Rank q approximation of image:– q singular values– The first q columns of U (m-vectors)– The first q columns of V (n-vectors)– Total: q × (m + n + 1) numbers

Page 10: An Introduction to Latent Semantic Analysis

10

Example: Yogi (Uncompressed)

• Source: [Will]• Yogi: Rock

photographed by Sojourner Mars mission.

• 256 × 264 grayscale bitmap 256 × 264 matrix M

• Pixel values [0,1]• ~ 67584 numbers

Page 11: An Introduction to Latent Semantic Analysis

11

Example: Yogi (Compressed)

• M has 256 singular values

• Rank 81 approximation of M:

• 81 × (256 + 264 + 1) = ~ 42201 numbers

Page 12: An Introduction to Latent Semantic Analysis

12

Example: Yogi (Both)

Page 13: An Introduction to Latent Semantic Analysis

13

Application: Noise Filtering

• Data compression: Image degraded to reduce size

• Noise Filtering: Lower-rank approximation used to improve data.– Noise effects primarily manifest in terms

corresponding to smaller singular values.– Setting these singular values to zero removes

noise effects.

Page 14: An Introduction to Latent Semantic Analysis

14

Example: Microarrays

• Source: [Holter]• Expression profiles for

yeast cell cycle data from characteristic nodes (singular values).

• 14 characteristic nodes• Left to right:

Microarrays for 1, 2, 3, 4, 5, all characteristic nodes, respectively.

Page 15: An Introduction to Latent Semantic Analysis

15

Research Directions

• Latent Semantic Indexing [Berry]– SVD used to approximate document retrieval

matrices.

• Pseudoinverse– Applications to bioinformatics via Support Vector

Machines and microarrays.

Page 16: An Introduction to Latent Semantic Analysis

The Problem

• Information Retrieval in the 1980s• Given a collection of documents: retrieve

documents that are relevant to a given query• Match terms in documents to terms in query• Vector space method

Page 17: An Introduction to Latent Semantic Analysis

The Problem

• The vector space method– term (rows) by document (columns) matrix, based

on occurrence– translate into vectors in a vector space

• one vector for each document

– cosine to measure distance between vectors (documents)

• small angle = large cosine = similar• large angle = small cosine = dissimilar

Page 18: An Introduction to Latent Semantic Analysis

The Problem

• A quick diversion• Standard measures in IR

– Precision: portion of selected items that the system got right

– Recall: portion of the target items that the system selected

Page 19: An Introduction to Latent Semantic Analysis

The Problem

• Two problems that arose using the vector space model:– synonymy: many ways to refer to the same object,

e.g. car and automobile• leads to poor recall

– polysemy: most words have more than one distinct meaning, e.g.model, python, chip

• leads to poor precision

Page 20: An Introduction to Latent Semantic Analysis

The Problem• Example: Vector Space Model

– (from Lillian Lee)

autoenginebonnettyreslorryboot

caremissions

hood makemodeltrunk

makehiddenMarkovmodel

emissionsnormalize

Synonymy

Will have small cosine

but are related

Polysemy

Will have large cosine

but not truly related

Page 21: An Introduction to Latent Semantic Analysis

The Problem

• Latent Semantic Indexing was proposed to address these two problems with the vector space model for Information Retrieval

Page 22: An Introduction to Latent Semantic Analysis

Some History

• Latent Semantic Indexing was developed at Bellcore (now Telcordia) in the late 1980s (1988). It was patented in 1989.

• http://lsi.argreenhouse.com/lsi/LSI.html

Page 23: An Introduction to Latent Semantic Analysis

LSA

• But first:• What is the difference between LSI and

LSA???– LSI refers to using it for indexing or information

retrieval.– LSA refers to everything else.

Page 24: An Introduction to Latent Semantic Analysis

LSA

• Idea (Deerwester et al):“We would like a representation in which a set of terms, which

by itself is incomplete and unreliable evidence of the relevance of a given document, is replaced by some other set of entities which are more reliable indicants. We take advantage of the implicit higher-order (or latent) structure in the association of terms and documents to reveal such relationships.”

Page 25: An Introduction to Latent Semantic Analysis

LSA

• Implementation: four basic steps– term by document matrix (more generally term

by context) tend to be sparce– convert matrix entries to weights, typically:

• L(i,j) * G(i): local and global• a_ij -> log(freq(a_ij)) divided by entropy for row (-

sum (p logp), over p: entries in the row)– weight directly by estimated importance in passage– weight inversely by degree to which knowing word

occurred provides information about the passage it appeared in

Page 26: An Introduction to Latent Semantic Analysis

LSA

• Four basic steps– Rank-reduced Singular Value Decomposition (SVD)

performed on matrix• all but the k highest singular values are set to 0• produces k-dimensional approximation of the original

matrix (in least-squares sense)• this is the “semantic space”

– Compute similarities between entities in semantic space (usually with cosine)

Page 27: An Introduction to Latent Semantic Analysis

LSA

• SVD– unique mathematical decomposition of a

matrix into the product of three matrices:• two with orthonormal columns• one with singular values on the diagonal

– tool for dimension reduction– similarity measure based on co-occurrence– finds optimal projection into low-dimensional

space

Page 28: An Introduction to Latent Semantic Analysis

LSA

• SVD– can be viewed as a method for rotating the axes in

n-dimensional space, so that the first axis runs along the direction of the largest variation among the documents

• the second dimension runs along the direction with the second largest variation

• and so on

– generalized least-squares method

Page 29: An Introduction to Latent Semantic Analysis

A Small Example

Technical Memo Titlesc1: Human machine interface for ABC computer applicationsc2: A survey of user opinion of computer system response timec3: The EPS user interface management systemc4: System and human system engineering testing of EPSc5: Relation of user perceived response time to error measurement

m1: The generation of random, binary, ordered treesm2: The intersection graph of paths in treesm3: Graph minors IV: Widths of trees and well-quasi-orderingm4: Graph minors: A survey

Page 30: An Introduction to Latent Semantic Analysis

A Small Example – 2

r (human.user) = -.38 r (human.minors) = -.29

c1 c2 c3 c4 c5 m1 m2 m3 m4human 1 0 0 1 0 0 0 0 0interface 1 0 1 0 0 0 0 0 0computer 1 1 0 0 0 0 0 0 0user 0 1 1 0 1 0 0 0 0system 0 1 1 2 0 0 0 0 0response 0 1 0 0 1 0 0 0 0time 0 1 0 0 1 0 0 0 0EPS 0 0 1 1 0 0 0 0 0survey 0 1 0 0 0 0 0 0 1trees 0 0 0 0 0 1 1 1 0graph 0 0 0 0 0 0 1 1 1minors 0 0 0 0 0 0 0 1 1

Page 31: An Introduction to Latent Semantic Analysis

A Small Example – 3

• Singular Value Decomposition{A}={U}{}{V}T

• Dimension Reduction{~A}~={~U}{~}{~V}T

Page 32: An Introduction to Latent Semantic Analysis

A Small Example – 4

• {U} = 0.22 -0.11 0.29 -0.41 -0.11 -0.34 0.52 -0.06 -0.41 0.20 -0.07 0.14 -0.55 0.28 0.50 -0.07 -0.01 -0.11 0.24 0.04 -0.16 -0.59 -0.11 -0.25 -0.30 0.06 0.49 0.40 0.06 -0.34 0.10 0.33 0.38 0.00 0.00 0.01 0.64 -0.17 0.36 0.33 -0.16 -0.21 -0.17 0.03 0.27 0.27 0.11 -0.43 0.07 0.08 -0.17 0.28 -0.02 -0.05 0.27 0.11 -0.43 0.07 0.08 -0.17 0.28 -0.02 -0.05 0.30 -0.14 0.33 0.19 0.11 0.27 0.03 -0.02 -0.17 0.21 0.27 -0.18 -0.03 -0.54 0.08 -0.47 -0.04 -0.58 0.01 0.49 0.23 0.03 0.59 -0.39 -0.29 0.25 -0.23 0.04 0.62 0.22 0.00 -0.07 0.11 0.16 -0.68 0.23 0.03 0.45 0.14 -0.01 -0.30 0.28 0.34 0.68 0.18

Page 33: An Introduction to Latent Semantic Analysis

A Small Example – 5

• {} =

3.342.54

2.351.64

1.501.31

0.850.56

0.36

Page 34: An Introduction to Latent Semantic Analysis

A Small Example – 6

• {V} = 0.20 0.61 0.46 0.54 0.28 0.00 0.01 0.02 0.08-0.06 0.17 -0.13 -0.23 0.11 0.19 0.44 0.62 0.53 0.11 -0.50 0.21 0.57 -0.51 0.10 0.19 0.25 0.08-0.95 -0.03 0.04 0.27 0.15 0.02 0.02 0.01 -0.03 0.05 -0.21 0.38 -0.21 0.33 0.39 0.35 0.15 -0.60-0.08 -0.26 0.72 -0.37 0.03 -0.30 -0.21 0.00 0.36 0.18 -0.43 -0.24 0.26 0.67 -0.34 -0.15 0.25 0.04-0.01 0.05 0.01 -0.02 -0.06 0.45 -0.76 0.45 -0.07-0.06 0.24 0.02 -0.08 -0.26 -0.62 0.02 0.52 -0.45

Page 35: An Introduction to Latent Semantic Analysis

A Small Example – 7c1 c2 c3 c4 c5 m1 m2 m3 m4

human 0.16 0.40 0.38 0.47 0.18 -0.05 -0.12 -0.16 -0.09

interface 0.14 0.37 0.33 0.40 0.16 -0.03 -0.07 -0.10 -0.04

computer 0.15 0.51 0.36 0.41 0.24 0.02 0.06 0.09 0.12

user 0.26 0.84 0.61 0.70 0.39 0.03 0.08 0.12 0.19

system 0.45 1.23 1.05 1.27 0.56 -0.07 -0.15 -0.21 -0.05

response 0.16 0.58 0.38 0.42 0.28 0.06 0.13 0.19 0.22

time 0.16 0.58 0.38 0.42 0.28 0.06 0.13 0.19 0.22

EPS 0.22 0.55 0.51 0.63 0.24 -0.07 -0.14 -0.20 -0.11

survey 0.10 0.53 0.23 0.21 0.27 0.14 0.31 0.44 0.42

trees -0.06 0.23 -0.14 -0.27 0.14 0.24 0.55 0.77 0.66

graph -0.06 0.34 -0.15 -0.30 0.20 0.31 0.69 0.98 0.85

minors -0.04 0.25 -0.10 -0.21 0.15 0.22 0.50 0.71 0.62

r (human.user) = .94 r (human.minors) = -.83

Page 36: An Introduction to Latent Semantic Analysis

A Small Example – 2 reprise

r (human.user) = -.38 r (human.minors) = -.29

c1 c2 c3 c4 c5 m1 m2 m3 m4human 1 0 0 1 0 0 0 0 0interface 1 0 1 0 0 0 0 0 0computer 1 1 0 0 0 0 0 0 0user 0 1 1 0 1 0 0 0 0system 0 1 1 2 0 0 0 0 0response 0 1 0 0 1 0 0 0 0time 0 1 0 0 1 0 0 0 0EPS 0 0 1 1 0 0 0 0 0survey 0 1 0 0 0 0 0 0 1trees 0 0 0 0 0 1 1 1 0graph 0 0 0 0 0 0 1 1 1minors 0 0 0 0 0 0 0 1 1

Page 37: An Introduction to Latent Semantic Analysis

LSA Titles example:Correlations between titles in raw data

c1 c2 c3 c4 c5 m1 m2 m3c2 -0.19c3 0.00 0.00c4 0.00 0.00 0.47c5 -0.33 0.58 0.00 -0.31m1 -0.17 -0.30 -0.21 -0.16 -0.17m2 -0.26 -0.45 -0.32 -0.24 -0.26 0.67m3 -0.33 -0.58 -0.41 -0.31 -0.33 0.52 0.77m4 -0.33 -0.19 -0.41 -0.31 -0.33 -0.17 0.26 0.56

0.02-0.30 0.44

Correlations in first-two dimension space

c2 0.91c3 1.00 0.91c4 1.00 0.88 1.00c5 0.85 0.99 0.85 0.81m1 -0.85 -0.56 -0.85 -0.88 -0.45m2 -0.85 -0.56 -0.85 -0.88 -0.44 1.00m3 -0.85 -0.56 -0.85 -0.88 -0.44 1.00 1.00m4 -0.81 -0.50 -0.81 -0.84 -0.37 1.00 1.00 1.00

CorrelationRaw data

0.92-0.72 1.00

Page 38: An Introduction to Latent Semantic Analysis

Summary

• Some Issues– SVD Algorithm complexity O(n^2k^3)

• n = number of terms• k = number of dimensions in semantic space (typically

small ~50 to 350)• for stable document collection, only have to run once• dynamic document collections: might need to rerun

SVD, but can also “fold in” new documents

Page 39: An Introduction to Latent Semantic Analysis

Summary

• Some issues– Finding optimal dimension for semantic space

• precision-recall improve as dimension is increased until hits optimal, then slowly decreases until it hits standard vector model

• run SVD once with big dimension, say k = 1000– then can test dimensions <= k

• in many tasks 150-350 works well, still room for research

Page 40: An Introduction to Latent Semantic Analysis

Summary

• Some issues– SVD assumes normally distributed data

• term occurrence is not normally distributed• matrix entries are weights, not counts, which may be

normally distributed even when counts are not

Page 41: An Introduction to Latent Semantic Analysis

Summary

• Has proved to be a valuable tool in many areas of NLP as well as IR– summarization– cross-language IR– topics segmentation– text classification– question answering– more

Page 42: An Introduction to Latent Semantic Analysis

Summary

• Ongoing research and extensions include– Bioinformatics– Security– Search Engines– Probabilistic LSA (Hofmann)– Iterative Scaling (Ando and Lee)– Psychology

• model of semantic knowledge representation• model of semantic word learning