Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Paradoxes and theorems every developer should know

Joshua Thijssen
December 08, 2015
840

Paradoxes and theorems every developer should know

Joshua Thijssen

December 08, 2015
Tweet

Transcript

  1. 5

  2. 6

  3. 9 Intelligence Statistics Actual June 1940 1000 169 June 1941

    1550 244 August 1942 1550 327 https://en.wikipedia.org/wiki/German_tank_problem
  4. 9 Intelligence Statistics Actual June 1940 1000 169 June 1941

    1550 244 August 1942 1550 327 https://en.wikipedia.org/wiki/German_tank_problem 122
  5. 9 Intelligence Statistics Actual June 1940 1000 169 June 1941

    1550 244 August 1942 1550 327 https://en.wikipedia.org/wiki/German_tank_problem 122 271
  6. 9 Intelligence Statistics Actual June 1940 1000 169 June 1941

    1550 244 August 1942 1550 327 https://en.wikipedia.org/wiki/German_tank_problem 122 271 342
  7. 10

  8. 10 ➡ Data leakage. ➡ User-id's, invoice-id's, etc ➡ Used

    to approximate the number of iPhones sold in 2008.
  9. 10 ➡ Data leakage. ➡ User-id's, invoice-id's, etc ➡ Used

    to approximate the number of iPhones sold in 2008. ➡ Calculate approximations of datasets with (incomplete) information.
  10. ➡ Avoid (semi) sequential data to be leaked. ➡ Adding

    randomness and offsets will NOT solve the issue. ➡ Use UUIDs (better: timebased short IDs, you don't need UUIDs) 11
  11. 16 5 8 ? ? If a card shows an

    even number on one face, then its opposite face is blue.
  12. 18 coke beer 35 17 If you drink beer then

    you must be 18 yrs or older.
  13. 18 coke beer 35 17 If you drink beer then

    you must be 18 yrs or older.
  14. 18 coke beer 35 17 If you drink beer then

    you must be 18 yrs or older.
  15. 22 5 8 ? ? If a card shows an

    even number on one face, then its opposite face is blue.
  16. 22 5 8 ? ? If a card shows an

    even number on one face, then its opposite face is blue.
  17. 22 5 8 ? ? If a card shows an

    even number on one face, then its opposite face is blue.
  18. public function isLeapYeap($year) { return ($year % 4 == 0);

    } 25 https://www.sundoginteractive.com/blog/confirmation-bias-in-unit-testing testIs1996ALeapYeap(); testIs2000ALeapYeap(); testIs2004ALeapYeap(); testIs2008ALeapYeap(); testIs2012ALeapYeap(); testIs1997NotALeapYear(); testIs1998NotALeapYear(); testIs2001NotALeapYear(); testIs2013NotALeapYear();
  19. public function isLeapYeap($year) { return ($year % 4 == 0);

    } 25 https://www.sundoginteractive.com/blog/confirmation-bias-in-unit-testing testIs1996ALeapYeap(); testIs2000ALeapYeap(); testIs2004ALeapYeap(); testIs2008ALeapYeap(); testIs2012ALeapYeap(); testIs1997NotALeapYear(); testIs1998NotALeapYear(); testIs2001NotALeapYear(); testIs2013NotALeapYear();
  20. public function isLeapYeap($year) { return ($year % 4 == 0);

    } 26 https://www.sundoginteractive.com/blog/confirmation-bias-in-unit-testing
  21. 27 ➡ Tests where written based on actual code. ➡

    Tests where written to CONFIRM actual code, not to DISPROVE actual code!
  22. 29 ➡ Step 1: Write tests ➡ Step 2: Write

    code ➡ Step 3: Profit, as less prone to confirmation bias (as there is nothing to bias!)
  23. Question: 31 > 50% chance 4 march 18 september 5

    december 25 juli 2 februari 9 october
  24. Watch out for: 37 ➡ Too small hashes. ➡ Unique

    data. ➡ Your data might be less "protected" as you might think.
  25. 49

  26. find . -name \*.php -exec wc -l {} \; |

    sort | cut -b 1 | uniq -c 50
  27. find . -name \*.php -exec wc -l {} \; |

    sort | cut -b 1 | uniq -c 50 1073 1 886 2 636 3 372 4 352 5 350 6 307 7 247 8 222 9
  28. 51

  29. What is the chance that a message is spam when

    it contains certain words? 54
  30. 55 P(A|B) P(A) P(B) P(B|A) Probability event A, if event

    B (conditional) Probability event A Probability event B Probability event B, if event A
  31. ➡ 10 out of 50 comments are "negative". ➡ 25

    out of 50 comments uses the word "horrible". ➡ 8 comments with the word "horrible" are marked as "negative". 57
  32. 59

  33. 60 ➡ More words? ➡ Complex algorithm, ➡ but, we

    can assume that words are not independent from eachother ➡ Naive Bayes approach
  34. 61

  35. 64 "Your product is horrible and does not work properly.

    Also, you suck." "I had a horrible experience with another product. But yours really worked well. Thank you!" Negative: Positive:
  36. $trainingset = [ 'negative' => [ 'count' => 1, 'words'

    => [ 'product' => 1, 'horrible' => 1, 'properly' => 1, 'suck' => 1, ], ], 'positive' => [ 'count' => 1, 'words' => [ 'horrible' => 1, 'experience' => 1, 'product' => 1, 'thank' => 1, ], ], ]; 65
  37. 66 $trainingset = [ 'negative' => [ 'count' => 631,

    'words' => [ 'product' => 521, 'horrible' => 52, 'properly' => 36, 'suck' => 272, ], ], 'positive' => [ 'count' => 1263, 'words' => [ 'horrible' => 62, 'experience' => 16, 'product' => 311, 'great' => 363 'thank' => 63, ], ], ];
  38. 67 ➡ You might want to filter stop-words first. ➡

    You might want to make sure negatives are handled property "not great" => negative. ➡ Bonus points if you can spot sarcasm.
  39. ➡ Collaborative filtering (mahout): ➡ If user likes product A,

    B and C, what is the chance that they like product D? 68
  40. 69 Mess up your (training) data, and nothing can save

    you (except a training set reboot)
  41. 71 ➡ 30% change of acceptance for CFP ➡ 5

    CFP's 1 - (0.7 * 0.7 * 0.7 * 0.7 * 0.7) = 1 - 0.168 = 0.832 83% on getting selected at least once!
  42. 76 Actually, ➡ The principle of plurality Plurality should not

    be posited with necessity. ➡ The principle of parsimony It is pointless to do more with what is done with less.
  43. ➡ Every element you add needs: design, development, maintenance, connectivity,

    support, etc etc. ➡ When "adding" elements, you are not adding, you are multiplying! 77
  44. 80 Find me on twitter: @jaytaph Find me for development

    and training: www.noxlogic.nl / www.techademy.nl Find me on email: [email protected] Find me for blogs: www.adayinthelifeof.nl