Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Paradoxes and theorems every developer should know

Paradoxes and theorems every developer should know

Joshua Thijssen

June 21, 2016
Tweet

More Decks by Joshua Thijssen

Other Decks in Technology

Transcript

  1. 2 Joshua Thijssen Consultant and trainer @ NoxLogic Founder of

    TechAnalyze.io Symfony Rainbow Books author Mastering the SPL author Blog: http://adayinthelifeof.nl Email: [email protected] Twitter: @jaytaph Tech nalyze WWW.TECHANALYZE.IO
  2. 6

  3. 7

  4. 10 Intelligence Statistics Actual June 1940 1000 169 June 1941

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

    1550 244 August 1942 1550 327 https://en.wikipedia.org/wiki/German_tank_problem 122
  6. 10 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
  7. 10 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
  8. 11

  9. 11 ➡ Data leakage. ➡ User-id's, invoice-id's, etc ➡ Used

    to approximate the number of iPhones sold in 2008.
  10. 11 ➡ 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.
  11. 12

  12. ➡ 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) 13
  13. 18 5 8 ? ? If a card shows an

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

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

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

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

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

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

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

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

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

    } 28 https://www.sundoginteractive.com/blog/confirmation-bias-in-unit-testing
  23. 29 ➡ Tests where written based on actual code. ➡

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

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

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

    data. ➡ Your data might be less "protected" as you might think.
  27. 51

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

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

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

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

    it contains certain words? 56
  32. 57 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
  33. ➡ 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". 59
  34. 61

  35. 62 ➡ More words? ➡ Complex algorithm, ➡ but, we

    can assume that words are not independent from eachother ➡ Naive Bayes approach
  36. 63

  37. 66 "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:
  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. 70 ➡ 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! Binomial probability
  42. 72 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