Programming the Internet of Uncertain <T>hings James Bornholt University of Washington Na Meng University of Texas at Austin Todd Mytkowicz Microsoft Research Kathryn S. McKinley Microsoft Research 1
2
24 mph 2
3
GeoCoordinate PrevLocn = Get(); Sleep(5); GeoCoordinate Location = Get(); 4
GeoCoordinate PrevLocn = Get(); Sleep(5); GeoCoordinate Location = Get(); double Dist = Distance(LastLocn, Location); double Speed = Dist / 5; 5
GeoCoordinate PrevLocn = Get(); Sleep(5); GeoCoordinate Location = Get(); double Dist = Distance(LastLocn, Location); double Speed = Dist / 5; if (Speed > 4) Alert("Keep it up!"); 6
7
59 mph 7
8
sensors machine learning 8
sensors machine learning 9
sensors machine learning approximate computing 9
Uncertain< T > an abstraction for reasoning about noise [ASPLOS’14] exploiting context language constructs to make data more accurate 10
Uncertain< T > an abstraction for reasoning about noise [ASPLOS’14] exploiting context language constructs to make data more accurate 10
GeoCoordinate PrevLocn = Get(); Sleep(5); GeoCoordinate Location = Get(); double Dist = Distance(LastLocn, Location); double Speed = Dist / 5; if (Speed > 4) Alert("Keep it up!"); 11
Uncertain<GeoCoordinate> PrevLocn = Get(); Sleep(5); Uncertain<GeoCoordinate> Location = Get(); Uncertain<double> Dist = Distance(LastLocn, Location); Uncertain<double> Speed = Dist / 5; if (Speed > 4) Alert("Keep it up!"); 12
Uncertain<GeoCoordinate> PrevLocn = Get(); Sleep(5); Uncertain<GeoCoordinate> Location = Get(); Uncertain<double> Dist = Distance(LastLocn, Location); Uncertain<double> Speed = Dist / 5; if (Speed > 4) 8 6 % f e w e Alert("Keep it up!"); r e r r o r s 12
Semantics Uncertain<T> encapsulates probability distributions and hides statistical complexity. • Computing over random variables • Deciding conditionals 13
Computations Represent distributions by random samples X Y X+Y 14
Computations Represent distributions by random samples X Y X+Y x x y y 14
Computations Represent distributions by random samples X Y X+Y x y x + y x y 14
Computations Operators build a Bayesian network rather than evaluating immediately. D = A / B A B 15
Computations Operators build a Bayesian network rather than evaluating immediately. D = A / B / D A B 15
Computations Operators build a Bayesian network rather than evaluating immediately. D = A / B E = D - C / D C A B 15
Computations Operators build a Bayesian network rather than evaluating immediately. – E D = A / B E = D - C / D C A B 15
Deciding conditionals if (Speed > 4) Alert("Keep it up!"); 4 mph 0 2 4 6 8 10 Speed (mph) 16
Deciding conditionals if (Speed > 4) Alert("Keep it up!"); 4 mph 0 2 4 6 8 10 Speed (mph) 17
Deciding conditionals if (Speed > 4) Alert("Keep it up!"); 4 mph Pr[Speed > 4] 0 2 4 6 8 10 Speed (mph) 17
Deciding conditionals More likely than not if (Speed > 4) that Speed > 4? Alert("Keep it up!"); 4 mph Pr[Speed > 4] 0 2 4 6 8 10 Speed (mph) 17
Deciding conditionals if ((Speed > 4).Pr(0.9)) Alert("Keep it up!"); 4 mph Pr[Speed > 4] 0 2 4 6 8 10 Speed (mph) 18
Deciding conditionals At least 90% likely if ((Speed > 4).Pr(0.9)) that Speed > 4? Alert("Keep it up!"); 4 mph Pr[Speed > 4] 0 2 4 6 8 10 Speed (mph) 18
Identifying absurd data GeoCoordinate PrevLocn = Get(); Sleep(5); GeoCoordinate Location = Get(); double Dist = Distance(LastLocn, Location); double Speed = Dist / 5; if (Speed > 4) // 7 mph Alert("That’s crazy!"); 19
Identifying absurd data GeoCoordinate PrevLocn = Get(); Sleep(5); GeoCoordinate Location = Get(); double Dist = Distance(LastLocn, Location); double Speed = Dist / 5; Naive: 30 times if (Speed > 4) // 7 mph Alert("That’s crazy!"); 19
Identifying absurd data Uncertain<GeoCoordinate> PrevLocn = Get(); Sleep(5); Uncertain<GeoCoordinate> Location = Get(); Uncertain<double> Dist = Distance(LastLocn, Location); Uncertain<double> Speed = Dist / 5; Naive: 30 times if (Speed > 4) // 7 mph Alert("That’s crazy!"); 20
Identifying absurd data Uncertain<GeoCoordinate> PrevLocn = Get(); Sleep(5); Uncertain<GeoCoordinate> Location = Get(); Uncertain<double> Dist = Distance(LastLocn, Location); Uncertain<double> Speed = Dist / 5; Naive: 30 times if (Speed > 4) // 7 mph 50%: 4 times Alert("That’s crazy!"); 20
Identifying absurd data Uncertain<GeoCoordinate> PrevLocn = Get(); Sleep(5); Uncertain<GeoCoordinate> Location = Get(); Uncertain<double> Dist = Distance(LastLocn, Location); Uncertain<double> Speed = Dist / 5; Naive: 30 times if ((Speed > 4).Pr(0.9)) 50%: 4 times Alert("That’s crazy!"); 21
Identifying absurd data Uncertain<GeoCoordinate> PrevLocn = Get(); Sleep(5); Uncertain<GeoCoordinate> Location = Get(); Uncertain<double> Dist = Distance(LastLocn, Location); Uncertain<double> Speed = Dist / 5; Naive: 30 times if ((Speed > 4).Pr(0.9)) 50%: 4 times Alert("That’s crazy!"); 90%: never 21
Uncertain< T > an abstraction for reasoning about noise [ASPLOS’14] exploiting context language constructs to make data more accurate 22
Uncertain< an abstraction for reasoning about noise exploiting context language constructs to make data more accurate 22
23
23
if (RecognizeBeard(photo)) AddBeardToAvatar(); 23
if (RecognizeBeard(photo)) AddBeardToAvatar(); 23
City userCity = ...; if (RecognizeBeard(photo)) AddBeardToAvatar(); 23
context City userCity = ...; application-specific if (RecognizeBeard(photo)) domain knowledge AddBeardToAvatar(); 23
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Static context City Beard • How does city influence beards? Bernoulli HasBeard_City(City c) { if (c == "Seattle") return new Bernoulli(0.4); else return new Bernoulli(0.2); } var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 24
Dynamic context City Beard • Exploit knowledge about this user var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; 25
Dynamic context City Beard • Exploit knowledge about this user var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; Cities.Value = "Seattle"; 25
Dynamic context City Beard • Exploit knowledge about this user var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; Cities.Value = "Seattle"; Bernoulli oldHasBeard = BeardRecognizer(photo); 25
Dynamic context City Beard • Exploit knowledge about this user var Cities = Uniform(...); Bernoulli HasBeard = HasBeard_City <| Cities; Cities.Value = "Seattle"; Bernoulli oldHasBeard = BeardRecognizer(photo); Bernoulli newHasBeard = oldHasBeard # HasBeard; 25
Recommend
More recommend