Sequence Labeling, Contd - Sameer...

30
Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP WINTER 2017 February 2, 2017 Based on slides from Dan Klein, and everyone else he copied from.

Transcript of Sequence Labeling, Contd - Sameer...

Page 1: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

SequenceLabeling,Contd

Prof.SameerSinghCS295:STATISTICALNLP

WINTER2017

February2,2017

BasedonslidesfromDanKlein,andeveryoneelsehecopiedfrom.

Page 2: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Outline

CS295:STATISTICALNLP(WINTER2017) 2

MarginalInferenceinHMMs:F/Balgorithm

MaximumEntropyMarkovModels

ConditionalRandomFields

NeuralSequenceTagging

Page 3: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Outline

CS295:STATISTICALNLP(WINTER2017) 3

MarginalInferenceinHMMs:F/Balgorithm

MaximumEntropyMarkovModels

ConditionalRandomFields

NeuralSequenceTagging

Page 4: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

ExpectationMaximization

CS295:STATISTICALNLP(WINTER2017) 4

K-Means

InitializationPickKrandomcentroids

LabelDatafromtheModelClusterallthepoints

UpdatetheModelfromData

Updatecentroids

Page 5: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

LabelDatafromtheModel

CS295:STATISTICALNLP(WINTER2017) 5

Hard-EM

Soft-EM

Page 6: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

DynamicProgramming

CS295:STATISTICALNLP(WINTER2017) 6

Page 7: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

ForwardBackwardAlgorithm

CS295:STATISTICALNLP(WINTER2017) 7

Page 8: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

UpdatingtheModelfromData

CS295:STATISTICALNLP(WINTER2017) 8

Hard-EM

Soft-EM

Page 9: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Outline

CS295:STATISTICALNLP(WINTER2017) 9

MarginalInferenceinHMMs:F/Balgorithm

MaximumEntropyMarkovModels

ConditionalRandomFields

NeuralSequenceTagging

Page 10: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

NamedEntityRecognition

CS295:STATISTICALNLP(WINTER2017) 10

GeorgeW.BushspokefromtheWhiteHousetoday.

PERPER PEROOOLOCLOCOO

B-PERI-PERI-PEROOOB-LOCI-LOCOO

B-PERI-PERE-PEROOOB-LOCE-LOCOO

Page 11: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Max.EntropyMarkovModels

CS295:STATISTICALNLP(WINTER2017) 11

Page 12: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

GraphicalModelNotation

CS295:STATISTICALNLP(WINTER2017) 12

S E

HMMs

S E

MEMMs

Page 13: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

AddingFeatures(forPOS)

CS295:STATISTICALNLP(WINTER2017) 13

CurrentWord

WindowWords

Page 14: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

AddingFeatures

CS295:STATISTICALNLP(WINTER2017) 14

S E

Page 15: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

PredictionsUsingMEMMs

CS295:STATISTICALNLP(WINTER2017) 15

Greedy

ViterbiDecoding

Page 16: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

TrainingMEMMs

CS295:STATISTICALNLP(WINTER2017) 16

Page 17: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Outline

CS295:STATISTICALNLP(WINTER2017) 17

MarginalInferenceinHMMs:F/Balgorithm

MaximumEntropyMarkovModels

ConditionalRandomFields

NeuralSequenceTagging

Page 18: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

LabelBiasProblem

CS295:STATISTICALNLP(WINTER2017) 18

S

O O O

I I I

B B B

E

B B

Page 19: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

ConditionalRandomFields

CS295:STATISTICALNLP(WINTER2017) 19

Page 20: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

GraphicalModelNotation

CS295:STATISTICALNLP(WINTER2017) 20

S E

HMMs/MEMMs

S E

CRFs

Page 21: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

PredictionsUsingCRFs

CS295:STATISTICALNLP(WINTER2017) 21

Page 22: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

LikelihoodTrainingofCRFs

CS295:STATISTICALNLP(WINTER2017) 22

Page 23: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

LikelihoodTrainingofCRFs

CS295:STATISTICALNLP(WINTER2017) 23

Page 24: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Forward-BackwardAlgorithm

CS295:STATISTICALNLP(WINTER2017) 24

Page 25: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Outline

CS295:STATISTICALNLP(WINTER2017) 25

MarginalInferenceinHMMs:F/Balgorithm

MaximumEntropyMarkovModels

ConditionalRandomFields

NeuralSequenceTagging

Page 26: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

SimpleNeuralTagger

CS295:STATISTICALNLP(WINTER2017) 26

PRP

I

VB

love

NN

foodStart End

Page 27: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

MEMM-ish NeuralTagger

CS295:STATISTICALNLP(WINTER2017) 27

PRP

I

VB

love

NN

foodStart End

S E

Page 28: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

RecurrentNeuralTagger

CS295:STATISTICALNLP(WINTER2017) 28

PRP

I

VB

love

NN

food

Page 29: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

BidirectionalRNNTagger

CS295:STATISTICALNLP(WINTER2017) 29

PRP

I

VB

love

NN

food

Page 30: Sequence Labeling, Contd - Sameer Singhsameersingh.org/.../wi17/slides/lecture-0202-sequence-labeling-contd… · Sequence Labeling, Contd Prof. Sameer Singh CS 295: STATISTICAL NLP

Upcoming…

CS295:STATISTICALNLP(WINTER2017) 30

• Homework2isdue(~10days):February13,2017• Write-up,data,andcodeforHomework2isup• Askquestionsearly!

Homework

• ProposalisdueonTuesday:February7,2017• Only2pagesProject

• Papersummaries:February17,February28,March14• Only1 pageeachSummaries