lecture 3: structures and decodingnasmith/psnlp/lecture3.pdf · • general algorithm for exact map...

70
Lecture 3: Structures and Decoding

Upload: others

Post on 12-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Lecture3:StructuresandDecoding

Page 2: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Outline

1.  StructuresinNLP2.  HMMsasBNs–  ViterbialgorithmasvariableeliminaBon

3.  Linearmodels

4.  Fiveviewsofdecoding

Page 3: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

TwoMeaningsof“Structure”

•  Yesterday:structureofagraphformodelingacollecBonofrandomvariablestogether.

•  Today:linguisBcstructure.– Sequencelabelings(POS,IOBchunkings,…)– Parsetrees(phrase‐structure,dependency,…)– Alignments(word,phrase,tree,…)– Predicate‐argumentstructures– Text‐to‐text(translaBon,paraphrase,answers,…)

Page 4: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

AUsefulAbstracBon?

•  Wethinkso.•  BringsoutcommonaliBes:– Modelingformalisms(e.g.,linearmodelswithfeatures)

– Learningalgorithms(lectures4‐6)– Genericinferencealgorithms

•  Permitssharingacrossawiderspaceofproblems.

•  Disadvantage:hidesengineeringdetails.

Page 5: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

FamiliarExample:HiddenMarkovModels

Page 6: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  XandYarebothsequencesofsymbols– XisasequencefromthevocabularyΣ– YisasequencefromthestatespaceΛ

•  Parameters:– TransiBonsp(y’|y)•  includingp(stop |y),p(y|start)

– Emissionsp(x|y)

Page 7: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  Thejointmodel’sindependenceassumpBonsareeasytocapturewithaBayesiannetwork.

Y1

X1

Y0 Y2

X2

Y3

X3

Yn

Xn

stop …

Page 8: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  ThejointmodelinstanBatesdynamicBayesiannetworks.

Yi

Xi

Yi‐1Y0 templatethatgetscopiedasmanyBmesasneeded

Page 9: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  GivenX’svalueasevidence,thedynamicpartbecomesunnecessary,sinceweknown.

Y1

X1=x1

Y0 Y2

X2=x2

Y3

X3=x3

Yn

Xn=xn

stop …

Page 10: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  TheusualinferenceproblemistofindthemostprobablevalueofYgivenX=x.

Y1

X1=x1

Y0 Y2

X2=x2

Y3

X3=x3

Yn

Xn=xn

stop …

Page 11: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  TheusualinferenceproblemistofindthemostprobablevalueofYgivenX=x.

•  Factorgraph:

Y1

X1=x1

Y0 Y2

X2=x2

Y3

X3=x3

Yn

Xn=xn

stop …

Page 12: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  TheusualinferenceproblemistofindthemostprobablevalueofYgivenX=x.

•  Factorgraphaferreducingfactorstorespectevidence:

Y1 Y2 Y3 Yn…

Page 13: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  TheusualinferenceproblemistofindthemostprobablevalueofYgivenX=x.

•  Cleverorderingshouldbeapparent!

Y1 Y2 Y3 Yn…

Page 14: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  WhenweeliminateY1,wetakeaproductofthreerelevantfactors.•  p(Y1|start)•  η(Y1)=reducedp(x1|Y1)•  p(Y2|Y1)

Y1 Y2 Y3 Yn…

Page 15: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  WhenweeliminateY1,wefirsttakeaproductoftwofactorsthatonlyinvolveY1.

Y1 Y2 Y3 Yn…

y1y2…

y|Λ|y1y2…

y|Λ|η(Y1)=reducedp(x1|Y1)

p(Y1|start)

Page 16: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  WhenweeliminateY1,wefirsttakeaproductoftwofactorsthatonlyinvolveY1.

•  ThisistheViterbiprobabilityvectorforY1.

Y1 Y2 Y3 Yn…y1y2…

y|Λ|φ1(Y1)

