Confidential & Proprietary
TensorFlow Wide & Deep Model
江骏 - 饿了了么深度学习平台 elearn 作者
Machine Learning GDE (Google Developers Experts)
Confidential & Proprietary
结构化数据
Structured Data
Confidential & Proprietary
传统⽅方法 XGBoost, Scikit-Learn models
https://github.com/dmlc/xgboost
Confidential & Proprietary
传统⽅方法 XGBoost, Scikit-Learn models
http://scikit-learn.org/
Confidential & Proprietary
Wide & Deep Model
• Submitted on 2016-06-24
• Jointly train a wide linear model and a deep feed-forward neural network
• Productionized and evaluated the system on Google Play
https://arxiv.org/abs/1606.07792
Confidential & Proprietary
Wide & Deep Model
https://www.tensorflow.org/tutorials/wide_and_deep
memorization generalization
Confidential & Proprietary
特征列列
Feature Columns
Confidential & Proprietary
Feature Columns
连续型(如:身⾼高、体重、历史订单量量)
tf.feature_column.numeric_column
Confidential & Proprietary
Feature Columns
⾮非连续型
知道具体类别数量量(如:性别、学历、等级、bool)
tf.feature_column.categorical_column_with_vocabulary_list
不不知道具体类别数量量(如:兴趣爱好,可能类别特别多)
tf.feature_column.categorical_column_with_hash_bucket
Confidential & Proprietary
Transformed Feature Columns
Bucketed Columns(如:年年龄段、订餐时间段)
⼈人为划分界线
tf.feature_column.bucketized_column
Crossed Columns(如:商家的⼀一系列列特征)
⼈人为告诉线性模型特征的相关性
tf.feature_column.crossed_column
Confidential & Proprietary
模型
Model Estimator
Confidential & Proprietary
Model
Confidential & Proprietary
Estimator
train
evaluate
predict
export_savedmodel
tensorflow/python/estimator/
Confidential & Proprietary
Estimator
https://developers.googleblog.com/2017/12/creating-custom-estimators-in-tensorflow.html
Confidential & Proprietary
导出模型/使⽤用模型
TensorFlow Serving
Confidential & Proprietary
为 TensorFlow Serving 输出模型
Confidential & Proprietary
Model ⼯工具
tensorflow/python/tools/saved_model_cli.py
https://youtu.be/sqYdlSF0BI8?t=30m4s
# What meta_graphs are in a model?
saved_model_cli show --dir /tmp/model_dir
# What signatures are in a meta_graph?
saved_model_cli show --dir /tmp/model_dir --tag_set serve
# What input & output tensors are in a signature?
saved_model_cli show --dir /tmp/model_dir --tag_set serve --signature_def serving_default
# Run a graph
saved_model_cli show --dir /tmp/model_dir --tag_set serve --signature_def xxx --inputs x1=/xxx/
xxx.npy --input_exprs 'x2=np.ones((3,1))'
Confidential & Proprietary
Model ⼯工具
Confidential & Proprietary
TensorFlow Serving (gRPC)
tensorflow_model_server --port=8500 --model_base_path=xxx
https://www.tensorflow.org/serving/
Confidential & Proprietary
a (gRPC) client to call TensorFlow Serving
pip install tensorflow-serving-api
# Build the input data as an Example object
# tf.Example:
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/example/example.proto
# tf.Features:
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/example/feature.proto
python2.7
Confidential & Proprietary
饿了了么实践 & 踩过的坑
ele.me
Confidential & Proprietary
饿了了么实践 & 踩过的坑
• 出餐、取餐、送餐 T 时常预估
• 商家到周围区域订单量量预估
• 商家代⾦金金券(红包)发放
• 搜索推荐点击率、购买率预估
• ……
Confidential & Proprietary
Google Cloud Machine Learning Engine
Confidential & Proprietary
Google CloudML Engine
https://cloud.google.com/ml-engine/
• 分布式训练、弹性伸缩
• 训练任务的监控
• GPU
• Hyperparameter Tuning
• 模型管理理
• 线上 Serving
• 与其它 Google Cloud ⼤大数据系统的整合
• Google Cloud Storage, Google BigQuery, logging, …
Confidential & Proprietary
Google CloudML Engine - Model
Confidential & Proprietary
I’m 江骏 / ohmystack
@饿了了么
I’m a Machine Learning GDE
(Google Developers Experts)
https://github.com/ohmystack
http://weibo.com/jiangjun1990
http://ohmystack.com/
推荐项⽬目(点击链接前往)
dt (docker-tool)
最爽功能:dt ssh 进⼊入 image 或 container
gotool
管理理 Golang 开发环境 GOPATH 的利利器器

TensorFlow Wide and Deep Model