+ All Categories
Home > Documents > CS276: Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

CS276: Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Date post: 03-Jan-2016
Category:
Upload: aretha-olsen
View: 21 times
Download: 0 times
Share this document with a friend
Description:
CS276: Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan Lecture 13: Matrix Decompositions and Latent Semantic Indexing (LSI). Eduardo Augusto Silvestre. Ch. 18. Aula de hoje. Seção 18.1.1: desenvolve-se a noção de matrix decomposition . - PowerPoint PPT Presentation
47
Introduction to Information Retrieval Introduction to Information Retrieval CS276: Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan Lecture 13: Matrix Decompositions and Latent Eduardo Augusto Silvestre
Transcript
Page 1: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Introduction to

Information Retrieval

CS276: Information Retrieval and Web SearchChristopher Manning and Prabhakar Raghavan

Lecture 13: Matrix Decompositions and Latent Semantic Indexing (LSI)

Eduardo Augusto Silvestre

Page 2: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Aula de hoje Seção 18.1.1: desenvolve-se a noção de

matrix decomposition. Seção 18.2: usa uma forma especial de

decomposição de matriz para construir um low-rank approximation.

Seção 18.3: usa low-rank approximation e a técnica de latent semantic index.

Ch. 18

Page 3: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Aula de hoje Latent Semantic Index (LSI)

Matriz termo-documento muito grande Podemos representar o espaço termo-

documento por um espaço latente dimensional mais baixo?

Ch. 18

Page 4: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Linear Algebra Background

Page 5: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Autovalores & Autovetores Autovetores (p/ uma matriz quadrada S, mm)

Quantos autovalores existem no máximo?

só tem uma solução não nula se

Essa é uma equação de m-ésima ordem em que λ pode ter no máximo m soluções distintas (raízes do polinômio característico) – pode ser complexo, mesmo S como real.

autovalores(direita) autovetor

Exemplo

Sec. 18.1

Page 6: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Multiplicação de matriz vetor

S 30 0 0

0 20 0

0 0 1

Tem autovalores 30, 20, 1 com correspondente autovetores

0

0

1

1v

0

1

0

2v

1

0

0

3v

Cada autovetor, S age como um múltiplo da matriz identidade: mas como um múltiplo diferente em cada um.

Qualquer vetor (ex. x= ) pode ser visto como uma combinação dos autovetores: x = 2v1 + 4v2 + 6v3

6

4

2

Sec. 18.1

Page 7: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Multiplicação matriz-vetor Assim uma multiplicação matrix-vetor tal como Sx (S,

x como no slide anterior) pode ser reescrita em termos dos autovalores/vetores:

Pensando até mesmo em x como um vetor arbitrário, a ação de S em x é determinada pelo autovalores/autovetores.

Sx S(2v1 4v2 6v 3)

Sx 2Sv1 4Sv2 6Sv 321v1 42v2 63v 3

Sx 60v1 80v2 6v 3

Sec. 18.1

Page 8: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Multiplicação matriz vetor Sugestão: o efeito de “pequenos” autovalores é

pequeno. Se ignormarmos o menor autovalor(1), então ao

invés de

obteríamos

São vetores similares (na similaridade de cossenos, etc.)

60

80

6

60

80

0

Sec. 18.1

Page 9: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Autovalores & Autovetores