Page 17: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  WhenweeliminateY1,wefirsttakeaproductoftwofactorsthatonlyinvolveY1.

•  ThisistheViterbiprobabilityvectorforY1.•  EliminaBngY1equatestosolvingtheViterbiprobabiliBesforY2.

Y1 Y2 Y3 Yn…y1y2…

y|Λ|φ1(Y1)

y1

y2

y|Λ|p(Y2|Y1)

Page 18: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HiddenMarkovModel

•  ProductofallfactorsinvolvingY1,thenreduce.•  φ2(Y2)=maxy∈Val(Y1)(φ1(y)⨉p(Y2|y))

•  ThisfactorholdsViterbiprobabiliiesyforY2.

Y2 Y3 Yn…

Page 19: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Y2

HiddenMarkovModel

•  WhenweeliminateY2,wetakeaproductoftheanalogoustworelevantfactors.

•  Thenreduce.•  φ3(Y3)=maxy∈Val(Y2)(φ2(y)⨉p(Y3|y))

Y3 Yn…

Page 20: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Yn

HiddenMarkovModel

•  Attheend,wehaveonefinalfactorwithonerow,φn+1.

•  Thisisthescoreofthebestsequence.•  Usebacktracetorecovervalues.

Page 21: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

WhyThinkThisWay?

•  EasytoseehowtogeneralizeHMMs.– Moreevidence– Morefactors– Morehiddenstructure– Moredependencies

•  ProbabilisBcinterpretaBonoffactorsisnot centraltofindingthe“best”Y…– ManyfactorsarenotcondiBonalprobabilitytables.

Page 22: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

GeneralizaBonExample1

•  Eachwordalsodependsonpreviousstate.

Y1

X1 X2 X3 X4 X5

Y2 Y3 Y4 Y5

Page 23: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

GeneralizaBonExample2

•  “Trigram”HMM

Y1

X1 X2 X3 X4 X5

Y2 Y3 Y4 Y5

Page 24: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

GeneralizaBonExample3

•  Aggregatebigrammodel(SaulandPereira,1997)

Y1

X1 X2 X3 X4 X5

Y2 Y3 Y4 Y5

Page 25: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

GeneralDecodingProblem

•  Twostructuredrandomvariables,XandY.– SomeBmesdescribedascollec,onsofrandomvariables.

•  “Decode”observedvalueX=xintosomevalueofY.

•  Usually,weseektomaximizesomescore.– E.g.,MAPinferencefromyesterday.

Page 26: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

LinearModels

•  DefineafeaturevectorfuncBongthatmaps(x,y)pairsintod‐dimensionalrealspace.

•  Scoreislinearing(x,y).

•  Results:–  decodingseeksytomaximizethescore.–  learningseekswto…dosomethingwe’lltalkaboutlater.

•  Extremelygeneral!

Page 27: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

GenericNoisyChannelasLinearModel

•  Ofcourse,thetwoprobabilitytermsaretypicallycomposedof“smaller”factors;eachcanbeunderstoodasanexponenBatedweight.

Page 28: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

MaxEntModelsasLinearModels

Page 29: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

HMMsasLinearModels

Page 30: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

RunningExample

•  IOBsequencelabeling,hereappliedtoNER•  OfensolvedwithHMMs,CRFs,M3Ns…

Page 31: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each
Page 32: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

(WhatisNotALinearModel?)

•  Modelswithhiddenvariables

•  Modelsbasedonnon‐linearkernels

Page 33: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Decoding

•  ForHMMs,thedecodingalgorithmweusuallythinkoffirstistheViterbialgorithm.– Thisisjustoneexample.

•  Wewillviewdecodinginfivedifferentways.– Sequencemodelsasarunningexample.– TheseviewsarenotjustforHMMs.– SomeBmestheywillleadusbacktoViterbi!

Page 34: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

FiveViewsofDecoding

Page 35: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

