modeling topics and knowledge bases with embeddings · 2016. 12. 6. · 1=2 ˇ0 i good...

15
Modeling Topics and Knowledge Bases with Embeddings Dat Quoc Nguyen and Mark Johnson Department of Computing Macquarie University Sydney, Australia December 2016 1 / 15

Upload: others

Post on 26-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Modeling Topics and Knowledge Baseswith Embeddings

Dat Quoc Nguyen and Mark Johnson

Department of ComputingMacquarie UniversitySydney, Australia

December 2016

1 / 15

Page 2: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Vector representations/embeddings of words

• One-hot representation: high-dimensional and sparse vectorI Vocabulary size: NI N-dimensional vector: filled with 0s, except for a 1 at the position

associated with word index

2 / 15

Page 3: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Vector representations/embeddings of words

• Deep learning evolution: most neural network toolkits do not play wellwith one-hot representations

I Dense vector: low-dimensional distributed vector representationI Vector size k � N, for example: k = 100, Vocabulary size N = 100000

3 / 15

Page 4: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Vector representations/embeddings of words

• Unsupervised learning modelsare proposed to learn low-dimensional vectors of wordsefficiently, e.g W2V Skip-gram

• Word embeddings learnedfrom large external corporacapture various aspects ofword meanings

I Possibly assign topics(i.e. labels) to clusters of“similar” meaning words

I Topic 1 for {banking,bank, transaction, finance,

money laundering}⇒Can we incorporate wordembeddings to topic models?

4 / 15

Page 5: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Improving topic models with word embeddings

• Topic models take a corpus of documents as input, and

I Learn a set of latent topics for the corpus

I Infer document-to-topic and topic-to-word distributions fromco-occurrence of words within documents

• If the corpus is small and/or the documents are short, the topics will benoisy due to the limited information of word co-occurrence

• IDEA: Use the word embeddings learned on a large external corpus toimprove the topic-word distributions in a topic model

5 / 15

Page 6: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Improving topic models with word embeddings

• Each word w is associated with a pre-trained word embedding ωw

• Each topic t is associated with a topic embedding τ t

• We define a latent feature topic-to-word distribution CatE(w) over words:

CatE(w | t) =exp(ωw · τ t)∑

w ′∈V exp(ωw ′ · τ t)

I Optimize the log-loss to learn τ t

• Our new topic models mix the CatE distribution with a multinomialdistribution over words

I Combine information from a large, general corpus (via the CatEdistribution) and a smaller but more specific corpus (via the multinomialdistribution)

6 / 15

Page 7: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Improving topic models with word embeddings

• Combine Latent Dirichlet Allocation (LDA) and Dirichlet MultinomialMixture (DMM) with the word embeddings: LF-LDA & LF-DMM

(LDA) (LF-LDA)

(DMM) (LF-DMM)

7 / 15

Page 8: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Improving topic models with word embeddingsTopic 1 Topic 3 Topic 4

DMM LF-DMM DMM LF-DMM DMM LF-DMM

japan japan u.s. prices egypt libyanuclear nuclear oil sales china egyptu.s. u.s. japan oil u.s irancrisis plant prices u.s. mubarak mideastplant quake stocks profit bin oppositionchina radiation sales stocks libya protestslibya earthquake profit japan laden leaderradiation tsunami fed rise france syriau.n. nuke rise gas bahrain u.n.vote crisis growth growth air tunisiakorea disaster wall shares report chiefeurope power street price rights protestersgovernment oil china profits court mubarak

election japanese fall rises u.n. crackdowndeal plants shares earnings war bahrain (Topic coherence)

• Significant improvement of topic coherence scores on all models andexperimental corpora

• Obtain 5+% absolute improvements in clustering and classificationevaluation scores on the small or short datasets

• No reliable difference between pre-trained Word2Vec and Glove vectors

8 / 15

Page 9: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Vector representations/embeddings: “distance” results

vking − vqueen ≈ vman − vwoman

vVietnam − vHanoi

≈ v Japan − vTokyo

≈ vGermany − vBerlin

≈ v some relationship, saying : is capital of

vHanoi + v is capital of ≈ vVietnam

vTokyo + v is capital of ≈ v Japan

vBerlin + v is capital of ≈ vGermany

Triple (head entity , relation, tail entity)

vh + v r ≈ v t

