78
Predictive Models for Production Applications July 2013

Predictive Models for Production Apps with Yhat

  • Upload
    yhat

  • View
    106

  • Download
    0

Embed Size (px)

DESCRIPTION

Yhat presentation at PyData Boston 2013. Predictive Models for Production Apps with Yhat. Building a beer recommender with Python and Yhat.

Citation preview

Page 1: Predictive Models for Production Apps with Yhat

Predictive Models for Production Applications

July 2013

Page 2: Predictive Models for Production Apps with Yhat

Why building analytical apps is hard

Overcoming the challenge

Case study: building a beer recommender

Page 3: Predictive Models for Production Apps with Yhat

If you double the number of experiments you do per year, you're going to double your inventiveness.“

”- Jeff Bezos

Page 4: Predictive Models for Production Apps with Yhat

We need to reduce churn. Okay. I'll look into it.

Lots of conversations like this

Page 5: Predictive Models for Production Apps with Yhat

I figured out that....some complex stuff about vector space that'll improve...

....and that's how we'll reduce churn.

Sounds good. Let's do that...

The "a ha" moment isn't the end.

Page 6: Predictive Models for Production Apps with Yhat

Now what?

Any of you know what Gradient Boosting is?

So when can we go live with the new model?

Page 7: Predictive Models for Production Apps with Yhat

It's hard to incorporate analytical work into day-to-day operations

Page 8: Predictive Models for Production Apps with Yhat

We know finding a data scientist tough.

http://drewconway.com/

Page 9: Predictive Models for Production Apps with Yhat

Building applications from their insights is tougher.

Page 10: Predictive Models for Production Apps with Yhat

"cool. what do we do now?" scenarios

http://scikit-learn.org/stable/auto_examples/index.html

Page 11: Predictive Models for Production Apps with Yhat

Product Page Search Results

Order Confirmation / Checkout Page

Reduce QA time for classifying purchases made online

Page 12: Predictive Models for Production Apps with Yhat

How to go from prototype to product?

Page 13: Predictive Models for Production Apps with Yhat

How do companies address this problem?

Page 14: Predictive Models for Production Apps with Yhat

Rewriting Code

Common Approaches Challenge

Page 15: Predictive Models for Production Apps with Yhat

Rewriting Code

Common Approaches

Cross-environment validation

Challenge

Page 16: Predictive Models for Production Apps with Yhat

Rewriting Code

Batch Jobs

Common Approaches

Cross-environment validation

Challenge

Page 17: Predictive Models for Production Apps with Yhat

Rewriting Code

Batch Jobs

Common Approaches

Cross-environment validation

High maintenance and config

Challenge

Page 18: Predictive Models for Production Apps with Yhat

Rewriting Code

Batch Jobs

PMML

Common Approaches

Cross-environment validation

High maintenance and config

Challenge

Page 19: Predictive Models for Production Apps with Yhat

Rewriting Code

Batch Jobs

PMML

Common Approaches

Cross-environment validation

High maintenance and config

Limited to certain libraries, Still rewriting

Challenge

Page 20: Predictive Models for Production Apps with Yhat

Rewriting Code

Batch Jobs

PMML

Common Approaches

Cross-environment validation

High maintenance and config

Limited to certain libraries, Still rewriting

Challenge

More people, more tools, more time to market.

Page 21: Predictive Models for Production Apps with Yhat

Can we build and bring to market smarter applications faster?

Page 22: Predictive Models for Production Apps with Yhat

Rewriting Code

Batch Jobs

PMML

Common Approaches

Cross-environment validation

High maintenance and config

Limited to certain libraries, Still rewriting

Challenge

A platform for running predictive models in production applications.

Page 23: Predictive Models for Production Apps with Yhat

Key Tenets

Page 24: Predictive Models for Production Apps with Yhat

1. Work with the tools you already know

Key Tenets

Page 25: Predictive Models for Production Apps with Yhat

1. Work with the tools you already know2. Iterate quickly

Key Tenets

Page 26: Predictive Models for Production Apps with Yhat

1. Work with the tools you already know2. Iterate quickly3. Low touch

Key Tenets

Page 27: Predictive Models for Production Apps with Yhat

1. Work with the tools you already know2. Iterate quickly3. Low touch4. No rewriting code

Key Tenets

Page 28: Predictive Models for Production Apps with Yhat

demo

Page 29: Predictive Models for Production Apps with Yhat

A Beer Recommender in Python

Page 30: Predictive Models for Production Apps with Yhat

What beer should I drink?

Page 31: Predictive Models for Production Apps with Yhat

Tell us a beer you like