1.ProbabilisBcGraphicalModels

•  ViewthelinguisBcstructureasacollecBonofrandomvariablesthatareinterdependent.

•  Representinterdependenciesasadirectedorundirectedgraphicalmodel.

•  CondiBonalprobabilitytables(BNs)orfactors(MNs)encodetheprobabilitydistribuBon.

Page 36: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

InferenceinGraphicalModels

•  GeneralalgorithmforexactMAPinference:variableeliminaBon.–  IteraBvelysolveforthebestvaluesofeachvariablecondiBonedonvaluesof“preceding”neighbors.

– Thentraceback.

TheViterbialgorithmisaninstanceofmax‐productvariableeliminaBon!

Page 37: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

MAPisLinearDecoding

•  Bayesiannetwork:

•  Markovnetwork:

•  ThisonlyworksifeveryvariableisinXorY.

Page 38: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

InferenceinGraphicalModels

•  Remember:moreedgesmakeinferencemoreexpensive.– Feweredgesmeansstrongerindependence.

•  Reallypleasant:

Page 39: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

InferenceinGraphicalModels

•  Remember:moreedgesmakeinferencemoreexpensive.– Feweredgesmeansstrongerindependence.

•  Reallyunpleasant:

Page 40: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

2.Polytopes

Page 41: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

“Parts”

•  AssumethatfeaturefuncBongbreaksdownintolocalparts.

•  Eachparthasanalphabetofpossiblevalues.– Decodingischoosingvaluesforallparts,withconsistencyconstraints.

–  (Inthegraphicalmodelsview,apartisaclique.)

Page 42: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Example

•  Onepartperword,eachisin{B,I,O}•  NofeatureslookatmulBpleparts– Fastinference– Notveryexpressive

Page 43: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Example

•  Onepartperbigram,eachisin{BB,BI,BO,IB,II,IO,OB,OO}

•  Featuresandconstraintscanlookatpairs– Slowerinference– Abitmoreexpressive

Page 44: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

GeometricView

•  Letzi,πbe1ifpartitakesvalueπand0otherwise.

•  zisavectorin{0,1}N– N =totalnumberoflocalizedpartvalues– Eachzisavertexoftheunitcube

Page 45: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

ScoreisLinearinz

notreallyequal;needtotransformbacktogety

Page 46: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Polyhedra

•  NotallverBcesoftheN‐dimensionalunitcubesaBsfytheconstraints.– E.g.,can’thavez1,BI=1 andz2,BI=1

•  SomeBmeswecanwritedownasmall(polynomialnumber)oflinearconstraintsonz.

•  Result:linearobjecBve,linearconstraints,integerconstraints…

Page 47: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each
Page 48: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

IntegerLinearProgramming

•  Veryeasytoaddnewconstraintsandnon‐localfeatures.

•  ManydecodingproblemshavebeenmappedtoILP(sequencelabeling,parsing,…),butit’snot alwaystrivial.

•  NP‐hardingeneral.–  ButtherearepackagesthatofenworkwellinpracBce(e.g.,CPLEX)

–  Specializedalgorithmsinsomecases–  LPrelaxaBonforapproximatesoluBons

Page 49: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each
Page 50: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Remark

•  GraphicalmodelsassumedaprobabilisBcinterpretaBon– ThoughtheyarenotalwayslearnedusingaprobabilisBcinterpretaBon!

•  ThepolytopeviewisagnosBcabouthowyouinterprettheweights.–  ItonlysaysthatthedecodingproblemisanILP.

Page 51: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

3.WeightedParsing

Page 52: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Grammars

•  Grammarsareofenassociatedwithnaturallanguageparsing,buttheyareextremelypowerfulforimposingconstraints.

•  Wecanaddweightstothem.– HMMsareakindofweightedregulargrammar(closelyconnectedtoWFSAs)

–  PCFGsareakindofweightedCFG– Many,manymore.

