university of washingtonbornholt/papers/estimates... · 2019-08-15 · university of washington....

26
Programming with Estimates James Bornholt University of Washington

Upload: others

Post on 14-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Programming with EstimatesJames Bornholt University of Washington

Page 2: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew
Page 3: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew Might Jason Mars Mary Hall John Davis Shan Shan Huang

Milind Kulkarni Armando Solar-Lezama Lingjia Tang James Bornholt Ben Wiedermann Sam Blackshear Alvin Cheung Ravi Chugh Cindy Rubio-Gonzalez Jean Yang

Dr. Dr. Dr. Dr. Dr. Dr. Dr. Dr. Dr. Dr.

Dr. Dr. Dr. Dr. Dr. Dr. Dr. Dr. Dr.

Page 4: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew
Page 5: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew
Page 6: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew
Page 7: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Programming with EstimatesJames Bornholt University of Washington

with: Todd Mytkowicz Kathryn S. McKinley Microsoft Research

Na Meng Virginia Tech

Adrian Sampson Cornell

Dan Grossman Luis Ceze University of Washington

Page 8: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

59 mph

Page 9: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew
Page 10: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

🏅🏅🏅🏅🏅

Page 11: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

59 mph

GeoPoint Prev = Get(); Sleep(5); GeoPoint Curr = Get(); double Dist = Distance(Prev, Curr); double Speed = Dist / 5;

Page 12: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Uncertain<T>

59 mph 86% more accurate!

Uncertain<GeoPoint> Prev = Get(); Sleep(5); Uncertain<GeoPoint> Curr = Get(); Uncertain<double> Dist = Distance(Prev, Curr); Uncertain<double> Speed = Dist / 5;

5 mph

An abstraction for programming with estimates Automates complex statistics!

Page 13: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

In the beginning…

We want to make programming with sensors easier.

We already have the cute name: Uncertain<T>.

Nah, this will never work.

Page 14: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Programming language support for probabilistic modeling

Probabilistic programming

Let’s build a recommendation system!

Paper 1 Paper 2 Paper 3 Paper 4Paper 1 Paper 2

Likes PL Likes Arch

P [Likes PL|Paper 1] = ...

P [Likes PL|Paper 2] = ...

P [Paper 3|Likes PL] = ...

paper1 = … likesPL = f(paper1, …) …

Page 15: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Applications

public class GeoCoordinate { public double Latitude; public double Longitude;

public double HorizontalAccuracy; }

106 apps that use GPS

1 app that reads HorizontalAccuracy

Page 16: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Uncertain<T>Programs are graphical models

A = Get() B = Get() C = Get() D = A / B E = D - C

-

C/

E

BA

D

X

Y

x y x+y

X+Y

x y

So long as the data sources are updated, we can get distributions for your code for free!

Page 17: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Uncertain<T>Conditionals in your code are great places to do inference

if (Speed > 4) Alert(“You rock!”);

4 mph

0 2 4 6 8 10Speed (mph)

Compute the probability that the condition is true, and use a hypothesis test to decide the branch

Borrow from medical science to provide fully automated inference

Page 18: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Uncertain<T> for machine learningNeural networks give only a single output

if (Sobel(p) > 0.1) EdgeFound();

36% false positives!

Single output0.1

0.00 0.05 0.10 0.15 0.20 0.25Value of Sobel operator

Page 19: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

True value Single output0.1

0.00 0.05 0.10 0.15 0.20 0.25Value of Sobel operator

Uncertain<T> for machine learningNeural networks give only a single output

if (Sobel(p) > 0.1) EdgeFound();

36% false positives!

Page 20: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

True value Single output0.1

0.00 0.05 0.10 0.15 0.20 0.25Value of Sobel operator

Uncertain<T> for machine learningNeural networks give only a single output

if (Sobel(p) > 0.1) EdgeFound();

36% false positives!

Page 21: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

True value Single output0.1

0.00 0.05 0.10 0.15 0.20 0.25Value of Sobel operator

Uncertain<T> for machine learningNeural networks give only a single output

if (Sobel(p) > 0.1) EdgeFound();

36% false positives!

Page 22: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Done is better than good

We really need another case study for the paper.

I’ve been taking a machine learning class this semester…

MATLAB C#CSV

Page 23: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Done is better than good

We really need another case study for the paper.

I’ve been taking a machine learning class this semester…

MATLAB C#Python

R

CSVCSV

CSV

Page 24: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Done is better than good

We really need another case study for the paper.

I’ve been taking a machine learning class this semester…

MATLAB C#Python

PythonR

CSVCSV

CSV

CSVNaive Precision

Naive Recall

60%

80%

100%

0.5 0.6 0.7 0.8 0.9Conditional threshold

Prec

isio

n/R

ecal

l (%

)

Uncertain<T>PrecisionRecall

Page 25: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

Neural networks make great examples

POPL’16

Page 26: University of Washingtonbornholt/papers/estimates... · 2019-08-15 · University of Washington. Kathryn McKinley Matthias Felleisen Shan Lu Steve Blackburn Michael Carbin Matthew

PLSE @ University of Washington