20
Mandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial I ntelligence Laboratory Cambridge, MA, USA March 9, 2017 Semantic Mapping of Natural Language Input to Database Entries via CNNs

Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Mandy KorpusikZach Collins, Jim Glass

MIT Computer Science and Artificial Intelligence Laboratory Cambridge, MA, USA

March 9, 2017

Semantic Mapping of Natural Language Input to Database

Entries via CNNs

Page 2: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Motivation

2

Page 3: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Partial Solution: USDA

MIT Computer Science and Artificial Intelligence Laboratory 3

Page 4: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Our Solution

(Matt McEachern, Karan Kashyap)MIT Computer Science and Artificial Intelligence Laboratory 4

Page 5: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Old Approach: Simple Word Matching

MIT Computer Science and Artificial Intelligence Laboratory 5

Page 6: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Problem

MIT Computer Science and Artificial Intelligence Laboratory 6

Page 7: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

New Approach: Direct Mapping to USDA

chili with beans canned

for dinner I had a bowl of chili over rice and an apple

rice white short-grain

cooked

apples raw with skin

MIT Computer Science and Artificial Intelligence Laboratory 7

Page 8: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 1: Data Collection

MIT Computer Science and Artificial Intelligence Laboratory

Page 9: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 1: Data Collection• Collected 31,712 meal logs on Amazon Mechanical Turk.

Breakfast1167

Dinner2570

Salad232

Sandwich375

Smoothie384

Pasta1270

Snack1342

Fast Food669

NUMBER OF FOODS PER MEAL

MIT Computer Science and Artificial Intelligence Laboratory 9

• Dairy and Egg• Breakfast Cereals• Baked Products• …

• Poultry• Pork• Beef• Spices and Herbs• …

• Sweets and Snacks• Nut and Seeds• …

• Fruits and Fruit Juices

• …

• Cereal Grains and Pasta

• …

• Vegetables• Legumes• …

• Sausages and Luncheon Meat

• …

• Fast Foods• Restaurant Foods• …

Page 10: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 2: Convolutional Neural Networks (CNN)

• Yan Lecun et al: Very deep CNNs for text classification• Yoon Kim et al: CNNs for sentence classification• Sentence matching

– Liang Pang et al: Text matching as image recognition– Baotian Hu et al: CNN architectures for matching natural

language sentences– Wenpeng Yin et al: ABCNN: Attention-Based CNN for

Modeling Sentence Pairs

MIT Computer Science and Artificial Intelligence Laboratory 10

Page 11: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 2: Convolutional Neural Networks (CNN)

I had a slice of toast

CNNMatches:

1. bread, white2. bread, wheat

3. bread, rye…

MIT Computer Science and Artificial Intelligence Laboratory 11

Page 12: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 2: Convolutional Neural Networks (CNN)Predict: 1 (Match) or 0 (Not Match)

USDA Food Meal DescriptionMatch?

Maxpool

Dropout

Normalize

100 Dot Products

(1, 64) (100, 64)

Meanpool

Sigmoid

Normalize

Dropout

CNN

0 0 0 … for dinner i had a bowl of chili over rice and an apple0 0 0 … chili with beansPadded Input

Embedding (50d) … …

CNN (64 filters, w=3 tokens)

… … CNN

… …

… …

MIT Computer Science and Artificial Intelligence Laboratory 12

Page 13: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 3: Predicting USDA Matches

for dinner I had a bowl of chili over rice and an applefor dinner I had a bowl of chili over rice and an apple

Predicted Matches:1. chili with beans canned

2. rice white short – grain cooked3. apples raw with skin

Meal CNN

… …

MIT Computer Science and Artificial Intelligence Laboratory 13

Page 14: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 3: Finite-State Transducer (FST)

Food FST

Meal FST

Compose

MIT Computer Science and Artificial Intelligence Laboratory 14

Page 15: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Step 3: Finite State Transducer (FST)

• FST decoder generates predicted USDA food matches.

Meal: I had a bowl of cereal , one egg white , and a glass of juice .

Alignment: Other Other Other Other Other ID8243 Other Other ID1124 ID1124 Other Other Other Other Other ID9233 Other

USDA Items:• ID8243: Cereals ready-to-eat, GENERAL MILLS, HONEY

NUT CLUSTERS• ID1124: Egg, white, raw, fresh• ID9233: Passion-fruit juice, yellow, raw

MIT Computer Science and Artificial Intelligence Laboratory 15

Page 16: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Re-training CNN with Augmented Data

for dinner i had a bowl of chiliover rice and an apple

chili with beans canned

USDA Food Full Meal Description

USDA CNN

Meal CNN

• Augment data with FST-predicted aligned tokens

chilichili with beans canned

USDA Food Aligned Tokens

Training Sample 1

Training Sample 2

MIT Computer Science and Artificial Intelligence Laboratory 16

Page 17: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

New Model Performs Better (101 Foods)

Model RecallOld: CRF tagger + USDA Lookup 78.9%New: CNN + FST Top-1 89.2%New: CNN + FST Top-5 90.6%

• Recall: % of correctly predicted USDA foods

MIT Computer Science and Artificial Intelligence Laboratory 17

Page 18: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Analysis: Spike Profile

MIT Computer Science and Artificial Intelligence Laboratory 18

Page 19: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Analysis: Nearest Neighbors

Chicken broiler or fryers breast skinless boneless meat only raw

1. Chicken broilers or fryers drumstick meat and skin cooked fried flour

2. KFC fried chicken original recipe breast meat only skin and breading removed

Cookies chocolate chip refrigerated dough baked1. Cookies brownies commercially prepared2. Snacks granola bars soft uncoated chocolate chip

MIT Computer Science and Artificial Intelligence Laboratory 19

Page 20: Semantic Mapping of Natural Language Input to Database ...people.csail.mit.edu/mitra/meetings/2017-Feb28-Mandy.pdfMandy Korpusik Zach Collins, Jim Glass MIT Computer Science and Artificial

Ongoing and Future Research

• Extend to full USDA database, as well as larger Minnesota database

• Character-based models

• Personalized nutrition advice

MIT Computer Science and Artificial Intelligence Laboratory 20

• User testing

• Follow-up questions