SlideShare a Scribd company logo
1 of 26
Download to read offline
Patterns (and Anti-Patterns) for
Developing Machine Learning Systems


               Gordon Rios
           (gparker@gmail.com)
               Zvents, Inc.
              Hypertable.org
Patterns and Anti-Patterns

•  Strategic, tactical, and operational
•  Anti-Patterns – seems obvious but is
   actually questionable or a “bad” idea
•  References: Design Patterns (Gamma, et al.) and Pattern
   Oriented Software Architecture (Buschmann, et al.)
Trapped in the Maze
•  ML projects are
   complex and disruptive
•  Ownership distributed
   across organization or
   missing completely
•  Political factors can
   create a maze of dead
   ends and hidden pitfalls
•  Familiarity with ML is
   sparse at best
A Simple Context

Applications
                    Users         Metrics &
                                  Reporting


       ML ML
         ML ML              Content
      System
       System
           System
         System

               Operational Data
           (systems and production)
“Stuck” on top of the Pyramid

Level of effort:

1.  Data processing
    systems at the base
2.  Feature engineering
    in the middle
3.  Models stuck at the
    top and dependent on
    all the rest …
Basic Components the ML System

Applications
ML System

                              Model
    Data        Feature     Development
               Extraction
 Processing                 Production
                              Scoring
Thin Line (of Functionality)

•  Navigate safely through the negative
   metaphors
•  Encounter potential issues early enough in
   the process to manage or solve
•  Keep each piece of work manageable and
   explainable
•  Caution: if your thin ML system is “good
   enough” organization may lose interest in
   more advanced solution (80/20)
Workflow

•  Data and operations are messy – mix of relational
   database, logs, map-reduce, distributed
   databases, etc.
•  Think and plan in terms of workflows and be
   aware that job scheduling is hidden complexity
   for map-reduce
