Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Distributed Time Travel for Feature Generation by DB Tsai and Prasanna Padmanabhan

1,430 views

Published on

Spark Summit East Talk

Published in: Data & Analytics
  • Be the first to comment

Distributed Time Travel for Feature Generation by DB Tsai and Prasanna Padmanabhan

  1. 1. Distributed Time Travel for Feature Generation Prasanna Padmanabhan DB Tsai Mohammad H. Taghavi
  2. 2. Turn on Netflix, and the absolute best content for you would automatically start playing
  3. 3. Ranking Everything is a Recommendation Rows Over 80% of what members watch comes from our recommendations Recommendations are driven by Machine Learning Algorithms
  4. 4. Data Driven • Try an idea offline using historical data to see if it would have made better recommendations • If it did, deploy a live A/B test to see if it performs well in Production
  5. 5. Why build a Time Machine?
  6. 6. Quickly try ideas on historical data and transition to online A/B test
  7. 7. The Past •Generate features based on event data logged in Hive – Need to reimplement features for online A/B test – Data discrepancies between offline and online sources • Log features online where the model will be used – Need to deploy each idea into production • Feature generation calls online services and filters data past a certain time – Works only when a service records a log of historical events – Additional load on online services
  8. 8. DeLorean image by JMortonPhoto.com & OtoGodfrey.com
  9. 9. Time Travel using Snapshots • Snapshot online services and use the snapshot data offline to generate features • Share facts and features between experiments without calling live systems
  10. 10. How to build a Time Machine
  11. 11. Context Selection Data Snapshots APIs for Time Travel
  12. 12. Context Selection Context Selection Runs once a day Hive S3 Context SetStratified Sampling Contexts tagged with meta data
  13. 13. Data Snapshots S3 Context Set Data Snapshots Runs once a day S3 Snapshot Prana (Netflix Libraries) Viewing History Service MyList Service Ratings Service Snapshot data for each Context Thrift Parquet
  14. 14. APIs for Time Travel
  15. 15. Data Architecture S3 Snapshot S3 Context Set Runs once a day Prana (Netflix Libraries) Viewing History Service MyList Service Ratings Service Context Selection Runs once a day Hive Stratified Sampling Contexts tagged with meta data Thrift Context Selection Data Snapshots Batch APIs RDD of Snapshot Objects Data Snapshots Batch APIs
  16. 16. Generating Features via Time Travel
  17. 17. Great Scott! • DeLorean: A time-traveling vehicle – uses data snapshots to travel in time – scales with Apache Spark – prototypes new ideas with Zeppelin – requires minimal code changes from experimentation to A/B test to production https://en.wikipedia.org/wiki/Emmett_Brown There’s the DeLorean!
  18. 18. Running Time Travel Experiment Select the destination time Bring it up to 88 miles per hour!
  19. 19. Running Time Travel Experiment Design Experiment Collect Label Dataset DeLorean: Offline Feature Generation Distributed Model Training Parallel training of individual models using different executors Compute Validation Metrics Model Testing Choose best model Design a New Experimentto Test Out DifferentIdeas Good Metrics Offline Experiment Online System Online AB Testing Bad Metrics Selected Contexts
  20. 20. DeLorean Input Data • Contexts: The setting for evaluating a set of items (e.g. tuples of member profiles, country, time, device, etc.) • Items: The elements to be trained on, scored, and/or ranked (e.g. videos, rows, search entities). • Labels: For supervised learning, this will be the label (target) for each item.
  21. 21. Feature Encoders • Compute features for each item in a given context • Each type of raw data element has its own data key • Data map is a map from data keys to data objects in a given context • Data map is consumed by feature encoder to compute features
  22. 22. Two type of Data Elements • Context-dependent data elements – Viewing History – Mylist – ... • Context-independent data elements – Video Metadata – Genre Metadata – ...
  23. 23. Video Country of Origin Matching Fraction Context-Items Context: s Items: Context: s Items: Context Dependent Data Element Viewing History Context: s Items: Context: s Items: Context: s Items: = 0.5 = 0.5 = 0.5 Context Independent Data Element Video Metadata Context: s Items: = 1.0 = 0.0 = 1.0 Features
  24. 24. Feature GenerationS3 Snapshot Model Training Label Features Feature EncodersLabel Data Feature Encoders Data Elements Feature Model (JSON) Feature Encoders Feature Encoders Feature Encoders Required Feature Keys Data Data Map Features Data in POJOs Data Keys Data Keys
  25. 25. Features •Represented in Spark’s DataFrames •In nested structure to avoid data shuffling in ranking process •Stored with Parquet format in S3
  26. 26. Features Context Item, label, and features
  27. 27. Going Online S3 Snapshot DeLorean: Offline Feature Generation Online Ranking / Scoring Service Model Training / Validation / Testing Offline Experiment Online SystemViewing History Service MyList Service Ratings Service Online Feature Generation Deploy models Shared Feature Encoders
  28. 28. Conclusion Spark helped us significantly reduce the time from an idea to an AB Test
  29. 29. Future work Event Driven Data Snapshots Time Travel to the Future!!
  30. 30. We’re hiring! (come talk to us) https://jobs.netflix.com/ Tech Blog: http://bit.ly/sparktimetravel

×