0 e , 2121}2,1{}2,1{}2,1{ vvvSv

Para matrizes simétricas, autovetores p/ autovalores distintos são ortogonais

TSS e 0 se , complexosP/ IS

Todos autovalores de uma matriz simétrica real são reais.

0vSv se então ,0, Swww Tn

Todos autovalores de uma matriz positiva semi-definida são não-negativos.

Sec. 18.1

Page 10: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Conecte esses valores e resolva para autovetores.

Exemplo Seja

Então

Os autovalores são1 e 3 (não-negativo, real). Os autovetores são ortogonais(e reais):

21

12S

.01)2(||

21

12

2

IS

IS

1

1

1

1

Real, simétrico.

Sec. 18.1

Page 11: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Seja uma matriz quadrada com m autovetores linearmente independentes (uma matriz não-defeituosa)

Teorama: Existe uma decomposição própria

(cf. teorma diagonalização matriz)

Colunas de U são autovetores de S Diagonal elements de are eigenvalues of

Decomposição própria/diagonal

diagonal Único p/ autovalores distintos

Sec. 18.1

Page 12: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Decomposição diagonal: por que / como

nvvU ...1Seja U tendo os autovetores c/ colunas:

n

nnnn vvvvvvSSU

............

1

1111

Então, SU pode ser escrito

E S=UU–1.

Assim SU=U, orU–1SU=

Sec. 18.1

Page 13: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Exemplo – decomposição diagonal

Recorde .3,1;21

1221

S

Os autovetores e forma

1

1

1

1

11

11U

Invertendo, temos

2/12/1

2/12/11U

Então, S=UU–1 =

2/12/1

2/12/1

30

01

11

11

RelembreUU–1 =1.

Sec. 18.1

Page 14: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Continuação exemplo

Vamos dividir U (e multiplicar U–1) por 2

2/12/1

2/12/1

30

01

2/12/1

2/12/1Então, S=

Q (Q-1= QT )

Sec. 18.1

Why? Stay tuned …

Page 15: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Se é uma matriz simétrica: Teorema: Existe uma (única) decomposição própria

Onde Q é ortogonal: Q-1= QT

Colunas de Q são autovetores normalizados Colunas são ortogonais (tudo é real)

Decomposição própria simétrica

TQQS

Sec. 18.1

Page 16: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Exercício Examine the symmetric eigen decomposition, if any,

for each of the following matrices:

01

10

01

10

32

21

42

22

Sec. 18.1

Page 17: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Time out! Eu vim para essa aula p/ aprender recuperação de

texto e mineração, não quero voltar ao passado da álgebra linear outra vez … Mas se você quer desenterrar a álgebra linear, Strang’s

Applied Mathematics é um bom lugar para começar. O que essas matrizes tem haver com texto? Relembre: M N matrizes termo-documento … Mas tudo daqui em diante precisa de matrizes

quadradas – então …

Page 18: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Decomposição Valor Singular (SVD)

TVUA

MM MN V é NN

P/ uma matriz A, M N, do rank r existe umafatorização (Singular Value Decomposition = SVD)como a seguir:

As colunas de U são autovetores ortogonais de AAT.

As colunas de V são autovetores ortogonais de ATA.

ii

rdiag ...1 Valores singulares

Autovalores 1 … r de AAT são autovalores de ATA.

Sec. 18.2

Page 19: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Decomposição do valor singular Ilustrações das dimensões do SVD e espalhamento

Sec. 18.2

Page 20: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Exemplo SVD

Seja

01

10

11

A

Assim M=3, N=2. Seu SVD é

2/12/1

2/12/1

00

30

01

3/16/12/1

3/16/12/1

3/16/20

Tipicamente, os valores singulares são arranjados em ordem decrescente.

Sec. 18.2

Page 21: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

SVD pode ser usado para cacular low-rank approximations ótimo.

Problema aproximação: Encontrar Ak do ranking k tal que

Ak e X são ambas matrizes mn

Tipicamente, queremos k << r.

Low-rank Approximation

Frobenius normFkXrankX

k XAA

min)(:

Sec. 18.3

Page 22: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Solução via SVD

Low-rank Approximation

Ajuste os menores valores singulares r-k para zero

Tkk VUA )0,...,0,,...,(diag 1

Notação coluna: soma dorank de 1 “matrizes”

Tii

k

i ik vuA

1

k

Sec. 18.3

Page 23: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Se retermos somente k valores singulares e alterarmos o resto para 0, então não precisamos das partes da matriz em marrom

EntãoΣ é k×k, U é M×k, VT é k×N, e Ak é M×N Chamado de SVD reduzido. É conveniente (space-

saving) , comum p/ aplicações computacionais Isso é o que Matlab nos dá

SVD Reduzido

k

Sec. 18.3

Page 24: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Erro aproximação Quão bom (ruim) é sua aproximação? Ela é a melhor possível, medida pela norma do erro

de Frobenius:

onde i é ordenado tal que i i+1.

Sugira por que erro de Frobenius baixa quando k é aumentado

1)(:

min

kFkFkXrankX

AAXA

Sec. 18.3

Page 25: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

SVD Low-rank approximation Enquanto a matriz termo-doc A pode ter M=50000,

N=10 million (e rank perto de 50000) Podemos construir uma aproximação A100 com rank

100. De todas as 100 matrizes, ela teria o menor erro

Frobenius. Ok…mas porque teríamos ?? Reposta: Latent Semantic Indexing (Indexação

Semântica Latente)

C. Eckart, G. Young, The approximation of a matrix by another of lower rank. Psychometrika, 1, 211-218, 1936.

Sec. 18.3

Page 26: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Latent Semantic Indexing via SVD

Page 27: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

O que é Da matriz termo-doc A, calculamos a

aproximação Ak.

Existe uma linha p/ cada termo e uma coluna p/ cada documento em Ak

Assim documentos “vivem” em um espaço de k << r dimensões Essas dimensões não são os eixos originais

Mas por quê?

Sec. 18.4

Page 28: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Modelo espaço vetor: Prós Seleção Automática dos termos do índice Emparalhemanto parcial das consultas e

documentos (tratando o caso onde o documento não tem todos os termos da consulta)

Ranking de acordo com pontuação de similaridade (tratando grandes conjuntos de resultados)

Esquemas pesos para os termos (melhora a performance na recuperação)

Várias extensões Clustering de documentos Feedback relevância (modificando o vetor da consulta)

Geometric foundation

Page 29: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Problemas com Semântica Léxica Ambiguidade e associação na lgg natural

Polissemia: Palavras frequentemente tem uma grande número de signficados e diferentes tipos de uso (mais severo em muitas coleções heterogêneas).

Esse modelo de espaço vetor não é capaz de diferenciar entre diferentes signficados de uma mesma palavras.

Page 30: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Problemas com Semântica Léxica Sinônimos: Diferentes termos podem ter

signficados similares ou idênticos (weaker: palavras indicando o mesmo resultado).

Associações entre palavras não são feitas na representação espaço vetor.

Page 31: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Polissemia e Contexto Similaridade de documentos no nível de uma palavra

única: polissemia e contexto

carcompany

•••dodgeford

Signficado 2

ringjupiter

•••space

voyagerSignficado 1…

saturn...

…planet

...

Contribuição p/ similaridade, Se usado o primeiro signficado, mas não em segundo

Page 32: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Latent Semantic Indexing (LSI) Realiza uma low-rank approximation de document-

term matrix (rank típico 100-300) Idéia geral

Mapeia documentos (e termos) p/ uma representação low-dimensional.

Projeta uma mapeamento tal que o espaço low-dimensional reflete associações semânticas (espaço semântico latente).

Calcula a similaridade de um documento baseado no produto interno no seu espaço semântico latente

Sec. 18.4

Page 33: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Objetivos de LSI

Termos similares mapeados para lugares similares no espaço low dimensional

Redução do ruído pela redução da dimensão

Sec. 18.4

Page 34: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Análise da Semântica Latente Espaço semântico latente: exemplo de ilustração

courtesy of Susan Dumais

Sec. 18.4

Page 35: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Realizando os mapas Cada linha e coluna de A gets mapped into the k-

dimensional LSI space, by the SVD. Reivindicação - isso não é só o mapeamento com a

melhor aproximação (erro Frobenius) para A, mas de fato melhora a recuperação.

Uma consulta q é também mapeada dentro desse espaço, por

Consulta em um vetor não esparso

1 kkT

k Uqq

Sec. 18.4

Page 36: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Evidências empíricas Experimentos emTREC 1/2/3 – Dumais Lanczos SVD código (disponível em netlib) devido

à Berry usado nesses experimentos Executando vezes de ~ um dia em dezenas de

centenas de documentos [obstáculo para o uso] Dimensões – vários valores 250-350 relatados.

Reduzindo k melhora recall. (Abaixo de 200 relataram não satisfatórios)

Geralmente espera o recall melhorar – e sobre precision?

Sec. 18.4

Page 37: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Evidência empírica Precisa ou acima da precisão média do TREC

Top scorer em quase 20% dos tópicos TREC Um pouco melhor na média que espaços de

vetores Efeito da dimensionalidade:

Dimensões Precisão

250 0.367

300 0.371

346 0.374

Sec. 18.4

Page 38: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Modos de falha Frases negadas

Tópicos doTREC as vezes negam certas consultas/frases de termos – impedem a conversão automática de tópicos para o espaço semântica latente.

Consultas booleanas Usualmente, texo livre/sintaxe do espaço vetor de

consultas LSI impedem (dizer) “Encontre qualquer documento tendo satisfazer as seguintes 5 companias”

Veja Dumais para mais.

Sec. 18.4

Page 39: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Clustering? Falamos sobre docs, consultas, recuperação

e precisão aqui. O que isso tem haver com clustering? Intuição: Redução de dimensão através LSI

traz junto eixos “relacionados” no espaço vetor.

Sec. 18.4

Page 40: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Intuição de blocos de matrizes

Bloco1

Bloco 2

Bloco k0’s

0’s

= blocos homogêneos não-nulos

Mtermos

N documentos

Qual o rank dessa matriz ?

Page 41: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Intuição de blocos de matrizes

Bloco 1

Bloco 2

Bloco k0’s

0’sMtermos

N documentos

Vocabulário particionado em k tópicos (clusters); cada documento discute em somente um tópico.

Page 42: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Intuição de blocos de matrizes

Bloco1

Bloco 2

Bloco k0’s

0’s

= entradas não-nulas

Mtermos

N documentos

Qual a melhor aproximação do rank-k p/ essa matriz?

Page 43: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Intuição de blocos de matrizes

Bloco 1

Bloco 2

Bloco k

Poucas entradas não-zeros

AramePneuV6

CarroAutomóvel

110

0

Provavelmente existe uma boa aproximação do rank-k p/ essa matriz.

Poucas entradas não-zeros

Page 44: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Figura simplistaTópico 1

Tópico 2

Tópico 3

Page 45: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Algumas extrapolações A “dimensionalidade” de um corpus é o

número de tópicos distintos representados nele.

Mais extrapolações matemáticas: Se A tem um rank de aproximação k de

baixo erro Frobenius, então não existem mais que k tópicos distintos no corpus.

Page 46: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

LSI tem outras aplicações Em muitos cenários no reconhecimento de padrões e

recuperação, temos uma matriz objeto característica. P/ tetxo, os termos são características e os documentos

são objetos. Podia ser opiniões e usuários … Essa matriz pode ser redundante em dimensionalidade. Pode trabalhar com low-rank approximation. Se estão faltando entradas (isto é, opiniões dos usuários),

pode recuperar se a dimensionalidade é baixa. Técnica analítica geralmente poderosa

Princípio análogo aos métodos de clustering

Page 47: CS276:  Information Retrieval and Web Search Christopher Manning and Prabhakar Raghavan

Introduction to Information RetrievalIntroduction to Information Retrieval

Resources

IIR 18


Recommended