26
Programming with Estimates James Bornholt University of Washington

Programming with Estimates

Embed Size (px)

Citation preview

Page 1: Programming with Estimates

Programming with EstimatesJames Bornholt University of Washington

Page 2: Programming with Estimates
Page 3: Programming with Estimates

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: Programming with Estimates
Page 5: Programming with Estimates
Page 6: Programming with Estimates
Page 7: Programming with Estimates

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: Programming with Estimates

59 mph

Page 9: Programming with Estimates
Page 10: Programming with Estimates

🏅🏅🏅🏅🏅

Page 11: Programming with Estimates

59 mph

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

Page 12: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

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: Programming with Estimates

Neural networks make great examples

POPL’16

Page 26: Programming with Estimates

PLSE @ University of Washington