•  Weightedparsing:findthemaximum‐weightedderivaBonforastringx.

Page 53: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

DecodingasWeightedParsing

•  EveryvalidyisagrammaBcalderivaBon(parse)forx.– HMM:sequenceof“grammaBcal”statesisoneallowedbythetransiBontable.

•  Augmentparsingalgorithmswithweightsandfindthebestparse.

TheViterbialgorithmisaninstanceofrecogniBonbyaweightedgrammar!

Page 54: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

BIOTaggingasaCFG

•  Weighted(orprobabilisBc)CKYisadynamicprogrammingalgorithmverysimilarinstructuretoclassicalCKY.

Page 55: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

4.PathsandHyperpaths

Page 56: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

BestPath

•  Generalidea:takexandbuildagraph.•  Scoreofapathfactorsintotheedges.

•  Decodingisfindingthebest path.

TheViterbialgorithmisaninstanceoffindingabestpath!

Page 57: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

“Lavce”ViewofViterbi

Page 58: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

MinimumCostHyperpath

•  Generalidea:takexandbuildahypergraph.•  Scoreofahyperpathfactorsintothehyperedges.

•  Decodingisfindingthebesthyperpath.

•  ThisconnecBonwaselucidatedbyKleinandManning(2002).

Page 59: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

ParsingasaHypergraph

Page 60: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

ParsingasaHypergraph

cf. “Dean for democracy”

Page 61: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

ParsingasaHypergraph

Forced to work on his thesis, sunshine streaming in the window, Mike experienced a …

Page 62: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

ParsingasaHypergraph

Forced to work on his thesis, sunshine streaming in the window, Mike began to …

Page 63: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

WhyHypergraphs?

•  Useful,compactencodingofthehypothesisspace.– Buildhypothesisspaceusinglocalfeatures,maybedosomefiltering.

– Passitofftoanothermoduleformorefine‐grainedscoringwithricherormoreexpensivefeatures.

Page 64: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

5.WeightedLogicProgramming

Page 65: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

LogicProgramming

•  Startwithasetofaxiomsandasetofinferencerules.

•  Thegoalistoproveaspecifictheorem,goal.•  Manyapproaches,butweassumeadeduc,veapproach.–  Startwithaxioms,iteraBvelyproducemoretheorems.

Page 66: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each
Page 67: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

WeightedLogicProgramming

•  Twist:axiomshaveweights.•  Wanttheproofofgoal withthebestscore:

•  Notethataxiomscanbeusedmorethanonceinaproof(y).

Page 68: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

WhenceWLP?

•  Shieber,Schabes,andPereira(1995):manyparsingalgorithmscanbeunderstoodinthesamededucBvelogicframework.

•  Goodman(1999):addweights,getmanyusefulNLPalgorithms.

•  Eisner,Goldlust,andSmith(2004,2005):semiring‐genericalgorithms,Dyna.

Page 69: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

DynamicProgramming

•  Mostviews(excepBonispolytopes)canbeunderstoodasDPalgorithms.–  Thelow‐levelprocedures weuseareofenDP.–  EvenDPistoohigh‐leveltoknowthebestwaytoimplement.

•  DPdoesnot implypolynomialBmeandspace!– MostcommonapproximaBonswhenthedesiredstatespaceistoobig:beamsearch,cubepruning,agendaswithearlystopping,...

– Otherviewssuggestothers.

Page 70: Lecture 3: Structures and Decodingnasmith/psnlp/lecture3.pdf · • General algorithm for exact MAP inference: variable eliminaon . – Iteravely solve for the best values of each

Summary

•  Decodingisthegeneralproblemofchoosingacomplexstructure.– LinguisBcanalysis,machinetranslaBon,speechrecogniBon,…

– StaBsBcalmodelsareusuallyinvolved(notnecessarilyprobabilisBc).

•  Noperfectgeneralview,butmuchcanbegainedthroughacombinaBonofviews.