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.

Sparkling Water, ASK CRAIG

4,950 views

Published on

Machine Learning, Deep Learning

- Powered by the open source machine learning software H2O.ai. Contributors welcome at: https://github.com/h2oai
- To view videos on H2O open source machine learning software, go to: https://www.youtube.com/user/0xdata

Published in: Software

Sparkling Water, ASK CRAIG

  1. 1. ML + H2O AlexTellez & Michal Malohlava www.h2o.ai lib .ai
  2. 2. THE RED PILL (SPARK + ML) Finally, ONE TO RULE THEM ALL! 1. Scrape & Collect Data 2. Cleanse Data + Feature Extraction / Engineering 3. Build Machine Learning Models + Iterate 4. Throw More Data to Improve Model 5. Deploy Model(s) in Real-Time
  3. 3. THE BLUE PILL (H2O.AI) What is H2O? (water, duh!) It is ALSO an open-source, distributed and parallel predictive engine for machine learning. What makes H2O different? Cutting-edge algorithms + parallel architecture + ease-of-use = Happy Data Scientists / Analysts
  4. 4. WHY NOT BOTH PILLS?! Build smarter applications USING BOTH in harmony within the Spark Ecosystem !!! Convert Spark RDDs H2O RDDs for Machine Learning
  5. 5. LET’S BUILD AN APP! Task: Predict the job category from a Craigslist AdTitle
  6. 6. ML WORKFLOW 1. Perform Feature Extraction on Words + Munging 2. Run Word2Vec algo (MLlib) on JobTitle words 3. Create “title vectors” from individual word vectors for each job title 4. Pass the Spark RDD H2O RDD for ML in Flow 5. Run H2O GBM algorithm on H2O RDD 6. Create Spark Streaming Application + Score on new data
  7. 7. 1.TEXT MUNGING Example: “Site Supervisor and Pre K Teachers Needed Now!!!” Post Tokenization: Seq(site, supervisor, pre, teachers, needed) val tokens = jobTitles.map(line => token(line)) Next: Apply Spark’s Word2Vec model to each word
  8. 8. 2.WORD2VEC Simply: A mathematical way to represent a single word as a vector of numbers. These vector ‘representations’ encode information about the about a given word (i.e. its meaning) Post Tokenization: Seq(site, supervisor, pre, teachers, needed) Post Word2Vec Results: needed, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] site, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] supervisor, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987]
  9. 9. BUTTHAT’S ON WORDS! Post Word2Vec Results: needed, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] site, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] supervisor, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] WE NEED TITLE VECTORS BASED ON ALL THE WORDS! HOW? Averaging word vectors to make ‘TitleVectors’ v(King) - v(Man) +V(Woman) ~ v(Queen)
  10. 10. 3.TITLEVECTORS In Steps: 1. Sum the word2vec vectors in a given title 2. Divide this sum by # of words in a given title Result: ~ Average vector for a given title of N words needed, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] site, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987] supervisor, mllib.linalg.vector[0.456, 0.123, 0.678…….0.987]+ + Divide by Total Words (post tokenization) ~ (site supervisor….needed), [0.998, 0.349, 0.621…….0.915]
  11. 11. 4. PASS SPARK RDDTO H2O OPEN H2O FLOW!
  12. 12. 5. BUILD A MODEL!
  13. 13. 80% ACCURACY - DEFAULT! Algo: Gradient Boosting Machine #Trees: 50 # Bins: 20 Depth: 5 (ALL DEFAULTVALUES) ~ 20% Error Rate
  14. 14. 6. SPARK STREAMING + DEPLOYMENT Create Spark Streaming App to read in new Job Titles a) Create a Spark Streaming Producer - Reads data from a file & generates events in real-time which we will predict category.
  15. 15. APP ARCHITECTURE Posting job title “HIRING Painting CONTRACTORS NOW!!!” Stream Categorize a job title Prediction = “Labor” Re-train the model Craigslist jobs Word2Vec Model GBM
 Model Word2Vec Train a model
  16. 16. “ASK CRAIG” LIVE DEMO!
  17. 17. END-TO-END In JUST 25 minutes…we: 1. Performed sophisticated feature extraction + engineering 2. Passed a Spark RDD H2O RDD for ML 3. Created a Spark Stream to read in new data 5. “Productionalized” H2O + Spark MLlib model to score on new data So happy I took both pills! 4. Built a GBM to classify titles w/ 80% accuracy
  18. 18. TRY SPARKLING WATER!! Download @ h2o.ai Coming Soon: Release 1.4 for Spark 1.4! NEW GUI! H2O FLOW Meetup: SiliconValley Big Data Science

×