machine learning as extreme tdd: an introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf ·...
TRANSCRIPT
![Page 1: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/1.jpg)
Machine Learning as Extreme TDD: An Introduction
Srikumar Karaikudi Subramanianhttp://sriku.org
Director Technology @ Pramati Technologies https://labs.imaginea.com
6 Mar 2019
![Page 2: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/2.jpg)
Overview
![Page 3: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/3.jpg)
Overview• Motivation and prelude
![Page 4: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/4.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
![Page 5: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/5.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
![Page 6: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/6.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
• Writing our gender classifier
![Page 7: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/7.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
• Writing our gender classifier
• Learners and features
![Page 8: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/8.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
• Writing our gender classifier
• Learners and features
• The learning cycle
![Page 9: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/9.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
• Writing our gender classifier
• Learners and features
• The learning cycle
• The road ahead
![Page 10: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/10.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
• Writing our gender classifier
• Learners and features
• The learning cycle
• The road ahead
• Concluding notes
![Page 11: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/11.jpg)
Overview• Motivation and prelude
• A soft problem: Classifying gender by name
• Testing our gender classifier
• Writing our gender classifier
• Learners and features
• The learning cycle
• The road ahead
• Concluding notes
![Page 12: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/12.jpg)
Motivation
![Page 13: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/13.jpg)
Motivation
• Machine learning is eating software
![Page 14: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/14.jpg)
Motivation
• Machine learning is eating software
• Non-ML folks must be able to participate
![Page 15: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/15.jpg)
Motivation
• Machine learning is eating software
• Non-ML folks must be able to participate
• Critical thinking is valuable and available
![Page 16: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/16.jpg)
Motivation
• Machine learning is eating software
• Non-ML folks must be able to participate
• Critical thinking is valuable and available
• Discovering ML application areas is valuable
![Page 17: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/17.jpg)
Prelude
![Page 18: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/18.jpg)
Prelude
• This talk is not for ML experts
![Page 19: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/19.jpg)
Prelude
• This talk is not for ML experts
• Hoping to address devs and QA engineers
![Page 20: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/20.jpg)
A personal anecdote… from a long time ago… in GWBASIC days
![Page 21: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/21.jpg)
A personal anecdote
Enter your name: Kumar
… from a long time ago… in GWBASIC days
![Page 22: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/22.jpg)
A personal anecdote
Enter your name: Kumar
Hello Mr. Kumar
… from a long time ago… in GWBASIC days
![Page 23: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/23.jpg)
A personal anecdote
Enter your name: Kumar
Hello Mr. Kumar
Enter your name: Shobana
… from a long time ago… in GWBASIC days
![Page 24: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/24.jpg)
A personal anecdote
Enter your name: Kumar
Hello Mr. Kumar
Enter your name: Shobana
Hello Ms. Shobana
… from a long time ago… in GWBASIC days
![Page 25: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/25.jpg)
A personal anecdote
Enter your name: Kumar
Hello Mr. Kumar
Enter your name: Shobana
Hello Ms. Shobana
Enter your name: ▮
… from a long time ago… in GWBASIC days
![Page 26: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/26.jpg)
Guessing one’s gender
![Page 27: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/27.jpg)
Guessing one’s gender
type GenderGuesser = String ! Gender
![Page 28: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/28.jpg)
Guessing one’s gender
data Gender = Man | Woman
type GenderGuesser = String ! Gender
![Page 29: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/29.jpg)
Guessing one’s gender
How would you test the function?
data Gender = Man | Woman
type GenderGuesser = String ! Gender
![Page 30: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/30.jpg)
Guessing one’s gender
(Restricting to Indian names for simplicity)
How would you test the function?
data Gender = Man | Woman
type GenderGuesser = String ! Gender
![Page 31: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/31.jpg)
Some questions to ask
![Page 32: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/32.jpg)
Some questions to ask• Are “man” and “woman" the only two categories
relevant to our situation?
![Page 33: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/33.jpg)
Some questions to ask• Are “man” and “woman" the only two categories
relevant to our situation?
• How do I get a decent list of names with known gender?
![Page 34: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/34.jpg)
Some questions to ask• Are “man” and “woman" the only two categories
relevant to our situation?
• How do I get a decent list of names with known gender?
• What anomalies exist in the set that I need to know about?
![Page 35: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/35.jpg)
Some questions to ask• Are “man” and “woman" the only two categories
relevant to our situation?
• How do I get a decent list of names with known gender?
• What anomalies exist in the set that I need to know about?
• What do we know about the quality of the data?
![Page 36: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/36.jpg)
Some questions to ask• Are “man” and “woman" the only two categories
relevant to our situation?
• How do I get a decent list of names with known gender?
• What anomalies exist in the set that I need to know about?
• What do we know about the quality of the data?
• i.e How do we trust the tests we base it on?
![Page 37: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/37.jpg)
Some questions to ask• Are “man” and “woman" the only two categories
relevant to our situation?
• How do I get a decent list of names with known gender?
• What anomalies exist in the set that I need to know about?
• What do we know about the quality of the data?
• i.e How do we trust the tests we base it on?
• How should we deal with unisex names?
![Page 38: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/38.jpg)
Initial take on tests
![Page 39: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/39.jpg)
Initial take on testsgender “Ram” == Man
![Page 40: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/40.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Woman
![Page 41: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/41.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Man
![Page 42: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/42.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Woman
![Page 43: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/43.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Man
![Page 44: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/44.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Woman
![Page 45: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/45.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Woman
![Page 46: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/46.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Man
![Page 47: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/47.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
![Page 48: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/48.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??
![Page 49: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/49.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??
![Page 50: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/50.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??gender “Rama” == ??
![Page 51: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/51.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??gender “Rama” == ?? — Is it “Ramaa” or “Raamaa”?
![Page 52: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/52.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??gender “Rama” == ?? — Is it “Ramaa” or “Raamaa”?
![Page 53: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/53.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??gender “Rama” == ?? — Is it “Ramaa” or “Raamaa”?
gender “pumpkin” == ??
![Page 54: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/54.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??gender “Rama” == ?? — Is it “Ramaa” or “Raamaa”?
gender “pumpkin” == ??gender “doormat” == ??
![Page 55: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/55.jpg)
Initial take on testsgender “Ram” == Mangender “Sita” == Womangender “Ashok” == Mangender “Yamuna” == Womangender “Valavan” == Mangender “Aarthi” == Womangender “Valli” == Womangender “Amjad” == Mangender “Azma” == Woman
gender “Chandra” == ??gender “Kiran” == ??gender “Rama” == ?? — Is it “Ramaa” or “Raamaa”?
gender “pumpkin” == ??gender “doormat” == ??gender “பாt$ரm” == ??
![Page 56: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/56.jpg)
We want a table!
Name Gender
Valavan Man
Azma Woman
Kiran Either
pumpkin ??
பாt$ரm ??
![Page 57: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/57.jpg)
Our first function …
![Page 58: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/58.jpg)
Our first function …
![Page 59: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/59.jpg)
Our first function …
Table lookup! 😎
![Page 60: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/60.jpg)
Our first function …
Table lookup! 😎
BAD!
![Page 61: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/61.jpg)
Our first function …
Table lookup! 😎
BAD!
• Tests will never break
![Page 62: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/62.jpg)
Our first function …
Table lookup! 😎
BAD!
• Tests will never break
• We have to ship the table
![Page 63: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/63.jpg)
Our first function …
Table lookup! 😎
BAD!
• Tests will never break
• We have to ship the table
• Doesn’t work for names not in the table
![Page 64: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/64.jpg)
Our first function …
Table lookup! 😎
BAD!
• Tests will never break
• We have to ship the table
• Doesn’t work for names not in the table
• We can do better
![Page 65: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/65.jpg)
Overfitting
![Page 66: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/66.jpg)
Overfitting
• Means we’re learning by rote. Can only answer textbook questions.
![Page 67: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/67.jpg)
Overfitting
• Means we’re learning by rote. Can only answer textbook questions.
• Understanding implies compression
![Page 68: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/68.jpg)
Overfitting
• Means we’re learning by rote. Can only answer textbook questions.
• Understanding implies compression
• Necessarily lossy - usually heavily lossy
![Page 69: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/69.jpg)
Overfitting
• Means we’re learning by rote. Can only answer textbook questions.
• Understanding implies compression
• Necessarily lossy - usually heavily lossy
• What if we say - “Can’t use more than MAX_MEMORY”?
![Page 70: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/70.jpg)
Towards generalizability
![Page 71: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/71.jpg)
Towards generalizability
Tester Coder
![Page 72: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/72.jpg)
Towards generalizability
Tester Coder
Name Gender
Valavan Man
Azma Woman
Kiran Either
pumpkin Either
பாt$ரm Either
80%
20%
{ // …
}
SecretTest set
![Page 73: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/73.jpg)
Towards generalizability
Tester Coder
Dev set
Training set
Name Gender
Valavan Man
Azma Woman
Kiran Either
pumpkin Either
பாt$ரm Either
80%
20%
{ // …
}
SecretTest set
![Page 74: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/74.jpg)
Pause …
![Page 75: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/75.jpg)
Pause …
• All of this has been just about the data and the objective
![Page 76: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/76.jpg)
Pause …
• All of this has been just about the data and the objective
• Most important and usually expensive part of the process
![Page 77: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/77.jpg)
Modeling the “learner”
![Page 78: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/78.jpg)
Modeling the “learner”
type Learner = Data ! (Learner, Guesser)
![Page 79: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/79.jpg)
Modeling the “learner”
type Guesser = String ! Gendertype Learner = Data ! (Learner, Guesser)
![Page 80: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/80.jpg)
Modeling the “learner”
type Data = [(String, Gender)]
type Guesser = String ! Gendertype Learner = Data ! (Learner, Guesser)
![Page 81: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/81.jpg)
Modeling the “learner”
data Gender = Man | Woman
type Data = [(String, Gender)]
type Guesser = String ! Gendertype Learner = Data ! (Learner, Guesser)
![Page 82: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/82.jpg)
Modeling the “learner”
data Gender = Man | Woman
type Data = [(String, Gender)]
type Guesser = String ! Gendertype Learner = Data ! (Learner, Guesser)
This is a process
![Page 83: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/83.jpg)
Features
![Page 84: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/84.jpg)
Features
• Are about increasing generalizability
![Page 85: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/85.jpg)
Features
• Are about increasing generalizability
• … by reducing the space of data
![Page 86: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/86.jpg)
Features
• Are about increasing generalizability
• … by reducing the space of data
• The smaller the data space, the easier it is to collect enough data, and the easier it is to test.
![Page 87: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/87.jpg)
Features
• Are about increasing generalizability
• … by reducing the space of data
• The smaller the data space, the easier it is to collect enough data, and the easier it is to test.
• Capture existing domain understanding
![Page 88: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/88.jpg)
Features
• Are about increasing generalizability
• … by reducing the space of data
• The smaller the data space, the easier it is to collect enough data, and the easier it is to test.
• Capture existing domain understanding
Ex: “Kumar” → “ar”
![Page 89: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/89.jpg)
Introducing features
![Page 90: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/90.jpg)
Introducing features
type Feature = String
![Page 91: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/91.jpg)
Introducing features
type Feature = Stringtype FeatureData = [(Feature, Gender)]
![Page 92: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/92.jpg)
Introducing features
type Feature = Stringtype FeatureData = [(Feature, Gender)]
type FeatureExtractor = String ! Feature
![Page 93: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/93.jpg)
Introducing features
type Feature = Stringtype FeatureData = [(Feature, Gender)]
type FeatureExtractor = String ! Featuretype GuesserF = Feature ! Gender
![Page 94: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/94.jpg)
Introducing features
type Feature = Stringtype FeatureData = [(Feature, Gender)]
type FeatureExtractor = String ! Featuretype GuesserF = Feature ! Gender
type LearnerF = FeatureData ! (LearnerF, GuesserF)
![Page 95: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/95.jpg)
Using features
![Page 96: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/96.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learner
![Page 97: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/97.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learnerlearner feature learnerF data =
![Page 98: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/98.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learnerlearner feature learnerF data = let trans (name, g) = (feature name, g)
![Page 99: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/99.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learnerlearner feature learnerF data = let trans (name, g) = (feature name, g) (lf2, fpred) = learnerF (map trans data)
![Page 100: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/100.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learnerlearner feature learnerF data = let trans (name, g) = (feature name, g) (lf2, fpred) = learnerF (map trans data) pred name = fpred (feature name)
![Page 101: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/101.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learnerlearner feature learnerF data = let trans (name, g) = (feature name, g) (lf2, fpred) = learnerF (map trans data) pred name = fpred (feature name) in
![Page 102: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/102.jpg)
Using features
learner :: FeatureExtractor ! LearnerF ! Learnerlearner feature learnerF data = let trans (name, g) = (feature name, g) (lf2, fpred) = learnerF (map trans data) pred name = fpred (feature name) in (learner feature lf2, pred)
![Page 103: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/103.jpg)
Code walkthrough
![Page 104: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/104.jpg)
The learning cycle
![Page 105: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/105.jpg)
The learning cycle
Try something
![Page 106: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/106.jpg)
The learning cycle
Try something
Measure outcomeagainst expectation
![Page 107: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/107.jpg)
The learning cycle
Try something
Measure outcomeagainst expectation
Adjustparameters
![Page 108: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/108.jpg)
The learning cycle
Try something
Measure outcomeagainst expectation
Adjustparameters
![Page 109: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/109.jpg)
The learning cycle
Try something
Measure outcomeagainst expectation
Adjustparameters
(until happy)
![Page 110: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/110.jpg)
The learning cycle
type LearnerP = (Params, ErrorFn, UpdateFn)
![Page 111: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/111.jpg)
The learning cycle
type LearnerP = (Params, ErrorFn, UpdateFn)
type ErrorFn = Data ! Params ! Error
Calculateshow we’re
doing
![Page 112: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/112.jpg)
The learning cycle
type LearnerP = (Params, ErrorFn, UpdateFn)
type ErrorFn = Data ! Params ! Error
Calculateshow we’re
doing
type UpdateFn = Error ! Params ! Params
Calculateswhat to try
next
![Page 113: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/113.jpg)
The road ahead
Predict
Learn
![Page 114: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/114.jpg)
The road ahead
Predict
Learn
“Differentiable programming”
![Page 115: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/115.jpg)
A taste of DP …
![Page 116: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/116.jpg)
Some takeaways
![Page 117: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/117.jpg)
Some takeaways
• Its all about the data. Bad data = Bad model
![Page 118: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/118.jpg)
Some takeaways
• Its all about the data. Bad data = Bad model
• Your data, training plan, tests and metrics must come first. Just like TDD, but extreme. Ethics must also be factored in.
![Page 119: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/119.jpg)
Some takeaways
• Its all about the data. Bad data = Bad model
• Your data, training plan, tests and metrics must come first. Just like TDD, but extreme. Ethics must also be factored in.
• Features (esply “embeddings”) are the API between ML models
![Page 120: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/120.jpg)
Some takeaways
• Its all about the data. Bad data = Bad model
• Your data, training plan, tests and metrics must come first. Just like TDD, but extreme. Ethics must also be factored in.
• Features (esply “embeddings”) are the API between ML models
• Function factorization can help understand learning processes
![Page 121: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/121.jpg)
Some takeaways
• Its all about the data. Bad data = Bad model
• Your data, training plan, tests and metrics must come first. Just like TDD, but extreme. Ethics must also be factored in.
• Features (esply “embeddings”) are the API between ML models
• Function factorization can help understand learning processes
• Automatic differentiation is helping ML adoption, so pay attention
![Page 122: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/122.jpg)
How my cousin did it
![Page 123: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/123.jpg)
How my cousin did it
gender name =
![Page 124: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/124.jpg)
How my cousin did it
gender name = if endswith “a” name
![Page 125: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/125.jpg)
How my cousin did it
gender name = if endswith “a” name then Woman
![Page 126: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/126.jpg)
How my cousin did it
gender name = if endswith “a” name then Woman else if endswith “i” name
![Page 127: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/127.jpg)
How my cousin did it
gender name = if endswith “a” name then Woman else if endswith “i” name then Woman
![Page 128: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/128.jpg)
How my cousin did it
gender name = if endswith “a” name then Woman else if endswith “i” name then Woman else Man
![Page 129: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/129.jpg)
Thanks for listening!
![Page 130: Machine Learning as Extreme TDD: An Introductionsriku.org/talks/ml-as-tdd-20190306-v2.pdf · Overview • Motivation and prelude • A soft problem: Classifying gender by name •](https://reader034.vdocuments.us/reader034/viewer/2022042320/5f09e08b7e708231d428ed4a/html5/thumbnails/130.jpg)
References
Data sets
https://github.com/ellisbrown/name2gender
https://github.com/vsant/indian-name-classifier