DOC PREVIEW
Berkeley COMPSCI 188 - Lecture 23: Perceptrons

This preview shows page 1-2-3-27-28-29 out of 29 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 188: Artificial Intelligence Fall 2009AnnouncementsRecap: General Naïve BayesExample Naïve Bayes ModelsNaïve Bayes TrainingRecap: Laplace SmoothingBetter: Linear InterpolationReal NB: SmoothingSlide 9Tuning on Held-Out DataConfidences from a ClassifierNaïve Bayes SummaryWhat to Do About ErrorsFeature ExtractorsGenerative vs. DiscriminativeSome (Simplified) BiologyLinear ClassifiersExample: SpamBinary Decision RuleBinary Perceptron UpdateMulticlass Decision RuleExampleThe Perceptron Update RuleSlide 27Examples: PerceptronMistake-Driven ClassificationProperties of PerceptronsSlide 32Issues with PerceptronsCS 188: Artificial IntelligenceFall 2009Lecture 23: Perceptrons11/17/2009Dan Klein – UC BerkeleyAnnouncementsProject 4: Due Thursday!Final Contest: Qualifications are on!P5 will be due late enough to give you plenty of contest timeRecap: General Naïve BayesA general naïve Bayes model:Y: label to be predictedF1, …, Fn: features of each instanceYF1FnF2Example Naïve Bayes ModelsBag-of-words for textOne feature for every word position in the documentAll features share the same conditional distributionsMaximum likelihood estimates: word frequencies, by labelYW1WnW2Pixels for imagesOne feature for every pixel, indicating whether it is on (black)Each pixel has a different conditional distributionMaximum likelihood estimates: how often a pixel is on, by labelYF0,0Fn,nF0,1Naïve Bayes TrainingData: labeled instances, e.g. emails marked as spam/ham by a personDivide into training, held-out, and testFeatures are known for every training, held-out and test instanceEstimation: count feature values in the training set and normalize to get maximum likelihood estimates of probabilitiesSmoothing (aka regularization): adjust estimates to account for unseen dataTrainingSetHeld-OutSetTestSetRecap: Laplace SmoothingLaplace’s estimate (extended):Pretend you saw every outcome k extra timesWhat’s Laplace with k = 0?k is the strength of the priorLaplace for conditionals:Smooth each condition:Can be derived by dividingH H T6Better: Linear InterpolationLinear interpolation for conditional likelihoodsIdea: the conditional probability of a feature x given a label y should be close to the marginal probability of xExample: A rare word like “interpolation” should be similarly rare in both ham and spam (a priori)Procedure: Collect relative frequency estimates of both conditional and marginal, then averageEffect: Features have odds ratios closer to 17Real NB: SmoothingOdds ratios without smoothing:south-west : infnation : infmorally : infnicely : infextent : inf...screens : infminute : infguaranteed : inf$205.00 : infdelivery : inf...Real NB: Smoothinghelvetica : 11.4seems : 10.8group : 10.2ago : 8.4areas : 8.3...verdana : 28.8Credit : 28.4ORDER : 27.2<FONT> : 26.9money : 26.5...Do these make more sense?Odds ratios after smoothing:Tuning on Held-Out DataNow we’ve got two kinds of unknownsParameters: P(Fi|Y) and P(Y)Hyperparameters, like the amount of smoothing to do: k, Where to learn which unknownsLearn parameters from training setCan’t tune hyperparameters on training data (why?)For each possible value of the hyperparameters, train and test on the held-out dataChoose the best value and do a final test on the test dataProportion of PML(x) in P(x|y)Confidences from a ClassifierThe confidence of a classifier:Posterior of the most likely labelRepresents how sure the classifier is of the classificationAny probabilistic model will have confidencesNo guarantee confidence is correctCalibrationStrong calibration: confidence predicts accuracy rateWeak calibration: higher confidences mean higher accuracyWhat’s the value of calibration?Naïve Bayes SummaryBayes rule lets us do diagnostic queries with causal probabilitiesThe naïve Bayes assumption takes all features to be independent given the class labelWe can build classifiers out of a naïve Bayes model using training dataSmoothing estimates is important in real systemsConfidences are useful when the classifier is calibratedWhat to Do About ErrorsProblem: there’s still spam in your inboxNeed more features – words aren’t enough!Have you emailed the sender before?Have 1K other people just gotten the same email?Is the sending information consistent? Is the email in ALL CAPS?Do inline URLs point where they say they point?Does the email address you by (your) name?Naïve Bayes models can incorporate a variety of features, but tend to do best in homogeneous cases (e.g. all features are word occurrences)15Feature ExtractorsFeatures: anything you can compute about the inputA feature extractor maps inputs to feature vectorsMany classifiers take feature vectors as inputsFeature vectors usually very sparse, use sparse encodings (i.e. only represent non-zero keys)Dear Sir.First, I must solicit your confidence in this transaction, this is by virture of its nature as being utterly confidencial and top secret. …W=dear : 1W=sir : 1W=this : 2...W=wish : 0...MISSPELLED : 2YOUR_NAME : 1ALL_CAPS : 0NUM_URLS : 0...17Generative vs. DiscriminativeGenerative classifiers:E.g. naïve BayesA causal model with evidence variablesQuery model for causes given evidenceDiscriminative classifiers:No causal model, no Bayes rule, often no probabilities at all!Try to predict the label Y directly from XRobust, accurate with varied featuresLoosely: mistake driven rather than model driven18Some (Simplified) BiologyVery loose inspiration: human neurons19Linear ClassifiersInputs are feature valuesEach feature has a weightSum is the activationIf the activation is:Positive, output +1Negative, output -1f1f2f3w1w2w3>0?20Example: SpamImagine 4 features (spam is “positive” class):free (number of occurrences of “free”)money (occurrences of “money”)BIAS (intercept, always has value 1)BIAS : -3free : 4money : 2...BIAS : 1 free : 1money : 1...“free money”Binary Decision RuleIn the space of feature vectorsExamples are pointsAny weight vector is a hyperplaneOne side corresponds to Y=+1Other corresponds to Y=-1BIAS : -3free : 4money : 2...0 1012freemoney+1 = SPAM-1 = HAMBinary Perceptron


View Full Document

Berkeley COMPSCI 188 - Lecture 23: Perceptrons

Documents in this Course
CSP

CSP

42 pages

Metrics

Metrics

4 pages

HMMs II

HMMs II

19 pages

NLP

NLP

23 pages

Midterm

Midterm

9 pages

Agents

Agents

8 pages

Lecture 4

Lecture 4

53 pages

CSPs

CSPs

16 pages

Midterm

Midterm

6 pages

MDPs

MDPs

20 pages

mdps

mdps

2 pages

Games II

Games II

18 pages

Load more
Download Lecture 23: Perceptrons
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 23: Perceptrons and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 23: Perceptrons 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?