⇒ ‖vh + v r − v t‖`1/2 ≈ 0

Link prediction in knowledge bases?9 / 15

Page 10: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

STransE: a new embedding model for link prediction

• Knowledge bases (KBs) of real-world triple facts(head entity, relation, tail entity) are usefulresources for NLP tasks

• Issue: large KBs are still far from complete

• So it is useful to perform link prediction in KBs orknowledge base completion: predict which triplesnot in a knowledge base are likely to be true

• Embedding models for link prediction in KBs:

I Associate entities and/or relations with densefeature vectors or matrices

I Obtain SOTA performance and generalize to largeKBs

10 / 15

Page 11: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

STransE: a new embedding model for link prediction

• The TransE model (Bordes et al., 2013) represents each relation r by atranslation vector v r , which is chosen so that ‖vh + v r − v t‖`1/2 ≈ 0

I Good for 1-to-1 relationships, e.g: is capital of

I Not good for 1-to-Many, Many-to-1 and Many-to-Many, e.g: gender

• STransE: a novel embedding model of entities and relationships in KBs

I Our STransE represents each entity as a low dimensional vector, and eachrelation by two matrices and a translation vector

I STransE choose matrices Wr ,1 and Wr ,2, and vector v r so that:‖Wr ,1vh + v r −Wr ,2v t‖`1/2 ≈ 0

I Optimize a margin-based objective function to learn the vectors and matrices

11 / 15

Page 12: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

STransE results for link prediction in KBs

• We conducted experiments on twobenchmark datasets WN18 andFB15k (Bordes et al., 2013)

Dataset #E #R #Train #Valid #TestWN18 40,943 18 141,442 5,000 5,000FB15k 14,951 1,345 483,142 50,000 59,071

• Link prediction task:

I Predict h given (?, r , t) orpredict t given (h, r , ?) where ?denotes the missing element

I Evaluation metrics: mean rank(MR) and Hits@10 (H10)

MethodWN18 FB15k

MR H10 MR H10

TransE 251 89.2 125 47.1

TransH 303 86.7 87 64.4

TransR 225 92.0 77 68.7

CTransR 218 92.3 75 70.2

KG2E 348 93.2 59 74.0

TransD 212 92.2 91 77.3

TATEC - - 58 76.7

STransE 206 93.4 69 79.7

rTransE - - 50 76.2

PTransE - - 58 84.6

• Find a new relation-path based embedding model in our CoNLL paper!

12 / 15

Page 13: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

STransE results for search personalization

• Two users search using the same keywords, they are often looking fordifferent information (i.e. difference due to the users’ interests)

• Personalized search customizes results based on user’s search history (i.e.submitted queries and clicked documents)

• Let (q, u, d) represent a triple (query, user, document)

• Represent the user u by two matrices Wu,1 and Wu,2 and a vector vu,which represents the user’s topical interests, so that:

‖Wu,1vq + vu −Wu,2vd‖`1/2 ≈ 0

• vd and vq are pre-determined by employing the LDA topic model

• Optimize a margin-based objective function to learn the user embeddingsand matrices

Metric Search Eng. L2R SP STransE TransEMRR 0.559 0.631+12.9% 0.656+17.3% 0.645+15.4%

P@1 0.385 0.452+17.4% 0.501+30.3% 0.481+24.9%

13 / 15

Page 14: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Conclusions

‖Wr ,1vh + v r −Wr ,2v t‖`1/2

• Latent feature vector representationsinduced from large external corporacan be used to improve topic modelingon smaller datasets

• Our new embedding model STransEfor link prediction in KBs

I Applying to a search personalizationtask, STransE helps to significantlyimprove the ranking quality

• https://github.com/datquocnguyen

14 / 15

Page 15: Modeling Topics and Knowledge Bases with Embeddings · 2016. 12. 6. · 1=2 ˇ0 I Good for1-to-1relationships, e.g: is capital of I Not good for1-to-Many,Many-to-1andMany-to-Many,

Thank you for your attention!

• Dat Quoc Nguyen, Richard Billingsley, Lan Du and Mark Johnson. Improving TopicModels with Latent Feature Word Representations. Transactions of the ACL, 2015.

• Dat Quoc Nguyen, Kairit Sirts, Lizhen Qu and Mark Johnson. STransE: a novelembedding model of entities and relationships in knowledge bases. In Proceedings ofNAACL-HLT, 2016.

• Dat Quoc Nguyen, Kairit Sirts, Lizhen Qu and Mark Johnson. Neighborhood MixtureModel for Knowledge Base Completion. In Proceedings of CoNLL, 2016.

• Thanh Vu∗, Dat Quoc Nguyen∗, Mark Johnson, Dawei Song and Alistair Willis. SearchPersonalization with Embeddings. In Proceedings of ECIR 2017, to appear.

15 / 15