AAAI DeLBP Workshop 2/3/2018
Snorkel + Data Programming: Beyond Hand-Labeled Training Data
Alex Ratner Stanford University, InfoLab
Snorkel + Data Programming: Beyond Hand-Labeled Training Data Alex - - PowerPoint PPT Presentation
AAAI DeLBP Workshop 2/3 / 2018 Snorkel + Data Programming: Beyond Hand-Labeled Training Data Alex Ratner Stanford University, InfoLab MOTIVATION: In practice, training data is often: The bottleneck The practical injection point for
AAAI DeLBP Workshop 2/3/2018
Alex Ratner Stanford University, InfoLab
MOTIVATION:
KEY IDEA:
AAAI DeLBP Workshop 2/3/2018
efficient supervision
AAAI DeLBP Workshop 2/3/2018
Chris De Sa (Cornell) Sen Wu Chris Ré Henry Ehrenberg (Facebook) Stephen Bach
Jason Fries
Bryan He
And many more at Stanford & Beyond…
Paroma Varma
On the market!
Braden Hancock
AAAI DeLBP Workshop 2/3/2018
Collection
True False
Labeling Training
Feature Engineering
AAAI DeLBP Workshop 2/3/2018
Collection Representation Learning
True False
Labeling Training
AAAI DeLBP Workshop 2/3/2018
training data does not.
hand-tuned structures, priors, etc.
How do we get—and use—training data more effectively?
AAAI DeLBP Workshop 2/3/2018
A Framework + System for Creating Training Data with Weak Supervision
NIPS 2016
SIGMOD (Demo) 2017
KEY IDEA:
AAAI DeLBP Workshop 2/3/2018
DOMAIN EXPERT
Input: Labeling Functions, Unlabeled data
def def lf1(x): cid = (x.chemical_id, x.disease_id) return return 1 if if cid in KB else else 0 def def lf2(x): m = re.search(r’.*cause.*’, x.between) return return 1 if if m else else 0 def def lf3(x): m = re.search(r’.*not r’.*not cause.*’ cause.*’, x.between) return return 1 if if m else else 0
Noise-Aware Discriminative Model
Output: Probabilistic Training Labels
x1,1 x1,2 h1,3 h1,1 h1,2 y1
𝜇" 𝜇# 𝜇$ 𝑍 Generative Model
Users write labeling functions to generate noisy labels 1 We model the labeling functions’ behavior to de-noise them 2 We use the resulting
a model 3
Knowledge Base Creation (KBC)
AAAI DeLBP Workshop 2/3/2018
AAAI DeLBP Workshop 2/3/2018
A Unifying Framework for Expressing Weak Supervision
DOMAIN EXPERT
def def lf1(x): cid = (x.chemical_id, x.disease_id) return return 1 if if cid in KB else else 0 def def lf2(x): m = re.search(r’.*cause.*’, x.between) return return 1 if if m else else 0 def def lf3(x): m = re.search(r’.*not r’.*not cause.*’ cause.*’, x.between) return return 1 if if m else else 0
DOMAIN EXPERT def def lf1(x): cid = (x.chemical_id, x.disease_id) return return 1 if if cid in KB else else 0 def def lf2(x): m = re.search(r’.*cause.*’, x.between) return return 1 if if m else else 0 def def lf3(x): m = re.search(r’.*not cause.*’ r’.*not cause.*’, x.between) return return 1 if if m else else 0 x 1 , 1 x 1 , 2 h 1 , 3 h 1 , 1 h 1 , 2 y 1 𝜇" 𝜇# 𝜇$ 𝑍AAAI DeLBP Workshop 2/3/2018
relation mentions
ID Chemical Disease Prob.
00 magnesium Myasthenia gravis 0.84 01 magnesium quadriplegic 0.73 02 magnesium paralysis 0.96
KNOWLEDGE BASE (KB)
AAAI DeLBP Workshop 2/3/2018
rule relying on external KB
”Chemical A is found to cause disease B under certain conditions…”
Existing KB
Contains (A,B) Contains (A,B)
def def lf1(x): cid =(x.chemical_id,x.disease_id) return return 1 if if cid in KB else else 0
AAAI DeLBP Workshop 2/3/2018
rule relying on external KB
”Chemical A was found on the floor near a person with disease B…”
Existing KB
Contains (A,B) Contains (A,B)
def def lf1(x): cid =(x.chemical_id,x.disease_id) return return 1 if if cid in KB else else 0
AAAI DeLBP Workshop 2/3/2018
in Candidate objects:
Document Sentence Span Entity
CONTEXT HIERARCHY
writing LFs in Snorkel:
Candidate( Candidate(A,B ,B)
def def lf1(x): cid =(x.chemical_id,x.disease_id) return return 1 if if cid in KB else else 0 lf1 = LF_DS(KB) for lf in LF_DS_hier(KB, cut_level=2): yield lf A knowledge base (KB) with hierarchy
Key Point: Supervision as code
AAAI DeLBP Workshop 2/3/2018
AAAI DeLBP Workshop 2/3/2018
AAAI DeLBP Workshop 2/3/2018
𝜇 ∶ 𝑌 ↦ 𝑍 ∪ {∅}
AAAI DeLBP Workshop 2/3/2018
Klakow 2013, Augenstein et. al. 2015, etc.
Zhang et. al. 2014, Berend & Kontorovich 2014, etc.
2017, etc.
Check out our full list @ snorkel.stanford.edu/blog/ws_blog_post.html – we love suggested additions or other feedback!
AAAI DeLBP Workshop 2/3/2018
AAAI DeLBP Workshop 2/3/2018
𝜇" 𝜇# 𝜇$ 𝑍 𝑍 .
DOMAIN EXPERT def def lf1(x): cid = (x.chemical_id, x.disease_id) return return 1 if if cid in KB else else 0 def def lf2(x): m = re.search(r’.*cause.*’, x.between) return return 1 if if m else else 0 def def lf3(x): m = re.search(r’.*not cause.*’ r’.*not cause.*’, x.between) return return 1 if if m else else 0 x 1 , 1 x 1 , 2 h 1 , 3 h 1 , 1 h 1 , 2 y 1 𝜇" 𝜇# 𝜇$ 𝑍AAAI DeLBP Workshop 2/3/2018
𝜇" 𝜇# 𝜇$ 𝑍
AAAI DeLBP Workshop 2/3/2018
𝜇" 𝜇# 𝜇$ 𝑍
NIPS 2016
Intuition: We use agreements / disagreements to learn without ground truth
AAAI DeLBP Workshop 2/3/2018
Λ0,$ Λ0,# Λ0," 𝑍
Labeling propensity: 𝛾3 = 𝑞6(Λ0,3 ≠ ∅)
𝑔
3 ;<= Λ0, 𝑍 0 = exp
(𝜄3
;<=Λ0,3 # )
𝑔
3 <BB Λ0, 𝑍 0 = exp
(𝜄
3 <BBΛ0,3𝑍 0)
Accuracy: 𝛽3 = 𝑞6 Λ0,3 = 𝑍
0 𝑍 0, Λ0,3 ≠ ∅)
Correlations
ICML 2017
AAAI DeLBP Workshop 2/3/2018
Learn the model π = 𝑄 𝑧, Λ using MLE
function accuracy based on overlaps / conflicts
each
Produce a set of noisy training labels 𝜈H 𝑧, 𝜇 = 𝑄 I,J ~L 𝑧 | Λ = 𝜇(𝑦)
x1 x3 x5 x2 x4 Unlabeled
P(λi|yj) 0.85 0.80 0.65 λ1 λ2 λ3 LFs (𝜇) P(yi| 𝜇) 0.95 0.80 0.15 0.85 0.65
AAAI DeLBP Workshop 2/3/2018
In a supervised learning setting, we would learn from ground-truth labels: Here, we learn from the noisy labels:
𝑥 P = argminW 1 𝑂 Z 𝑚(𝑥, 𝑦 0 , 𝑧 0 )
\ 0]$
𝑥 P = argminW 1 𝑂 Z 𝔽 𝒛,𝜧 ~𝝆[𝑚 𝑥, 𝑦 0 , 𝑧 0 = 𝑧 ]
\ 0]$
Only requires simple tweak to loss function works over ma many mod
𝑈 = { 𝑦$, 0 , 𝑦#, 1 , 𝑦", 0 , … } 𝑈 = { 𝑦$, 0.1 , 𝑦#, 0.6 , 𝑦", 0.3 , … }
AAAI DeLBP Workshop 2/3/2018
.(𝜗m#) unlabeled training data points
This is the same asymptotic scaling as in supervised methods!
AAAI DeLBP Workshop 2/3/2018
to safely skip gen. modeling stage
AAAI DeLBP Workshop 2/3/2018
DOMAIN EXPERT
Input: Labeling Functions, Unlabeled data
def def lf1(x): cid = (x.chemical_id, x.disease_id) return return 1 if if cid in KB else else 0 def def lf2(x): m = re.search(r’.*cause.*’, x.between) return return 1 if if m else else 0 def def lf3(x): m = re.search(r’.*not r’.*not cause.*’ cause.*’, x.between) return return 1 if if m else else 0
Noise-Aware Discriminative Model Output: Probabilistic Training Labels
x1,1 x1,2 h1,3 h1,1 h1,2 y1
𝜇" 𝜇# 𝜇$ 𝑍 Generative Model Users write labeling functions to generate noisy labels 1 We model the labeling functions’ behavior to de-noise them 2 We use the resulting
model 3
AAAI DeLBP Workshop 2/3/2018
Empirical Results
AAAI DeLBP Workshop 2/3/2018
Distant Supervision
Precision: 25.5 Recall: 34.8 F1: 29.4
L
1
L
2
L
3
y
Generative Model
Precision: 52.3 Recall: 30.4 F1: 38.5 + 9.1
x1 x2
h3 h1 h2
y
Discriminative Model
Precision: 38.8 Recall: 54.3 F1: 45.3 + 6.8
True False
Hand Supervision
Precision: 39.9 Recall: 58.1 F1: 47.3 + 2.0
AAAI DeLBP Workshop 2/3/2018
AAAI DeLBP Workshop 2/3/2018
User Study
AAAI DeLBP Workshop 2/3/2018
New Snorkel users matched or beat 7 hours of hand-labeling
3rd Place Score
No machine learning experience Beginner-level Python
How well did these new Snorkel users do?
Faster than hand-labeling data
Average improvement in model performance
We recently ran a Snorkel biomedical workshop in collaboration with the NIH Mobilize Center 15 companies and research groups attended
Jason Fries, Stephen Bach, Alex Ratner, Joy Ku, Christopher Ré
AAAI DeLBP Workshop 2/3/2018
AAAI DeLBP Workshop 2/3/2018
modeling weak supervision
blogs, papers
snorkel.stanford.edu snorkel.stanford.edu