Page 32: Predictive Models for Production Apps with Yhat
Page 33: Predictive Models for Production Apps with Yhat

We'll tell you some other beers you'll like

Page 34: Predictive Models for Production Apps with Yhat

1. Import the data2. Find common reviewers3. Calculate review distance4. Rank beers

Plan

Page 35: Predictive Models for Production Apps with Yhat

1. Import the data2. Find common reviewers3. Calculate review distance4. Rank beers

Plan

Page 36: Predictive Models for Production Apps with Yhat

The Dataset

Page 37: Predictive Models for Production Apps with Yhat

The Dataset

Page 38: Predictive Models for Production Apps with Yhat

The Dataset

Page 39: Predictive Models for Production Apps with Yhat

1. Import the data2. Find common reviewers3. Calculate review distance4. Rank beers

Plan

Page 40: Predictive Models for Production Apps with Yhat

Find common reviewers

Page 41: Predictive Models for Production Apps with Yhat

1. Import the data2. Find common reviewers3. Calculate distance4. Rank beers

Plan

Page 42: Predictive Models for Production Apps with Yhat

Comparing 2 Similar Beers

vs

Page 43: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

Page 44: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

"Perfect Agreement"

Page 45: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

Page 46: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

Page 47: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

Page 48: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

Similar reviews

Page 49: Predictive Models for Production Apps with Yhat

Comparing 2 Dissimilar Beers

vs

Page 50: Predictive Models for Production Apps with Yhat

Dale's Pale Ale and Fat Tire Amber Ale

Page 51: Predictive Models for Production Apps with Yhat

Michelob Ultra and Fat Tire Amber Ale

Page 52: Predictive Models for Production Apps with Yhat

Measuring distance

Page 53: Predictive Models for Production Apps with Yhat

Measuring distance...yes, there are other ways to do this.

Page 54: Predictive Models for Production Apps with Yhat

Calculating Distance

Page 55: Predictive Models for Production Apps with Yhat

Distance Implementation

Page 56: Predictive Models for Production Apps with Yhat

Calculate the Distance

● Generate all beer pairs● Calculate distance between each pair

Page 57: Predictive Models for Production Apps with Yhat

1. Import the data2. Find common reviewers3. Calculate review distance4. Rank results

Plan

Page 58: Predictive Models for Production Apps with Yhat

So if I like Coors Light, what other beers might I like?

Page 59: Predictive Models for Production Apps with Yhat

shipping your work with

Page 60: Predictive Models for Production Apps with Yhat

Make analytical routines available to other apps

{ "beer": "Coors Light", "weights": [3, 2, 0, 1]}

[ ["Bud Light", 9.2], ["Budweiser", 12.2], ["Sierra Nevada", 21.2],]

Page 61: Predictive Models for Production Apps with Yhat

1. Pre-processing & transformations

Page 62: Predictive Models for Production Apps with Yhat

2. Prediction & post-processing

Page 63: Predictive Models for Production Apps with Yhat

Use the same code you wrote during exploration and modeling.

2. Prediction & post-processing

Page 64: Predictive Models for Production Apps with Yhat

We're ready to deploy

Page 65: Predictive Models for Production Apps with Yhat

Analytical routine is now ready to be deployed Go-to-market with as little overhead as possible

Page 66: Predictive Models for Production Apps with Yhat

Deploy

Pass objects you'd like included in your model as named arguments

Page 67: Predictive Models for Production Apps with Yhat

Specify User Defined Functions you want to include in your project

Deploy

Page 68: Predictive Models for Production Apps with Yhat

Pass the name of your model and your BaseModel object to the deploy function

Deploy

Page 69: Predictive Models for Production Apps with Yhat

Execute deploy to host your model on Yhat

Deploy

Page 70: Predictive Models for Production Apps with Yhat

Make predictions in a production app

Page 72: Predictive Models for Production Apps with Yhat

Data/Code Bundle

Webapp: https://github.com/yhat/Beer-Rec-FlaskIPython Notebook: http://bit.ly/1bkCTHzDataset: http://bit.ly/14Wl64k

Page 73: Predictive Models for Production Apps with Yhat

Want to try?yhathq.com

Page 76: Predictive Models for Production Apps with Yhat

Appendix

Page 77: Predictive Models for Production Apps with Yhat

Learn by iteration from the context of real-world business applications.

Page 78: Predictive Models for Production Apps with Yhat

Deployment

Execute the deploy function to host your model on Yhat

Pass the name of your model and your BaseModel object to the deploy function

Pass objects you'd like included in your model as named arguments

Specify User Defined Functions you want to include in your project