Download - Programming with Estimates
![Page 1: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/1.jpg)
Programming with EstimatesJames Bornholt University of Washington
![Page 2: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/2.jpg)
![Page 3: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/3.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/4.jpg)
![Page 5: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/5.jpg)
![Page 6: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/6.jpg)
![Page 7: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/7.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/8.jpg)
59 mph
![Page 9: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/9.jpg)
![Page 10: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/10.jpg)
🏅🏅🏅🏅🏅
![Page 11: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/11.jpg)
59 mph
GeoPoint Prev = Get(); Sleep(5); GeoPoint Curr = Get(); double Dist = Distance(Prev, Curr); double Speed = Dist / 5;
![Page 12: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/12.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/13.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/14.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/15.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/16.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/17.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/18.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/19.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/20.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/21.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/22.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/23.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/24.jpg)
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](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/25.jpg)
Neural networks make great examples
POPL’16
![Page 26: Programming with Estimates](https://reader031.vdocument.in/reader031/viewer/2022020108/58ecd9951a28abe8398b46bb/html5/thumbnails/26.jpg)
PLSE @ University of Washington