•  Use tools such as cascading (see
   http://www.cascading.org)
•  Related: Pipeline
Legacy

•  An older model or early approach needs to
   be replaced but has entrenched support
•  Use as an input to new approach
   (presumably based on ML)
•  Can be technically challenging but
   frequently can be converted to an input in
   conjunction with Pipeline
•  Related: Chop Shop, Tiers, Shadow
•  Advanced: Champion/Challenger
Shadow


•  Legacy system is an input to critical
    processes and operations
•  Develop new system and run in parallel to
    test output or regularly audit
•  Can be used as sort of Champion
   /Challenger-lite in conjunction with
    Internal Feedback
•  Also apply to upgrades to input pipeline
    components
Chop Shop

•  Legacy system represents significant
    investment of resources
•  Often rule based and capture valuable
    domain features
•  Isolate features and measure computing
    costs
•  Use selected features in new models or
    process
•  Related: Legacy, Adversarial
Internal Feedback

•  Need a low risk way to test new models
   with live users
•  Use your own product internally
•  Give internal users a way to turn on new
   models, use the product, and give
   feedback
•  Also use to develop training data
•  Related: Bathwater, Follow The Crowd
Follow The Crowd


•  Insufficient training or validation data for
    nobody to help
•  Amazon’s Mechanical Turk too low level
•  Use a service such as Dolores Labs founded
    by machine learning researchers
•  Labeling costs down to $0.05/label (source:
    http://doloreslabs.com)
•  Related: Internal Feedback, Bathwater
Bathwater

•  “Don’t throw the baby out with the
    bathwater …”
•  Subjective tasks can lead to “ML doesn’t
    work” blanket rejection
•  Isolate system elements that may be too
    subjective for ML and use human
    judgments
•  Follow the Crowd (Crowd Sourcing)
•  Related: Internal Feedback, Tiers
Pipeline
•  A mix of computing and
    human processing steps
    need to be applied in a
    sequence
•  Organize as a pipeline and
    monitor the workflow
•  Individual cases can be teed
    off from the flow for
    different processing, etc.
•  Related: Workflow,
    Handshake
Handshake or “Hand Buzzer”

•  Your system depends on inputs
   delivered outside of the normal
   release process
•  Create a “handshake”
   normalization process
•  Release handshake process as
   software associated with input
   and version
•  Regularly check for significant
   changes and send ALERTS
Replay

•  Need a way to test models on operational
    data
•  Invest in a batch test framework
•  Example: web search replay query logs and
    look at changes in rank of clicked
    documents
•  Example: recommender systems
•  Example: messaging inbox replay
Tiers

•  Processing or scoring elements have widely
    varying costs
•  Often feature inputs or processing steps
    have orders of magnitude variation in
    computing cost or editorial costs
•  Build models for each tier and only pass
    cases on to next tier if necessary
•  Related: Thin Line, Pipeline
Long Goodbye

•  Some decision classes have
    unacceptable risk or “loss”
•  Isolate the high risk classes but
    don’t remove from system
    entirely

•  Example: quarantine or Bulk mail folders in
 email to keep false positives safe
•  Delay rather than “reject” -- send uncertain
 cases to more costly processing steps rather
 than reject
Honey Trap

•  New data streams are available for
    testing classifiers but data is
    unlabeled
•  Isolate streams that are likely to be of
    one class or another
•  Example: dead domains become almost
    entirely dominated by spam traffic
•  (TN) Use to collect examples from
    examples with unknown labels like click
    fraud
Tar Pit



•  System needs to identify bad entities but
   cost to register new ones is cheap
•  Don’t reject, delete, or notify bad actors
•  Slows down adversary’s evolution
•  Example: slow down email messaging for low
   reputation IP addresses
•  Related: Honey Trap, Adversarial
Example: Honey Trap + Tar Pit?
Giveaway



•  Need low risk
    testing or new
    data
•  Give away the
    service to non
   -customers
•  Give away a
    related service
    (Google Analytics)
•  Related: Honey
    Trap
Adversarial


•  Adversaries are virulent and aggressive
    (email spam)
•  Use regularization methods judiciously
•  Parsimony can help make your adversaries’
    lives easier
•  Test regularized and non-regularized
    models using Honey Trap
•  (TN) Score by selecting from a set of
    models at random (mixed strategy?!)
Anti-Pattern Sampler

•  Golden Sets (operational)
  (+) Calibration
  (-) Validation
•  80/20 (tactical)
  (+) Design simplification
  (-) “Good enough” can lose market share long term
•  Executive Support (strategic)
  (+) Resources
  (-) Expectations
  (-) Metric choices
Discussion
•  Strategic                      •  Tactical
   –    Thin Line                    –    Pipeline
   –    Legacy                       –    Tiers
   –    Workflow                     –    Replay
   –    Bathwater                    –    Handshake
   –    Giveaway                     –    Long Goodbye
   –    Contest (not presented)      –    Shadow
•  Operational                       –    Chop Shop
   –    Honey Trap                   –    Adversarial
   –    Tar Pit
   –    Handshake                 •  Anti-Patterns
   –    Follow The Crowd             –  Golden Sets (operational)
                                     –  80/20 (tactical)
                                     –  Executive Support (strategic)

More Related Content

Similar to Patterns (and Anti-Patterns) for Developing Machine Learning Systems

An Agile Approach to Machine Learning
An Agile Approach to Machine LearningAn Agile Approach to Machine Learning
An Agile Approach to Machine Learning
Randy Shoup
 
Data Refinement: The missing link between data collection and decisions
Data Refinement: The missing link between data collection and decisionsData Refinement: The missing link between data collection and decisions
Data Refinement: The missing link between data collection and decisions
Vivastream
 

Similar to Patterns (and Anti-Patterns) for Developing Machine Learning Systems (20)

ML Application Life Cycle
ML Application Life CycleML Application Life Cycle
ML Application Life Cycle
 
Cassandra Applications Benchmarking
Cassandra Applications BenchmarkingCassandra Applications Benchmarking
Cassandra Applications Benchmarking
 
Options for Data Prep - A Survey of the Current Market
Options for Data Prep - A Survey of the Current MarketOptions for Data Prep - A Survey of the Current Market
Options for Data Prep - A Survey of the Current Market
 
20141015 how graphs revolutionize access management
20141015 how graphs revolutionize access management20141015 how graphs revolutionize access management
20141015 how graphs revolutionize access management
 
An overview of modern scalable web development
An overview of modern scalable web developmentAn overview of modern scalable web development
An overview of modern scalable web development
 
An Agile Approach to Machine Learning
An Agile Approach to Machine LearningAn Agile Approach to Machine Learning
An Agile Approach to Machine Learning
 
Data Refinement: The missing link between data collection and decisions
Data Refinement: The missing link between data collection and decisionsData Refinement: The missing link between data collection and decisions
Data Refinement: The missing link between data collection and decisions
 
DataStax | Adversarial Modeling: Graph, ML, and Analytics for Identity Fraud ...
DataStax | Adversarial Modeling: Graph, ML, and Analytics for Identity Fraud ...DataStax | Adversarial Modeling: Graph, ML, and Analytics for Identity Fraud ...
DataStax | Adversarial Modeling: Graph, ML, and Analytics for Identity Fraud ...
 
DataEngConf SF16 - Three lessons learned from building a production machine l...
DataEngConf SF16 - Three lessons learned from building a production machine l...DataEngConf SF16 - Three lessons learned from building a production machine l...
DataEngConf SF16 - Three lessons learned from building a production machine l...
 
Observability – the good, the bad, and the ugly
Observability – the good, the bad, and the uglyObservability – the good, the bad, and the ugly
Observability – the good, the bad, and the ugly
 
Unit 1 introduction to simulation
Unit 1 introduction to simulationUnit 1 introduction to simulation
Unit 1 introduction to simulation
 
Msst 2019 v4
Msst 2019 v4Msst 2019 v4
Msst 2019 v4
 
Drifting Away: Testing ML Models in Production
Drifting Away: Testing ML Models in ProductionDrifting Away: Testing ML Models in Production
Drifting Away: Testing ML Models in Production
 
The Art of Intelligence – Introduction Machine Learning for Oracle profession...
The Art of Intelligence – Introduction Machine Learning for Oracle profession...The Art of Intelligence – Introduction Machine Learning for Oracle profession...
The Art of Intelligence – Introduction Machine Learning for Oracle profession...
 
PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko
 
Ideas spracklen-final
Ideas spracklen-finalIdeas spracklen-final
Ideas spracklen-final
 
Machine Learning in the Financial Industry
Machine Learning in the Financial IndustryMachine Learning in the Financial Industry
Machine Learning in the Financial Industry
 
CRM Adoption Strategies
CRM Adoption StrategiesCRM Adoption Strategies
CRM Adoption Strategies
 
General Tips for participating Kaggle Competitions
General Tips for participating Kaggle CompetitionsGeneral Tips for participating Kaggle Competitions
General Tips for participating Kaggle Competitions
 
Geek Sync I Agile Data Management vs. Agile Data Modeling
Geek Sync I Agile Data Management vs. Agile Data ModelingGeek Sync I Agile Data Management vs. Agile Data Modeling
Geek Sync I Agile Data Management vs. Agile Data Modeling
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Patterns (and Anti-Patterns) for Developing Machine Learning Systems

  • 1. Patterns (and Anti-Patterns) for Developing Machine Learning Systems Gordon Rios (gparker@gmail.com) Zvents, Inc. Hypertable.org
  • 2. Patterns and Anti-Patterns •  Strategic, tactical, and operational •  Anti-Patterns – seems obvious but is actually questionable or a “bad” idea •  References: Design Patterns (Gamma, et al.) and Pattern Oriented Software Architecture (Buschmann, et al.)
  • 3. Trapped in the Maze •  ML projects are complex and disruptive •  Ownership distributed across organization or missing completely •  Political factors can create a maze of dead ends and hidden pitfalls •  Familiarity with ML is sparse at best
  • 4. A Simple Context Applications Users Metrics & Reporting ML ML ML ML Content System System System System Operational Data (systems and production)
  • 5. “Stuck” on top of the Pyramid Level of effort: 1.  Data processing systems at the base 2.  Feature engineering in the middle 3.  Models stuck at the top and dependent on all the rest …
  • 6. Basic Components the ML System Applications ML System Model Data Feature Development Extraction Processing Production Scoring
  • 7. Thin Line (of Functionality) •  Navigate safely through the negative metaphors •  Encounter potential issues early enough in the process to manage or solve •  Keep each piece of work manageable and explainable •  Caution: if your thin ML system is “good enough” organization may lose interest in more advanced solution (80/20)
  • 8. Workflow •  Data and operations are messy – mix of relational database, logs, map-reduce, distributed databases, etc. •  Think and plan in terms of workflows and be aware that job scheduling is hidden complexity for map-reduce •  Use tools such as cascading (see http://www.cascading.org) •  Related: Pipeline
  • 9. Legacy •  An older model or early approach needs to be replaced but has entrenched support •  Use as an input to new approach (presumably based on ML) •  Can be technically challenging but frequently can be converted to an input in conjunction with Pipeline •  Related: Chop Shop, Tiers, Shadow •  Advanced: Champion/Challenger
  • 10. Shadow •  Legacy system is an input to critical processes and operations •  Develop new system and run in parallel to test output or regularly audit •  Can be used as sort of Champion /Challenger-lite in conjunction with Internal Feedback •  Also apply to upgrades to input pipeline components
  • 11. Chop Shop •  Legacy system represents significant investment of resources •  Often rule based and capture valuable domain features •  Isolate features and measure computing costs •  Use selected features in new models or process •  Related: Legacy, Adversarial
  • 12. Internal Feedback •  Need a low risk way to test new models with live users •  Use your own product internally •  Give internal users a way to turn on new models, use the product, and give feedback •  Also use to develop training data •  Related: Bathwater, Follow The Crowd
  • 13. Follow The Crowd •  Insufficient training or validation data for nobody to help •  Amazon’s Mechanical Turk too low level •  Use a service such as Dolores Labs founded by machine learning researchers •  Labeling costs down to $0.05/label (source: http://doloreslabs.com) •  Related: Internal Feedback, Bathwater
  • 14. Bathwater •  “Don’t throw the baby out with the bathwater …” •  Subjective tasks can lead to “ML doesn’t work” blanket rejection •  Isolate system elements that may be too subjective for ML and use human judgments •  Follow the Crowd (Crowd Sourcing) •  Related: Internal Feedback, Tiers
  • 15. Pipeline •  A mix of computing and human processing steps need to be applied in a sequence •  Organize as a pipeline and monitor the workflow •  Individual cases can be teed off from the flow for different processing, etc. •  Related: Workflow, Handshake
  • 16. Handshake or “Hand Buzzer” •  Your system depends on inputs delivered outside of the normal release process •  Create a “handshake” normalization process •  Release handshake process as software associated with input and version •  Regularly check for significant changes and send ALERTS
  • 17. Replay •  Need a way to test models on operational data •  Invest in a batch test framework •  Example: web search replay query logs and look at changes in rank of clicked documents •  Example: recommender systems •  Example: messaging inbox replay
  • 18. Tiers •  Processing or scoring elements have widely varying costs •  Often feature inputs or processing steps have orders of magnitude variation in computing cost or editorial costs •  Build models for each tier and only pass cases on to next tier if necessary •  Related: Thin Line, Pipeline
  • 19. Long Goodbye •  Some decision classes have unacceptable risk or “loss” •  Isolate the high risk classes but don’t remove from system entirely •  Example: quarantine or Bulk mail folders in email to keep false positives safe •  Delay rather than “reject” -- send uncertain cases to more costly processing steps rather than reject
  • 20. Honey Trap •  New data streams are available for testing classifiers but data is unlabeled •  Isolate streams that are likely to be of one class or another •  Example: dead domains become almost entirely dominated by spam traffic •  (TN) Use to collect examples from examples with unknown labels like click fraud
  • 21. Tar Pit •  System needs to identify bad entities but cost to register new ones is cheap •  Don’t reject, delete, or notify bad actors •  Slows down adversary’s evolution •  Example: slow down email messaging for low reputation IP addresses •  Related: Honey Trap, Adversarial
  • 22. Example: Honey Trap + Tar Pit?
  • 23. Giveaway •  Need low risk testing or new data •  Give away the service to non -customers •  Give away a related service (Google Analytics) •  Related: Honey Trap
  • 24. Adversarial •  Adversaries are virulent and aggressive (email spam) •  Use regularization methods judiciously •  Parsimony can help make your adversaries’ lives easier •  Test regularized and non-regularized models using Honey Trap •  (TN) Score by selecting from a set of models at random (mixed strategy?!)
  • 25. Anti-Pattern Sampler •  Golden Sets (operational) (+) Calibration (-) Validation •  80/20 (tactical) (+) Design simplification (-) “Good enough” can lose market share long term •  Executive Support (strategic) (+) Resources (-) Expectations (-) Metric choices
  • 26. Discussion •  Strategic •  Tactical –  Thin Line –  Pipeline –  Legacy –  Tiers –  Workflow –  Replay –  Bathwater –  Handshake –  Giveaway –  Long Goodbye –  Contest (not presented) –  Shadow •  Operational –  Chop Shop –  Honey Trap –  Adversarial –  Tar Pit –  Handshake •  Anti-Patterns –  Follow The Crowd –  Golden Sets (operational) –  80/20 (tactical) –  Executive Support (strategic)