custom models in no time: how active learning is changing ai€¦ · custom models in no time: how...

30
Kfir Bar Chief Scientist Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018

Upload: others

Post on 22-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

Kfir BarChief Scientist

Custom Models in No Time:

How Active Learning is Changing AI

HLTCon2018

Page 2: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

2

Supervised machine learning

➔ Teaching a machine to classify items,

by showing it pairs of items and their

true labels

Apple

Karambola

Grapefruit

Cherry

Page 3: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

3

Peach

Fruit detector

Page 4: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

4

Supervised machine learning

GrapesBanana

Apple

Orange

Training set

Training

Page 5: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

5

What is this?

Page 6: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

6

Supervised machine learning

Sample

?

It’s a cherry

Prediction

Page 7: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

7

How training sets get created?

➔ We need domain experts

Page 8: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

➔ We need domain experts

➔ and we need to pay them...

8

How training sets get created?

Page 9: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

9

Standard (static) annotation process

Collect unlabeled data (e.g., fruits)1

Select an item, randomly2

Assign a label 3

Train and evaluate a classifier4

Not happy with the results?

Page 10: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

10

Did I see this item before?

➔ Randomly selecting an item for annotation

might be suboptimal

➔ The dataset could be unbalanced

Page 11: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

➔ For example, looking for tweets that mention the word

“move” in the sense of “moving to a new apartment”

11

Unbalanced datasets - document classification

10%

90%New apartment

Other

mood: wanna move to another city and start a new life

Might move to another house next month !

Page 12: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

➔ For example, looking for tweets that mention the word

“move” in the sense of “moving to a new apartment”

12

Unbalanced datasets - document classification

10%

90%New apartment

Other

mood: wanna move to another city and start a new life

Might move to another house next month !

Nice/bad move

Move on

Page 13: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

13

Introducing Active Learning

➔ We train a classifier as we annotate

➔ We keep training the classifier with

every new annotated item

➔ The classifier helps us select the most important item to annotate next, the one

that has the biggest impact on the

classifier

Page 14: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

14

Introducing Active Learning

➔ Instead of picking up many apples, the classifier will select

the most difficult items

Page 15: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

15

Introducing Active Learning

➔ Given 400 random points, distributed in a 2-D space. Half are green squares and half are red triangles

➔ We want to train a classifier to distinguish between the two groups

Page 16: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

➔ Let’s say we train the classifier with only 30 points (out of the 400)

16

Introducing Active Learning

Random selection of 30 points

Classifier selects the 30 most difficult points

70% Accuracy 90% Accuracy

Page 17: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

➔ Builds a classifier behind the scene

➔ Selects the most difficult items for annotation

➔ Serves items with suggested labels, so you only need to correct them, when needed, and submit

➔ Provides a dashboard, where you can see performance metrics change as you annotate more items

17

New Active-Learning annotation tool

For now, it supports Named Entity Recognition (NER).

Next on the list: Document Classification and Sentiment Analysis

Page 18: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

18

Automatically find names of people,

organizations, locations, and more in text

across many languages.

First NLP task: Named entity recognition (NER)

Page 19: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

According to Elon Musk, Mars rocket will

fly ‘short flights’ next year.

19

Page 20: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

20

Example

Page 21: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

21

NER Experiment w/ and w/o Active Learning

80%

200K 700K

Accuracy

# Words

Random Selection

Active Learning

Page 22: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

22

How does it work?

Upload unlabeled documents

1

Page 23: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

23

How does it work?

Annotate a few sentences.

When there are enough annotated sentences, the system trains a classifier

2

Page 24: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

24

How does it work?

Then, the classifier predicts labels for the remaining unlabeled sentences.

Each sentence is assigned with a confidence score

30.7 0.9 0.3

0.5 0.50.5

0.5 0.5

0.2

0.1

0.00.8

0.3

0.50.7

0.1

0.3 0.4

0.60.5

Page 25: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

25

How does it work?

Next sentence to annotate will be the one with minimum confidence

40.7 0.9 0.3

0.5 0.50.5

0.5 0.5

0.2

0.1

0.00.8

0.3

0.50.7

0.1

0.3 0.4

0.60.5

Page 26: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

26

How does it work?

0.7 0.9 0.3

0.5 0.50.5

0.5 0.5

0.2

0.1

0.00.8

0.3

0.50.7

0.1

0.3 0.4

0.60.5

Page 27: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

27

Active deep learning

+

LSTM

Washington

LSTM

+

LSTM

said

LSTM

+

LSTM

in

LSTM

+

LSTM

Chicago

LSTM

+

LSTM

last

LSTM

...

OTHER OTHER B-LOC OTHER0.1, 0.5, 0.01, …, 0.08

B-PER

Page 28: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

28

Active deep learning

+

LSTM

Washington

LSTM

+

LSTM

said

LSTM

+

LSTM

in

LSTM

+

LSTM

Chicago

LSTM

+

LSTM

last

LSTM

...

0.1, 0.5, 0.01, …, 0.08

B-PER

0.01, 0.2, …, 0.2 0.01, 0.2, …, 0.2 0.6, 0.2, …, 0.2 0.01, 0.2, …, 0.2

OTHER B-LOC

Page 29: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

➔ We can use the new annotation tool to adjust an existing model for a specific task

➔ For example, start with our English NER model and adjust it to work on legal contracts

29

Adjusting existing models

Page 30: Custom Models in No Time: How Active Learning is Changing AI€¦ · Custom Models in No Time: How Active Learning is Changing AI HLTCon 2018. 2 Supervised machine learning Teaching

Questions?

Thank you!

[email protected]

@kfirbar