Uncertain< T > A First-Order Type for Uncertain Data James Bornholt Australian National University Todd Mytkowicz Microsoft Research Kathryn S. McKinley Microsoft Research Uncertain< T >: A First-Order Type for Uncertain Data 1
Location ¡Loc ¡ ¡ ¡ ¡ ¡= ¡GetGPSLocation(); ¡ estimated discrete data type Uncertain< T >: A First-Order Type for Uncertain Data 2
Uncertainty bug Location ¡Loc ¡ ¡ ¡ ¡ ¡ ¡= ¡GetGPSLocation(); ¡ applications use estimated data, but languages use discrete types estimated discrete data type Uncertain< T >: A First-Order Type for Uncertain Data 3
public ¡class ¡GeoCoordinate ¡{ ¡ Using ¡ ¡ ¡ ¡public ¡double ¡Latitude; ¡ estimates as ¡ ¡ ¡ ¡public ¡double ¡Longitude; ¡ ¡ facts ¡ ¡ ¡ ¡public ¡double ¡HorizontalAccuracy; ¡ } ¡ Uncertain< T >: A First-Order Type for Uncertain Data 4
public ¡class ¡GeoCoordinate ¡{ ¡ Using ¡ ¡ ¡ ¡public ¡double ¡Latitude; ¡ estimates as ¡ ¡ ¡ ¡public ¡double ¡Longitude; ¡ ¡ facts ¡ ¡ ¡ ¡public ¡double ¡HorizontalAccuracy; ¡ } ¡ Uncertain< T >: A First-Order Type for Uncertain Data 5
public ¡class ¡GeoCoordinate ¡{ ¡ Using ¡ ¡ ¡ ¡public ¡double ¡Latitude; ¡ estimates as ¡ ¡ ¡ ¡public ¡double ¡Longitude; ¡ ¡ facts ¡ ¡ ¡ ¡public ¡double ¡HorizontalAccuracy; ¡ } ¡ OS #1 OS #2 95% confidence interval 68% confidence interval σ = 33 m σ = 39 m Uncertain< T >: A First-Order Type for Uncertain Data 6
A Using B A+B estimates as facts 60 Computation 50 compounds Speed (mph) 40 error 30 Usain Bolt 20 10 Normal walking 0 Time Uncertain< T >: A First-Order Type for Uncertain Data 7
Using estimates as facts if ¡(Distance ¡< ¡200) ¡... ¡ Computation compounds 200 m error Inference 0 100 200 300 asks wrong Distance (m) questions Uncertain< T >: A First-Order Type for Uncertain Data 8
How do application writers handle estimated data without a PhD in statistics? Uncertain< T >: A First-Order Type for Uncertain Data 9
How do application writers handle estimated data without a PhD in statistics? Uncertain< T > is an uncertain type abstraction. Uncertain< T >: A First-Order Type for Uncertain Data 10
Related work Developer computations Probabilistic data Sensors, measurements, probabilistic models Uncertain< T >: A First-Order Type for Uncertain Data 11
Related work Developer computations No abstraction Domain PhD Probabilistic data Sensors, measurements, probabilistic models Uncertain< T >: A First-Order Type for Uncertain Data 12
Related work Developer computations No abstraction Probabilistic programming Domain PhD Statistics PhD Probabilistic data Sensors, measurements, probabilistic models Uncertain< T >: A First-Order Type for Uncertain Data 13
Related work Developer computations No abstraction Probabilistic Current programming abstractions Domain PhD Statistics PhD App developers Probabilistic data Sensors, measurements, probabilistic models Uncertain< T >: A First-Order Type for Uncertain Data 14
Related work Developer computations No abstraction Probabilistic Uncertain<T> Current programming abstractions Domain PhD Statistics PhD App developers App developers Probabilistic data Sensors, measurements, probabilistic models Uncertain< T >: A First-Order Type for Uncertain Data 15
Related work Flexible Simple Developer computations No abstraction Probabilistic Uncertain<T> Current programming abstractions Domain PhD Statistics PhD App developers App developers Probabilistic data Sensors, measurements, probabilistic models Uncertain< T >: A First-Order Type for Uncertain Data 16
1 Identifying Measurement distributions model Source Distribution type T Uncertain< T > 2 Computing Experts provide measurement models with estimates (they probably already have them!) 3 Asking the right questions 4 Uncertain< T > approximates distributions Improving by random sampling estimates Uncertain< T >: A First-Order Type for Uncertain Data 17
1 A Identifying distributions B A+B 2 Computing Uncertain< T > lifts arithmetic operators with estimates (like +) to work over distributions 3 Asking the 10 0 10 − 1 Relative error (%) 10 − 1 Time (secs) right questions 10 − 2 10 − 2 10 − 3 10 − 3 10 − 4 10 − 4 4 10 1 10 2 10 3 10 4 10 5 10 6 10 7 10 1 10 2 10 3 10 4 10 5 10 6 10 7 N N Improving Sampling trades speed for accuracy estimates Uncertain< T >: A First-Order Type for Uncertain Data 18
1 Identifying “Is distance less than 200m?” distributions Pr[Distance < 200] 200 m 2 Computing with estimates 0 100 200 300 3 Distance (m) Asking the The answer is a probability. right questions Uncertain< T > accounts for sampling 4 error using hypothesis testing on Improving expected values. estimates Uncertain< T >: A First-Order Type for Uncertain Data 19
1 Identifying Pr[ H | E ] = Pr[ E | H ] Pr[ H ] distributions Pr[ E ] Bayes’ Theorem uses distributions to 2 form better estimates Computing with estimates 40 Raw speed 3 Improved speed Asking the 30 Speed (mph) right questions 20 4 10 Improving estimates 0 Time Uncertain< T >: A First-Order Type for Uncertain Data 20
Uncertainty bugs: applications use estimated data, but languages use discrete types. Uncertain< T > is an uncertain type abstraction. Uncertain< T > makes programs more expressive and more correct. Uncertain< T >: A First-Order Type for Uncertain Data 21
Recommend
More recommend