SlideShare a Scribd company logo
Training and deploying ML
with Kubeflow and TensorFlow Extended (TFX)
About us
Gabriel Moreira
Lead Data Scientist - CI&T
Doctoral Candidate - ITA
@gspmoreira
Rodrigo PereiraFábio Uechi
Data Scientist - CI&T
Master’s Student - UNICAMP
@fabiouechi
ML Engineer - CI&T
DRIVEN BY
IMPACT
We are digital transformation agents
for the most valuable brands in the
world, generating business impact for
all projects we lead.
Investing in Machine
Learning since 2012
Recognized Expertise
Google ML Specialized Partner
Tensorflow.org Reference
ciandt.com
Cognitive
Solutions
End-to-End
Machine Learning
Capabilities
AGENDA
● Motivation
● Kubeflow
● TFX (TensorFlow Extended)
● Demo - News Recommender System
○ Data validation
○ Transform
○ Model training and evaluation
○ Deploy
● Demo - ML models serving and monitoring
Building ML Products
Building
a
Model
Logging
Data
Ingestion
Data
Analysis
Data
Transform
-ation
Data
Validation
Data
Splitting
Trainer
Model
Validation
Training
At Scale
Roll-out Serving Monitoring
MOTIVATION
MOTIVATION
Prototype MVP With Demo In Jupyter
Notebook: 2 Weeks
Demo with front-end mockup with
blog post: +3 Days
Experiments.Github.Com: +3 Months
https://github.com/hamelsmu/code_search https://towardsdatascience.com/semantic-code-se
arch-3cd6d244a39c
https://experiments.github.com/
MOTIVATION - Perception
Configuration
Data
Collection
Data
Verification
Feature
Extraction
Process
Management
Tools
Analysis
Tools
Machine
Resource
Management
Serving
Infrastructure
Monitoring
ML Code
Reality: ML requires DevOps; lots of it
Configuration
Data Collection
Data
Verification
Feature Extraction Process Management
Tools
Analysis Tools
Machine Resource
Management
Serving
Infrastructure
Monitoring
ML
Code
Source: Sculley et al.: Hidden Technical Debt in
Machine Learning Systems
Less devops work
Let data scientists and ML
engineers focus on models & data
Source: Monica Rogatti’s Hierarchy of Needs
ML Landscape (https://landscape.lfdl.io)
ML platforms
● Uber - Michelangelo
● AirBnB - Bighead
● Facebook - FB Learner
● Lyft - Lyft Learn
A curated set of compatible tools and artifacts that lays a
foundation for running production ML apps on top of
Kubernetes
What is Kubernetes ?
Greek for “Helmsman”; also the root of the word
“Governor”
● Container orchestrator
● Runs containers
● Supports multiple clouds and bare-metal environments
● Inspired and informed by Google’s experiences and internal
systems
● Open source, written in Go
● kubernetes.io
Manage applications, not machines
Kubeflow: A platform for building ML products
● Leverage containers and Kubernetes to solve the challenges of building ML products
○ Reduce the time and effort to get models launched
● Why Kubernetes
○ Kubernetes runs everywhere
○ Enterprises can adopt shared infrastructure and patterns for ML and non ML services
○ Knowledge transfer across the organization
● Kubeflow is open
○ No lock in
○ 120+ Members
○ 20+ Organizations
○ Stats available @ http://devstats.kubeflow.org
ML Components
● Goal: components for every stage of ML
● Examples:
○ Experimentation / Data Exploration
■ Jupyter/JupyterHub
○ Training
■ K8s CRDs for distributed training for
PyTorch & TFJob
■ Katib - For HP Tuning
○ Workflows:
■ Pipelines
○ Feature Store
■ Feast (from GOJEK)
○ Serving
■ Seldon, TF and NVIDIA RT
Kubeflow
Pipelines
● End-to-end ML workflows
● Orchestration
● Service integration
● Components & sharing
● Job tracking, experimentation,
monitoring
● Notebook integration
KubeFlow Pipelines
csv2tfrecord = dsl.ContainerOp(
name='csv2tfrecord',
image='gcr.io/{}/chameleon/preproc:3bb6ab3'.format(project_id),
command=["python3",
"/app/csv2tfrecord_transform.py"],
arguments=[
"--input_clicks_csv_path", input_clicks_csv_path_regex,
"--output_sessions_tfrecords_path", output_sessions_tfrecords_path,
"--tfx_artifacts_dir", output_sessions_artifacts_path,
"--first_n_hours", first_n_hours,
"--runner", "DirectRunner"
],
file_outputs={
"tfrecords_path": "/tfrecords_path.txt",
"tfx_path": "/tfx_path.txt"
}
).apply(gcp.use_gcp_secret('user-gcp-sa'))
data_validator = dsl.ContainerOp(
name='data-validator',
image='gcr.io/{}/chameleon/data-validator:b356ed7'.format(project_id),
command=["python", "-m", "data_validator"],
arguments=['--input-data-path', input_clicks_csv_path_regex,
'--top-n', data_validator_top_n,
'--offset', data_validator_hour_offset]
).apply(gcp.use_gcp_secret('user-gcp-sa'))
train = dsl.ContainerOp(
name='train',
image='gcr.io/{}/chameleon/train:4f19dbc'.format(project_id),
command=["python", "-m", "nar.nar_trainer_gcom"],
arguments=[
"--model_dir", str(model_dir) + "/{{workflow.uid}}",
"--input_tfrecords_path", csv2tfrecord.outputs["tfrecords_path"],
"--train_files_from", 0,
"--train_files_up_to", first_n_hours,
"--training_hours_for_each_eval", 5,
],
file_outputs={
'saved_model_path': '/saved_model_path.txt'
},
output_artifact_paths={
'mlpipeline-ui-metadata': '/mlpipeline-ui-metadata.json',
'mlpipeline-metrics': '/mlpipeline-metrics.json'
}
).apply(gcp.use_gcp_secret('user-gcp-sa'))
.after(csv2tfrecord)
model_pusher = dsl.ContainerOp(
name='pusher',
image='gcr.io/cloud-builders/gsutil',
arguments=[ '-m', 'cp', '-r', saved_model_path + '/*', tfserving_path]
).apply(gcp.use_gcp_secret('user-gcp-sa')).after(train)
Demo: Run the pipe!
Use Case:
News Recommender
System
Challenges
News Recommender Systems
1. Streaming clicks and news articles
2. Most users are anonymous
3. Users’ preferences shift
4. Accelerated relevance decay
Percentile of clicks Article age
10% up to 4 hours
25% up to 5 hours
50% (Median) up to 8 hours
75% up to 14 hours
90% up to 26 hours
Factors affecting news relevance
News Recommender Systems
News
relevance
Topics Entities Publisher
News static properties
Recency Popularity
News dynamic properties
News article
User
TimeLocation Device
User current context
Long-term
interests
Short-term
interests
Global factors
Season-
ality
User interests
Breaking
events
Popular
Topics
Referrer
News session-based recommender overview
CHAMELEON
User session clicks
C1
C2
C3
C4
Next-click prediction
(RNN model)
Article B
Article A
Article C
Article D
...
Ranked articles
Candidate (recommendable) articles
Article
Context
Article
Content
Embeddings
Next-Article Recommendation (NAR)
Time
Location
Device
User context
User interaction
past read articles
Popularity
Recency
Article context
Users Past
Sessions
candidate next articles
(positive and neg.)
active article
Active
Sessions
When a user reads a news article...
Predicted Next-Article Embedding
Session Representation (SR)
Recommendations Ranking (RR)
User-Personalized Contextual Article Embedding
Contextual Article Representation (CAR)
Active user session
Module Sub-Module EmbeddingInput Output Data repositoryAttributesLegend:
Article
Content
Embedding
28
Recommendations Ranking
(RR) sub-module
Eq. 7 - Loss function (HUANG et al., 2013)
Eq. 4 - Relevance Score of an item for a user session
Eq. 5 - Cosine similarity
Eq. 6 - Softmax over Relevance Score (HUANG et al., 2013)
Recommended
articles
What goes inside the box?CHAMELEON
TensorFlow
Extended
TensorFlow Extended
TFX is set of libraries that helps you to implement a scalable and high-performance machine learning
pipeline that might includes the steps: data preprocessing, modeling, training, serving inference, and
managing deployments to online, mobile and JavaScript targets.
Main Components:
● TensorFlow Data Validation (TFDV)
● TensorFlow Transform (TFT)
● TensorFlow Model Analysis (TFMA)
OBS: Apache Beam is required to build any TFX pipeline.
Demo: Session-based Recommender Systems using TFX components in a Kubeflow pipeline
TensorFlow Extended
TFDV - Data
Validation
TFDV - TensorFlow Data Validation
TensorFlow Data Validation (TFDV) is a library for data exploration and validation.
TFDV includes:
● Scalable calculation of summary statistics of training and test data.
● Integration with a viewer for data distributions and statistics
● Automated data-schema generation to describe expectations about data like required values, ranges,
and vocabularies
● Anomaly detection to identify anomalies, such as missing features, missing values, out-of-range
values, wrong feature types, distribution skewness
def analyse(input_data_list, top_n, offset=24):
logger.info('Infer data schema from first file')
stats = tfdv.generate_statistics_from_csv(
data_location=input_data_list[0])
inferred_schema = tfdv.infer_schema(statistics=stats)
logger.info("Inferred schema n {}".format(inferred_schema))
curr_stats = stats
for file_i in range(offset, top_n, 1):
logger.info('Checking for anomalies between {} and {}'.format(
input_data_list[file_i-offset], input_data_list[file_i]))
future_stats = tfdv.generate_statistics_from_csv(
data_location=input_data_list[file_i])
for feat_name in ["click_article_id",
"session_start",
"click_timestamp",
"click_region",
"click_environment",
"click_country",
"click_os",
"session_size",
"session_id",
"click_deviceGroup",
"user_id",
"click_referrer_type"]:
feature = tfdv.get_feature(inferred_schema, feat_name)
feature.skew_comparator.infinity_norm.threshold = 0.01
feature.drift_comparator.infinity_norm.threshold = 0.01
anomalies = tfdv.validate_statistics(previous_statistics=curr_stats,
statistics=future_stats, schema=inferred_schema)
n_anomalies = len(anomalies.anomaly_info.items())
if n_anomalies == 0:
logger.info('No anomalies found')
else:
logger.warn('{} anomalies found')
for feature_name, anomaly_info in anomalies.anomaly_info.items():
logger.info("Feature {} Anomaly: {}".format(
feature_name, anomaly_info.description))
curr_stats = future_stats
TFT -
Tensorflow
Transform
TFT - TensorFlow Transform
A library for preprocessing data with TensorFlow. TensorFlow Transform is useful for data that requires a full-
pass transformations, such as:
● Input normalization.
● Convert strings to integers by generating a vocabulary over all input values.
Goal: Write transform function only once and use it both on training and serving.
OBS: Currently FixedLenSequenceFeature are not supported
def feature_spec_schema():
""" Feature specification schema
"""
schema_dict = {}
for feat, feat_type in [('user_id', tf.int64),
('session_id', tf.int64),
('session_start', tf.int64),
('session_size', tf.int64),
]:
schema_dict[feat] = tf.FixedLenFeature([], dtype=feat_type)
for feat, feat_type in [('click_timestamp', tf.int64),
('click_article_id', tf.int64),
('click_environment', tf.int64),
('click_deviceGroup', tf.int64),
('click_os', tf.int64),
('click_country', tf.int64),
('click_region', tf.int64),
('click_referrer_type', tf.int64)]:
schema_dict[feat] = tf.VarLenFeature(dtype=feat_type)
schema = dataset_metadata.DatasetMetadata(
dataset_schema.from_feature_spec(schema_dict))
return schema
import apache_beam as beam
import tensorflow_transform as tft
from tensorflow_transform.beam import impl
from tensorflow_transform.tf_metadata import dataset_schema
from tensorflow_transform.tf_metadata import dataset_metadata
from tensorflow_transform.coders import example_proto_coder
from tensorflow_transform.tf_metadata import metadata_io
from tensorflow_transform.beam.tft_beam_io import transform_fn_io
dataset_schema = feature_spec_schema()
with beam.Pipeline(options=pipeline_options) as pipeline:
with impl.Context(args.temp_dir):
clicks_hour_files_pc = (
pipeline | "Load Files" >> beam.Create(clicks_hour_files))
sessions_per_hour = (
clicks_hour_files_pc | "Load Sessions Per Hour" >> beam.ParDo(LoadSessionsPerHour()))
transformed_data, transform_fn = ((sessions_per_hour, dataset_schema) |
"Analyze and Transform" >> impl.AnalyzeAndTransformDataset(preprocess_fn))
transformed_dataset, transformed_metadata = transformed_data
timestamped_items = transformed_dataset | 'timestamp' >> beam.ParDo(
AddTimestampDoFn())
fixed_windowed_items = (
timestamped_items | 'window' >> beam.WindowInto(beam.window.FixedWindows(60 * 60), # Window size = 1h
accumulation_mode=beam.trigger.AccumulationMode.DISCARDING
))
_ = (fixed_windowed_items |
'Format' >> beam.ParDo(ExtractTimeWindowStartAsKey()) |
"Aggregate by hour_index" >> beam.GroupByKey() |
"Dump TFRecord per hour" >> beam.Map(
lambda g: DumpTFRecord(g, args.output_sessions_tfrecords_path)))
_ = transform_fn | 'Dump Transform Function Graph' >> transform_fn_io.WriteTransformFn(
args.tfx_artifacts_dir)
def preprocess_fn(input_feature):
output_features = {}
# FixedLenFeature
output_features['user_id'] = input_feature['user_id']
output_features['session_id'] = input_feature['session_id']
output_features['session_start'] = input_feature['session_start']
output_features['session_size'] = input_feature['session_size']
# VarLenFeature
output_features['item_clicked'] = input_feature['click_article_id']
output_features['environment'] = input_feature['click_environment']
output_features['deviceGroup'] = input_feature['click_deviceGroup']
output_features['os'] = input_feature['click_os']
output_features['country'] = input_feature['click_country']
output_features['region'] = input_feature['click_region']
output_features['referrer_type'] = input_feature['click_referrer_type']
output_features['event_timestamp'] = input_feature['click_timestamp']
local_weekday = tf.SparseTensor(input_feature['click_timestamp'].indices,
tf.map_fn(fn=utc_timestamp_to_local_weekday,
elems=input_feature['click_timestamp'].values,
back_prop=False,
infer_shape=False,
dtype=tf.int64),
input_feature['click_timestamp'].dense_shape)
output_features['local_weekday'] = local_weekday
...
local_hour_cos = tf.SparseTensor(input_feature['click_timestamp'].indices,
tf.map_fn(fn=utc_timestamp_to_local_hour_cos,
elems=input_feature['click_timestamp'].values,
back_prop=False,
infer_shape=False,
dtype=tf.float32),
input_feature['click_timestamp'].dense_shape)
output_features['local_hour_cos'] = local_hour_cos
return output_features
transformed_train, transform_fn = ((raw_train, schema) |
"Analyze and Transform - train" >>
impl.AnalyzeAndTransformDataset(preprocess_fn))
transformed_eval = (((raw_eval, schema), transform_fn) |
"Transform - eval" >> impl.TransformDataset())
What about eval set?
Tensorflow
Training
and
Evaluation
TF Estimator
def build_estimator(model_dir,
content_article_embeddings_matrix,
articles_metadata, articles_features_config,
session_features_config):
"""Build an estimator appropriate for the given model type."""
run_config = tf.estimator.RunConfig(tf_random_seed=RANDOM_SEED,
keep_checkpoint_max=1,
save_checkpoints_secs=1200,
save_summary_steps=100,
log_step_count_steps=100
)
estimator = tf.estimator.Estimator(
config=run_config,
model_dir=model_dir,
model_fn=nar_module_model_fn,
params={
'batch_size': FLAGS.batch_size,
'lr': FLAGS.learning_rate,
'dropout_keep_prob': FLAGS.dropout_keep_prob,
'reg_weight_decay': FLAGS.reg_l2,
...
})
return estimator
Creating the Estimator
def nar_module_model_fn(features, labels, mode, params):
model = NARModuleModel(mode, features, labels,… )
hooks = [ItemsStateUpdaterHook(mode, model,… )]
if mode == tf.estimator.ModeKeys.TRAIN:
return tf.estimator.EstimatorSpec(mode, loss=model.total_loss,
train_op=model.train, training_chief_hooks=hooks)
elif mode == tf.estimator.ModeKeys.EVAL:
eval_metrics = {'mrr_at_n': (model.mrr, model.mrr_update_op), ... }
return tf.estimator.EstimatorSpec(mode, loss=model.total_loss,
eval_metric_ops=eval_metrics, evaluation_hooks=hooks)
elif mode == tf.estimator.ModeKeys.PREDICT:
predictions = model.predictions
export_outputs = {'predict_output': tf.estimator.export.PredictOutput(predictions)}
return tf.estimator.EstimatorSpec(mode, predictions=predictions,
export_outputs=export_outputs)
Building the model function
tft_metadata = TFTransformOutput(FLAGS.tft_artifacts_dir)
model = build_estimator(model_output_dir, article_embeddings_matrix,
articles_metadata, articles_features_config, ...)
model.train(input_fn=lambda: prepare_dataset_iterator(training_files_chunk,
tft_metadata, batch_size=FLAGS.batch_size, ...))
model.evaluate(input_fn=lambda: prepare_dataset_iterator(eval_file,
tft_metadata, batch_size=FLAGS.batch_size, ...)
predictions = model.predict(input_fn=lambda:
prepare_dataset_iterator(tfrecords_files, tft_metadata,
FLAGS.batch_size, ...)
Training, Evaluating and Predicting with the Estimator
def prepare_dataset_iterator(files, tft_metadata, batch_size=128, ...)
feature_spec = tft_metadata.transformed_feature_spec()
# This makes a dataset of raw TFRecords
dataset = tf.data.TFRecordDataset(path, compression_type='GZIP')
dataset = dataset.map(lambda x: tf.io.parse_single_example(x, feature_spec))
dataset = dataset.padded_batch(batch_size, padded_shapes=features_shapes)
# Define an abstract iterator that has the shape and type of our datasets
iterator = ds.make_one_shot_iterator()
# This is an op that gets the next element from the iterator
next_element = iterator.get_next()
return next_element
Defining input function
Features schema come from TFT!
def export_saved_model(model, model_output_path, additional_features_info, tft_metadata):
raw_feature_spec = feature_spec_schema()
def serving_input_fn():
raw_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
raw_feature_spec, default_batch_size=None)
serving_input_receiver = raw_input_fn()
# Apply the transform function that was used to generate the materialized data.
raw_features = serving_input_receiver.features
transformed_features = tft_metadata.transform_raw_features(raw_features)
for feature_name in transformed_features.keys():
if type(transformed_features[feature_name]) == tf.sparse.SparseTensor
transformed_features[feature_name] = tf.sparse.to_dense(
transformed_features[feature_name])
return tf.estimator.export.ServingInputReceiver(
receiver_tensors=serving_input_receiver.receiver_tensors,
features=transformed_features)
servable_model_path = model.export_savedmodel(
model_output_path, serving_input_fn, strip_default_attrs=True)
return servable_model_path
Defining serving function and exporting SavedModel
Apply transforms
from TFT graph
Tensorflow
Model
Analysis
TFMA - Model Analysis
TensorFlow Model Analysis allows you to
perform model evaluations in the TFX pipeline,
and view resultant metrics and plots in a
Jupyter notebook. Specifically, it can provide:
● Metrics computed on entire training and
holdout dataset, as well as next-day
evaluations
● Tracking metrics over time
● Model quality performance on different
feature slices
● Supports evaluation on large amounts of
data in the distributed manner
TFMA - Model Analysis
TFMA - Model Analysis
TFMA - Model Analysis
Demo
● CI/CD
● Serving Seldon (A/B testing)
● Monitoring with Prometheus and Grafana
Machine Learning CI/CD - Gitops style
Data Scientist
Tensorflow
Serving
Serving and monitoring: Single model
Model Repository
Model
BModel
A
Model AEngineClients
REST / GRPC
metrics
Tensorflow
Serving
Serving and monitoring: A/B testing
Model Repository
Model
BModel
A
Model A
Model B
A/B TestClients
REST / GRPC
metrics
midi.as/papislatam
CHAMELEON research code:
http://bit.ly/chameleon_papis
P.s. The code demonstrated in this workshop will be
published soon on GitHub and will be referenced in the
README of the above repo)
Thank you!
ciandt.com

More Related Content

What's hot

Machine Learning and Hadoop
Machine Learning and HadoopMachine Learning and Hadoop
Machine Learning and Hadoop
Josh Patterson
 
Predicting Tweet Sentiment
Predicting Tweet SentimentPredicting Tweet Sentiment
Predicting Tweet Sentiment
Lucinda Linde
 
mlflow: Accelerating the End-to-End ML lifecycle
mlflow: Accelerating the End-to-End ML lifecyclemlflow: Accelerating the End-to-End ML lifecycle
mlflow: Accelerating the End-to-End ML lifecycle
Databricks
 
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
MLconf
 
Scalable Collaborative Filtering Recommendation Algorithms on Apache Spark
Scalable Collaborative Filtering Recommendation Algorithms on Apache SparkScalable Collaborative Filtering Recommendation Algorithms on Apache Spark
Scalable Collaborative Filtering Recommendation Algorithms on Apache Spark
Evan Casey
 
Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...
Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...
Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...
Databricks
 
A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...
A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...
A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...
Natalia Díaz Rodríguez
 
[Research] azure ml anatomy of a machine learning service - Sharat Chikkerur
[Research] azure ml  anatomy of a machine learning service - Sharat Chikkerur[Research] azure ml  anatomy of a machine learning service - Sharat Chikkerur
[Research] azure ml anatomy of a machine learning service - Sharat Chikkerur
PAPIs.io
 
Lessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixLessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at Netflix
Justin Basilico
 
Deploying Machine Learning Models to Production
Deploying Machine Learning Models to ProductionDeploying Machine Learning Models to Production
Deploying Machine Learning Models to Production
Anass Bensrhir - Senior Data Scientist
 
Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...
Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...
Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...
Databricks
 
Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
 Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ... Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
Databricks
 
Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...
Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...
Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...
MLconf
 
Using the search engine as recommendation engine
Using the search engine as recommendation engineUsing the search engine as recommendation engine
Using the search engine as recommendation engine
Lars Marius Garshol
 
Automatic machine learning (AutoML) 101
Automatic machine learning (AutoML) 101Automatic machine learning (AutoML) 101
Automatic machine learning (AutoML) 101
QuantUniversity
 
An Introduction to Apache Hadoop, Mahout and HBase
An Introduction to Apache Hadoop, Mahout and HBaseAn Introduction to Apache Hadoop, Mahout and HBase
An Introduction to Apache Hadoop, Mahout and HBaseLukas Vlcek
 
Graph Based Machine Learning on Relational Data
Graph Based Machine Learning on Relational DataGraph Based Machine Learning on Relational Data
Graph Based Machine Learning on Relational DataBenjamin Bengfort
 
Text Classification with Lucene/Solr, Apache Hadoop and LibSVM
Text Classification with Lucene/Solr, Apache Hadoop and LibSVMText Classification with Lucene/Solr, Apache Hadoop and LibSVM
Text Classification with Lucene/Solr, Apache Hadoop and LibSVM
lucenerevolution
 
Julia: A modern language for software 2.0
Julia: A modern language for software 2.0Julia: A modern language for software 2.0
Julia: A modern language for software 2.0
Viral Shah
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle
Databricks
 

What's hot (20)

Machine Learning and Hadoop
Machine Learning and HadoopMachine Learning and Hadoop
Machine Learning and Hadoop
 
Predicting Tweet Sentiment
Predicting Tweet SentimentPredicting Tweet Sentiment
Predicting Tweet Sentiment
 
mlflow: Accelerating the End-to-End ML lifecycle
mlflow: Accelerating the End-to-End ML lifecyclemlflow: Accelerating the End-to-End ML lifecycle
mlflow: Accelerating the End-to-End ML lifecycle
 
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
 
Scalable Collaborative Filtering Recommendation Algorithms on Apache Spark
Scalable Collaborative Filtering Recommendation Algorithms on Apache SparkScalable Collaborative Filtering Recommendation Algorithms on Apache Spark
Scalable Collaborative Filtering Recommendation Algorithms on Apache Spark
 
Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...
Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...
Deep Learning for Natural Language Processing Using Apache Spark and TensorFl...
 
A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...
A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...
A Folksonomy of styles, aka: other stylists also said and Subjective Influenc...
 
[Research] azure ml anatomy of a machine learning service - Sharat Chikkerur
[Research] azure ml  anatomy of a machine learning service - Sharat Chikkerur[Research] azure ml  anatomy of a machine learning service - Sharat Chikkerur
[Research] azure ml anatomy of a machine learning service - Sharat Chikkerur
 
Lessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixLessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at Netflix
 
Deploying Machine Learning Models to Production
Deploying Machine Learning Models to ProductionDeploying Machine Learning Models to Production
Deploying Machine Learning Models to Production
 
Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...
Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...
Using Crowdsourced Images to Create Image Recognition Models with Analytics Z...
 
Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
 Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ... Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
 
Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...
Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...
Funda Gunes, Senior Research Statistician Developer & Patrick Koch, Principal...
 
Using the search engine as recommendation engine
Using the search engine as recommendation engineUsing the search engine as recommendation engine
Using the search engine as recommendation engine
 
Automatic machine learning (AutoML) 101
Automatic machine learning (AutoML) 101Automatic machine learning (AutoML) 101
Automatic machine learning (AutoML) 101
 
An Introduction to Apache Hadoop, Mahout and HBase
An Introduction to Apache Hadoop, Mahout and HBaseAn Introduction to Apache Hadoop, Mahout and HBase
An Introduction to Apache Hadoop, Mahout and HBase
 
Graph Based Machine Learning on Relational Data
Graph Based Machine Learning on Relational DataGraph Based Machine Learning on Relational Data
Graph Based Machine Learning on Relational Data
 
Text Classification with Lucene/Solr, Apache Hadoop and LibSVM
Text Classification with Lucene/Solr, Apache Hadoop and LibSVMText Classification with Lucene/Solr, Apache Hadoop and LibSVM
Text Classification with Lucene/Solr, Apache Hadoop and LibSVM
 
Julia: A modern language for software 2.0
Julia: A modern language for software 2.0Julia: A modern language for software 2.0
Julia: A modern language for software 2.0
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle
 

Similar to PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorFlow Extended (TFX)

MLOps - Build pipelines with Tensor Flow Extended & Kubeflow
MLOps - Build pipelines with Tensor Flow Extended & KubeflowMLOps - Build pipelines with Tensor Flow Extended & Kubeflow
MLOps - Build pipelines with Tensor Flow Extended & Kubeflow
Jan Kirenz
 
Infrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload DeploymentInfrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload Deployment
Databricks
 
Serverless machine learning architectures at Helixa
Serverless machine learning architectures at HelixaServerless machine learning architectures at Helixa
Serverless machine learning architectures at Helixa
Data Science Milan
 
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
DataWorks Summit
 
Model Drift Monitoring using Tensorflow Model Analysis
Model Drift Monitoring using Tensorflow Model AnalysisModel Drift Monitoring using Tensorflow Model Analysis
Model Drift Monitoring using Tensorflow Model Analysis
Vivek Raja P S
 
Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...
Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...
Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...
Akash Tandon
 
Data Ops at TripActions
Data Ops at TripActionsData Ops at TripActions
Data Ops at TripActions
Rob Winters
 
"Managing the Complete Machine Learning Lifecycle with MLflow"
"Managing the Complete Machine Learning Lifecycle with MLflow""Managing the Complete Machine Learning Lifecycle with MLflow"
"Managing the Complete Machine Learning Lifecycle with MLflow"
Databricks
 
Mohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with KubeflowMohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with Kubeflow
Lviv Startup Club
 
Mohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with KubeflowMohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with Kubeflow
Edunomica
 
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
James Anderson
 
MLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
MLOps Virtual Event | Building Machine Learning Platforms for the Full LifecycleMLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
MLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
Databricks
 
EPAM ML/AI Accelerator - ODAHU
EPAM ML/AI Accelerator - ODAHUEPAM ML/AI Accelerator - ODAHU
EPAM ML/AI Accelerator - ODAHU
Dmitrii Suslov
 
DEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNINGDEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNING
CodeOps Technologies LLP
 
MLOps Using MLflow
MLOps Using MLflowMLOps Using MLflow
MLOps Using MLflow
Databricks
 
Machine Learning Models in Production
Machine Learning Models in ProductionMachine Learning Models in Production
Machine Learning Models in Production
DataWorks Summit
 
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
HostedbyConfluent
 
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
gdgsurrey
 
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Databricks
 
MLflow: Infrastructure for a Complete Machine Learning Life Cycle
MLflow: Infrastructure for a Complete Machine Learning Life CycleMLflow: Infrastructure for a Complete Machine Learning Life Cycle
MLflow: Infrastructure for a Complete Machine Learning Life Cycle
Databricks
 

Similar to PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorFlow Extended (TFX) (20)

MLOps - Build pipelines with Tensor Flow Extended & Kubeflow
MLOps - Build pipelines with Tensor Flow Extended & KubeflowMLOps - Build pipelines with Tensor Flow Extended & Kubeflow
MLOps - Build pipelines with Tensor Flow Extended & Kubeflow
 
Infrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload DeploymentInfrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload Deployment
 
Serverless machine learning architectures at Helixa
Serverless machine learning architectures at HelixaServerless machine learning architectures at Helixa
Serverless machine learning architectures at Helixa
 
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
 
Model Drift Monitoring using Tensorflow Model Analysis
Model Drift Monitoring using Tensorflow Model AnalysisModel Drift Monitoring using Tensorflow Model Analysis
Model Drift Monitoring using Tensorflow Model Analysis
 
Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...
Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...
Kubeflow: portable and scalable machine learning using Jupyterhub and Kuberne...
 
Data Ops at TripActions
Data Ops at TripActionsData Ops at TripActions
Data Ops at TripActions
 
"Managing the Complete Machine Learning Lifecycle with MLflow"
"Managing the Complete Machine Learning Lifecycle with MLflow""Managing the Complete Machine Learning Lifecycle with MLflow"
"Managing the Complete Machine Learning Lifecycle with MLflow"
 
Mohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with KubeflowMohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with Kubeflow
 
Mohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with KubeflowMohamed Sabri: Operationalize machine learning with Kubeflow
Mohamed Sabri: Operationalize machine learning with Kubeflow
 
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
 
MLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
MLOps Virtual Event | Building Machine Learning Platforms for the Full LifecycleMLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
MLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
 
EPAM ML/AI Accelerator - ODAHU
EPAM ML/AI Accelerator - ODAHUEPAM ML/AI Accelerator - ODAHU
EPAM ML/AI Accelerator - ODAHU
 
DEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNINGDEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNING
 
MLOps Using MLflow
MLOps Using MLflowMLOps Using MLflow
MLOps Using MLflow
 
Machine Learning Models in Production
Machine Learning Models in ProductionMachine Learning Models in Production
Machine Learning Models in Production
 
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
 
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
 
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
 
MLflow: Infrastructure for a Complete Machine Learning Life Cycle
MLflow: Infrastructure for a Complete Machine Learning Life CycleMLflow: Infrastructure for a Complete Machine Learning Life Cycle
MLflow: Infrastructure for a Complete Machine Learning Life Cycle
 

More from Gabriel Moreira

[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...
[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...
[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...
Gabriel Moreira
 
PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...
PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...
PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...
Gabriel Moreira
 
Deep Learning for Recommender Systems @ TDC SP 2019
Deep Learning for Recommender Systems @ TDC SP 2019Deep Learning for Recommender Systems @ TDC SP 2019
Deep Learning for Recommender Systems @ TDC SP 2019
Gabriel Moreira
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Gabriel Moreira
 
Sistemas de Recomendação sem Enrolação
Sistemas de Recomendação sem Enrolação Sistemas de Recomendação sem Enrolação
Sistemas de Recomendação sem Enrolação
Gabriel Moreira
 
Deep Recommender Systems - PAPIs.io LATAM 2018
Deep Recommender Systems - PAPIs.io LATAM 2018Deep Recommender Systems - PAPIs.io LATAM 2018
Deep Recommender Systems - PAPIs.io LATAM 2018
Gabriel Moreira
 
CI&T Tech Summit 2017 - Machine Learning para Sistemas de Recomendação
CI&T Tech Summit 2017 - Machine Learning para Sistemas de RecomendaçãoCI&T Tech Summit 2017 - Machine Learning para Sistemas de Recomendação
CI&T Tech Summit 2017 - Machine Learning para Sistemas de Recomendação
Gabriel Moreira
 
Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017
Gabriel Moreira
 
Feature Engineering - Getting most out of data for predictive models
Feature Engineering - Getting most out of data for predictive modelsFeature Engineering - Getting most out of data for predictive models
Feature Engineering - Getting most out of data for predictive models
Gabriel Moreira
 
Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...
Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...
Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...
Gabriel Moreira
 
Discovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender SystemsDiscovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender Systems
Gabriel Moreira
 
Python for Data Science - Python Brasil 11 (2015)
Python for Data Science - Python Brasil 11 (2015)Python for Data Science - Python Brasil 11 (2015)
Python for Data Science - Python Brasil 11 (2015)
Gabriel Moreira
 
Python for Data Science - TDC 2015
Python for Data Science - TDC 2015Python for Data Science - TDC 2015
Python for Data Science - TDC 2015
Gabriel Moreira
 
Python for Data Science
Python for Data SciencePython for Data Science
Python for Data Science
Gabriel Moreira
 
Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...
Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...
Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...
Gabriel Moreira
 
Developing GeoGames for Education with Kinect and Android for ArcGIS Runtime
Developing GeoGames for Education with Kinect and Android for ArcGIS RuntimeDeveloping GeoGames for Education with Kinect and Android for ArcGIS Runtime
Developing GeoGames for Education with Kinect and Android for ArcGIS Runtime
Gabriel Moreira
 
Dojo Imagem de Android - 19/06/2012
Dojo Imagem de Android - 19/06/2012Dojo Imagem de Android - 19/06/2012
Dojo Imagem de Android - 19/06/2012
Gabriel Moreira
 
Agile Testing e outros amendoins
Agile Testing e outros amendoinsAgile Testing e outros amendoins
Agile Testing e outros amendoins
Gabriel Moreira
 
ArcGIS Runtime For Android
ArcGIS Runtime For AndroidArcGIS Runtime For Android
ArcGIS Runtime For Android
Gabriel Moreira
 

More from Gabriel Moreira (20)

[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...
[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...
[Phd Thesis Defense] CHAMELEON: A Deep Learning Meta-Architecture for News Re...
 
PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...
PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...
PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorF...
 
Deep Learning for Recommender Systems @ TDC SP 2019
Deep Learning for Recommender Systems @ TDC SP 2019Deep Learning for Recommender Systems @ TDC SP 2019
Deep Learning for Recommender Systems @ TDC SP 2019
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Sistemas de Recomendação sem Enrolação
Sistemas de Recomendação sem Enrolação Sistemas de Recomendação sem Enrolação
Sistemas de Recomendação sem Enrolação
 
Deep Recommender Systems - PAPIs.io LATAM 2018
Deep Recommender Systems - PAPIs.io LATAM 2018Deep Recommender Systems - PAPIs.io LATAM 2018
Deep Recommender Systems - PAPIs.io LATAM 2018
 
CI&T Tech Summit 2017 - Machine Learning para Sistemas de Recomendação
CI&T Tech Summit 2017 - Machine Learning para Sistemas de RecomendaçãoCI&T Tech Summit 2017 - Machine Learning para Sistemas de Recomendação
CI&T Tech Summit 2017 - Machine Learning para Sistemas de Recomendação
 
Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017
 
Feature Engineering - Getting most out of data for predictive models
Feature Engineering - Getting most out of data for predictive modelsFeature Engineering - Getting most out of data for predictive models
Feature Engineering - Getting most out of data for predictive models
 
Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...
Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...
Discovering User's Topics of Interest in Recommender Systems @ Meetup Machine...
 
lsrs15_ciandt
lsrs15_ciandtlsrs15_ciandt
lsrs15_ciandt
 
Discovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender SystemsDiscovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender Systems
 
Python for Data Science - Python Brasil 11 (2015)
Python for Data Science - Python Brasil 11 (2015)Python for Data Science - Python Brasil 11 (2015)
Python for Data Science - Python Brasil 11 (2015)
 
Python for Data Science - TDC 2015
Python for Data Science - TDC 2015Python for Data Science - TDC 2015
Python for Data Science - TDC 2015
 
Python for Data Science
Python for Data SciencePython for Data Science
Python for Data Science
 
Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...
Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...
Using Neural Networks and 3D sensors data to model LIBRAS gestures recognitio...
 
Developing GeoGames for Education with Kinect and Android for ArcGIS Runtime
Developing GeoGames for Education with Kinect and Android for ArcGIS RuntimeDeveloping GeoGames for Education with Kinect and Android for ArcGIS Runtime
Developing GeoGames for Education with Kinect and Android for ArcGIS Runtime
 
Dojo Imagem de Android - 19/06/2012
Dojo Imagem de Android - 19/06/2012Dojo Imagem de Android - 19/06/2012
Dojo Imagem de Android - 19/06/2012
 
Agile Testing e outros amendoins
Agile Testing e outros amendoinsAgile Testing e outros amendoins
Agile Testing e outros amendoins
 
ArcGIS Runtime For Android
ArcGIS Runtime For AndroidArcGIS Runtime For Android
ArcGIS Runtime For Android
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 

PAPIs LATAM 2019 - Training and deploying ML models with Kubeflow and TensorFlow Extended (TFX)

  • 1. Training and deploying ML with Kubeflow and TensorFlow Extended (TFX)
  • 2. About us Gabriel Moreira Lead Data Scientist - CI&T Doctoral Candidate - ITA @gspmoreira Rodrigo PereiraFábio Uechi Data Scientist - CI&T Master’s Student - UNICAMP @fabiouechi ML Engineer - CI&T
  • 3. DRIVEN BY IMPACT We are digital transformation agents for the most valuable brands in the world, generating business impact for all projects we lead.
  • 4. Investing in Machine Learning since 2012 Recognized Expertise Google ML Specialized Partner Tensorflow.org Reference ciandt.com Cognitive Solutions End-to-End Machine Learning Capabilities
  • 5. AGENDA ● Motivation ● Kubeflow ● TFX (TensorFlow Extended) ● Demo - News Recommender System ○ Data validation ○ Transform ○ Model training and evaluation ○ Deploy ● Demo - ML models serving and monitoring
  • 8. MOTIVATION Prototype MVP With Demo In Jupyter Notebook: 2 Weeks Demo with front-end mockup with blog post: +3 Days Experiments.Github.Com: +3 Months https://github.com/hamelsmu/code_search https://towardsdatascience.com/semantic-code-se arch-3cd6d244a39c https://experiments.github.com/
  • 10. Reality: ML requires DevOps; lots of it Configuration Data Collection Data Verification Feature Extraction Process Management Tools Analysis Tools Machine Resource Management Serving Infrastructure Monitoring ML Code Source: Sculley et al.: Hidden Technical Debt in Machine Learning Systems
  • 11. Less devops work Let data scientists and ML engineers focus on models & data Source: Monica Rogatti’s Hierarchy of Needs
  • 13. ML platforms ● Uber - Michelangelo ● AirBnB - Bighead ● Facebook - FB Learner ● Lyft - Lyft Learn
  • 14. A curated set of compatible tools and artifacts that lays a foundation for running production ML apps on top of Kubernetes
  • 15. What is Kubernetes ? Greek for “Helmsman”; also the root of the word “Governor” ● Container orchestrator ● Runs containers ● Supports multiple clouds and bare-metal environments ● Inspired and informed by Google’s experiences and internal systems ● Open source, written in Go ● kubernetes.io Manage applications, not machines
  • 16. Kubeflow: A platform for building ML products ● Leverage containers and Kubernetes to solve the challenges of building ML products ○ Reduce the time and effort to get models launched ● Why Kubernetes ○ Kubernetes runs everywhere ○ Enterprises can adopt shared infrastructure and patterns for ML and non ML services ○ Knowledge transfer across the organization ● Kubeflow is open ○ No lock in ○ 120+ Members ○ 20+ Organizations ○ Stats available @ http://devstats.kubeflow.org
  • 17. ML Components ● Goal: components for every stage of ML ● Examples: ○ Experimentation / Data Exploration ■ Jupyter/JupyterHub ○ Training ■ K8s CRDs for distributed training for PyTorch & TFJob ■ Katib - For HP Tuning ○ Workflows: ■ Pipelines ○ Feature Store ■ Feast (from GOJEK) ○ Serving ■ Seldon, TF and NVIDIA RT
  • 19. ● End-to-end ML workflows ● Orchestration ● Service integration ● Components & sharing ● Job tracking, experimentation, monitoring ● Notebook integration KubeFlow Pipelines
  • 20. csv2tfrecord = dsl.ContainerOp( name='csv2tfrecord', image='gcr.io/{}/chameleon/preproc:3bb6ab3'.format(project_id), command=["python3", "/app/csv2tfrecord_transform.py"], arguments=[ "--input_clicks_csv_path", input_clicks_csv_path_regex, "--output_sessions_tfrecords_path", output_sessions_tfrecords_path, "--tfx_artifacts_dir", output_sessions_artifacts_path, "--first_n_hours", first_n_hours, "--runner", "DirectRunner" ], file_outputs={ "tfrecords_path": "/tfrecords_path.txt", "tfx_path": "/tfx_path.txt" } ).apply(gcp.use_gcp_secret('user-gcp-sa'))
  • 21. data_validator = dsl.ContainerOp( name='data-validator', image='gcr.io/{}/chameleon/data-validator:b356ed7'.format(project_id), command=["python", "-m", "data_validator"], arguments=['--input-data-path', input_clicks_csv_path_regex, '--top-n', data_validator_top_n, '--offset', data_validator_hour_offset] ).apply(gcp.use_gcp_secret('user-gcp-sa'))
  • 22. train = dsl.ContainerOp( name='train', image='gcr.io/{}/chameleon/train:4f19dbc'.format(project_id), command=["python", "-m", "nar.nar_trainer_gcom"], arguments=[ "--model_dir", str(model_dir) + "/{{workflow.uid}}", "--input_tfrecords_path", csv2tfrecord.outputs["tfrecords_path"], "--train_files_from", 0, "--train_files_up_to", first_n_hours, "--training_hours_for_each_eval", 5, ], file_outputs={ 'saved_model_path': '/saved_model_path.txt' }, output_artifact_paths={ 'mlpipeline-ui-metadata': '/mlpipeline-ui-metadata.json', 'mlpipeline-metrics': '/mlpipeline-metrics.json' } ).apply(gcp.use_gcp_secret('user-gcp-sa')) .after(csv2tfrecord)
  • 23. model_pusher = dsl.ContainerOp( name='pusher', image='gcr.io/cloud-builders/gsutil', arguments=[ '-m', 'cp', '-r', saved_model_path + '/*', tfserving_path] ).apply(gcp.use_gcp_secret('user-gcp-sa')).after(train) Demo: Run the pipe!
  • 25. Challenges News Recommender Systems 1. Streaming clicks and news articles 2. Most users are anonymous 3. Users’ preferences shift 4. Accelerated relevance decay Percentile of clicks Article age 10% up to 4 hours 25% up to 5 hours 50% (Median) up to 8 hours 75% up to 14 hours 90% up to 26 hours
  • 26. Factors affecting news relevance News Recommender Systems News relevance Topics Entities Publisher News static properties Recency Popularity News dynamic properties News article User TimeLocation Device User current context Long-term interests Short-term interests Global factors Season- ality User interests Breaking events Popular Topics Referrer
  • 27. News session-based recommender overview CHAMELEON User session clicks C1 C2 C3 C4 Next-click prediction (RNN model) Article B Article A Article C Article D ... Ranked articles Candidate (recommendable) articles
  • 28. Article Context Article Content Embeddings Next-Article Recommendation (NAR) Time Location Device User context User interaction past read articles Popularity Recency Article context Users Past Sessions candidate next articles (positive and neg.) active article Active Sessions When a user reads a news article... Predicted Next-Article Embedding Session Representation (SR) Recommendations Ranking (RR) User-Personalized Contextual Article Embedding Contextual Article Representation (CAR) Active user session Module Sub-Module EmbeddingInput Output Data repositoryAttributesLegend: Article Content Embedding 28 Recommendations Ranking (RR) sub-module Eq. 7 - Loss function (HUANG et al., 2013) Eq. 4 - Relevance Score of an item for a user session Eq. 5 - Cosine similarity Eq. 6 - Softmax over Relevance Score (HUANG et al., 2013) Recommended articles What goes inside the box?CHAMELEON
  • 30. TensorFlow Extended TFX is set of libraries that helps you to implement a scalable and high-performance machine learning pipeline that might includes the steps: data preprocessing, modeling, training, serving inference, and managing deployments to online, mobile and JavaScript targets. Main Components: ● TensorFlow Data Validation (TFDV) ● TensorFlow Transform (TFT) ● TensorFlow Model Analysis (TFMA) OBS: Apache Beam is required to build any TFX pipeline.
  • 31. Demo: Session-based Recommender Systems using TFX components in a Kubeflow pipeline TensorFlow Extended
  • 33. TFDV - TensorFlow Data Validation TensorFlow Data Validation (TFDV) is a library for data exploration and validation. TFDV includes: ● Scalable calculation of summary statistics of training and test data. ● Integration with a viewer for data distributions and statistics ● Automated data-schema generation to describe expectations about data like required values, ranges, and vocabularies ● Anomaly detection to identify anomalies, such as missing features, missing values, out-of-range values, wrong feature types, distribution skewness
  • 34. def analyse(input_data_list, top_n, offset=24): logger.info('Infer data schema from first file') stats = tfdv.generate_statistics_from_csv( data_location=input_data_list[0]) inferred_schema = tfdv.infer_schema(statistics=stats) logger.info("Inferred schema n {}".format(inferred_schema)) curr_stats = stats for file_i in range(offset, top_n, 1): logger.info('Checking for anomalies between {} and {}'.format( input_data_list[file_i-offset], input_data_list[file_i])) future_stats = tfdv.generate_statistics_from_csv( data_location=input_data_list[file_i]) for feat_name in ["click_article_id", "session_start", "click_timestamp", "click_region", "click_environment", "click_country", "click_os", "session_size", "session_id", "click_deviceGroup", "user_id", "click_referrer_type"]: feature = tfdv.get_feature(inferred_schema, feat_name) feature.skew_comparator.infinity_norm.threshold = 0.01 feature.drift_comparator.infinity_norm.threshold = 0.01 anomalies = tfdv.validate_statistics(previous_statistics=curr_stats, statistics=future_stats, schema=inferred_schema) n_anomalies = len(anomalies.anomaly_info.items()) if n_anomalies == 0: logger.info('No anomalies found') else: logger.warn('{} anomalies found') for feature_name, anomaly_info in anomalies.anomaly_info.items(): logger.info("Feature {} Anomaly: {}".format( feature_name, anomaly_info.description)) curr_stats = future_stats
  • 36. TFT - TensorFlow Transform A library for preprocessing data with TensorFlow. TensorFlow Transform is useful for data that requires a full- pass transformations, such as: ● Input normalization. ● Convert strings to integers by generating a vocabulary over all input values. Goal: Write transform function only once and use it both on training and serving. OBS: Currently FixedLenSequenceFeature are not supported
  • 37. def feature_spec_schema(): """ Feature specification schema """ schema_dict = {} for feat, feat_type in [('user_id', tf.int64), ('session_id', tf.int64), ('session_start', tf.int64), ('session_size', tf.int64), ]: schema_dict[feat] = tf.FixedLenFeature([], dtype=feat_type) for feat, feat_type in [('click_timestamp', tf.int64), ('click_article_id', tf.int64), ('click_environment', tf.int64), ('click_deviceGroup', tf.int64), ('click_os', tf.int64), ('click_country', tf.int64), ('click_region', tf.int64), ('click_referrer_type', tf.int64)]: schema_dict[feat] = tf.VarLenFeature(dtype=feat_type) schema = dataset_metadata.DatasetMetadata( dataset_schema.from_feature_spec(schema_dict)) return schema import apache_beam as beam import tensorflow_transform as tft from tensorflow_transform.beam import impl from tensorflow_transform.tf_metadata import dataset_schema from tensorflow_transform.tf_metadata import dataset_metadata from tensorflow_transform.coders import example_proto_coder from tensorflow_transform.tf_metadata import metadata_io from tensorflow_transform.beam.tft_beam_io import transform_fn_io
  • 38. dataset_schema = feature_spec_schema() with beam.Pipeline(options=pipeline_options) as pipeline: with impl.Context(args.temp_dir): clicks_hour_files_pc = ( pipeline | "Load Files" >> beam.Create(clicks_hour_files)) sessions_per_hour = ( clicks_hour_files_pc | "Load Sessions Per Hour" >> beam.ParDo(LoadSessionsPerHour())) transformed_data, transform_fn = ((sessions_per_hour, dataset_schema) | "Analyze and Transform" >> impl.AnalyzeAndTransformDataset(preprocess_fn)) transformed_dataset, transformed_metadata = transformed_data timestamped_items = transformed_dataset | 'timestamp' >> beam.ParDo( AddTimestampDoFn()) fixed_windowed_items = ( timestamped_items | 'window' >> beam.WindowInto(beam.window.FixedWindows(60 * 60), # Window size = 1h accumulation_mode=beam.trigger.AccumulationMode.DISCARDING )) _ = (fixed_windowed_items | 'Format' >> beam.ParDo(ExtractTimeWindowStartAsKey()) | "Aggregate by hour_index" >> beam.GroupByKey() | "Dump TFRecord per hour" >> beam.Map( lambda g: DumpTFRecord(g, args.output_sessions_tfrecords_path))) _ = transform_fn | 'Dump Transform Function Graph' >> transform_fn_io.WriteTransformFn( args.tfx_artifacts_dir)
  • 39. def preprocess_fn(input_feature): output_features = {} # FixedLenFeature output_features['user_id'] = input_feature['user_id'] output_features['session_id'] = input_feature['session_id'] output_features['session_start'] = input_feature['session_start'] output_features['session_size'] = input_feature['session_size'] # VarLenFeature output_features['item_clicked'] = input_feature['click_article_id'] output_features['environment'] = input_feature['click_environment'] output_features['deviceGroup'] = input_feature['click_deviceGroup'] output_features['os'] = input_feature['click_os'] output_features['country'] = input_feature['click_country'] output_features['region'] = input_feature['click_region'] output_features['referrer_type'] = input_feature['click_referrer_type'] output_features['event_timestamp'] = input_feature['click_timestamp'] local_weekday = tf.SparseTensor(input_feature['click_timestamp'].indices, tf.map_fn(fn=utc_timestamp_to_local_weekday, elems=input_feature['click_timestamp'].values, back_prop=False, infer_shape=False, dtype=tf.int64), input_feature['click_timestamp'].dense_shape) output_features['local_weekday'] = local_weekday ... local_hour_cos = tf.SparseTensor(input_feature['click_timestamp'].indices, tf.map_fn(fn=utc_timestamp_to_local_hour_cos, elems=input_feature['click_timestamp'].values, back_prop=False, infer_shape=False, dtype=tf.float32), input_feature['click_timestamp'].dense_shape) output_features['local_hour_cos'] = local_hour_cos return output_features
  • 40. transformed_train, transform_fn = ((raw_train, schema) | "Analyze and Transform - train" >> impl.AnalyzeAndTransformDataset(preprocess_fn)) transformed_eval = (((raw_eval, schema), transform_fn) | "Transform - eval" >> impl.TransformDataset()) What about eval set?
  • 42.
  • 44. def build_estimator(model_dir, content_article_embeddings_matrix, articles_metadata, articles_features_config, session_features_config): """Build an estimator appropriate for the given model type.""" run_config = tf.estimator.RunConfig(tf_random_seed=RANDOM_SEED, keep_checkpoint_max=1, save_checkpoints_secs=1200, save_summary_steps=100, log_step_count_steps=100 ) estimator = tf.estimator.Estimator( config=run_config, model_dir=model_dir, model_fn=nar_module_model_fn, params={ 'batch_size': FLAGS.batch_size, 'lr': FLAGS.learning_rate, 'dropout_keep_prob': FLAGS.dropout_keep_prob, 'reg_weight_decay': FLAGS.reg_l2, ... }) return estimator Creating the Estimator
  • 45. def nar_module_model_fn(features, labels, mode, params): model = NARModuleModel(mode, features, labels,… ) hooks = [ItemsStateUpdaterHook(mode, model,… )] if mode == tf.estimator.ModeKeys.TRAIN: return tf.estimator.EstimatorSpec(mode, loss=model.total_loss, train_op=model.train, training_chief_hooks=hooks) elif mode == tf.estimator.ModeKeys.EVAL: eval_metrics = {'mrr_at_n': (model.mrr, model.mrr_update_op), ... } return tf.estimator.EstimatorSpec(mode, loss=model.total_loss, eval_metric_ops=eval_metrics, evaluation_hooks=hooks) elif mode == tf.estimator.ModeKeys.PREDICT: predictions = model.predictions export_outputs = {'predict_output': tf.estimator.export.PredictOutput(predictions)} return tf.estimator.EstimatorSpec(mode, predictions=predictions, export_outputs=export_outputs) Building the model function
  • 46. tft_metadata = TFTransformOutput(FLAGS.tft_artifacts_dir) model = build_estimator(model_output_dir, article_embeddings_matrix, articles_metadata, articles_features_config, ...) model.train(input_fn=lambda: prepare_dataset_iterator(training_files_chunk, tft_metadata, batch_size=FLAGS.batch_size, ...)) model.evaluate(input_fn=lambda: prepare_dataset_iterator(eval_file, tft_metadata, batch_size=FLAGS.batch_size, ...) predictions = model.predict(input_fn=lambda: prepare_dataset_iterator(tfrecords_files, tft_metadata, FLAGS.batch_size, ...) Training, Evaluating and Predicting with the Estimator
  • 47. def prepare_dataset_iterator(files, tft_metadata, batch_size=128, ...) feature_spec = tft_metadata.transformed_feature_spec() # This makes a dataset of raw TFRecords dataset = tf.data.TFRecordDataset(path, compression_type='GZIP') dataset = dataset.map(lambda x: tf.io.parse_single_example(x, feature_spec)) dataset = dataset.padded_batch(batch_size, padded_shapes=features_shapes) # Define an abstract iterator that has the shape and type of our datasets iterator = ds.make_one_shot_iterator() # This is an op that gets the next element from the iterator next_element = iterator.get_next() return next_element Defining input function Features schema come from TFT!
  • 48. def export_saved_model(model, model_output_path, additional_features_info, tft_metadata): raw_feature_spec = feature_spec_schema() def serving_input_fn(): raw_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn( raw_feature_spec, default_batch_size=None) serving_input_receiver = raw_input_fn() # Apply the transform function that was used to generate the materialized data. raw_features = serving_input_receiver.features transformed_features = tft_metadata.transform_raw_features(raw_features) for feature_name in transformed_features.keys(): if type(transformed_features[feature_name]) == tf.sparse.SparseTensor transformed_features[feature_name] = tf.sparse.to_dense( transformed_features[feature_name]) return tf.estimator.export.ServingInputReceiver( receiver_tensors=serving_input_receiver.receiver_tensors, features=transformed_features) servable_model_path = model.export_savedmodel( model_output_path, serving_input_fn, strip_default_attrs=True) return servable_model_path Defining serving function and exporting SavedModel Apply transforms from TFT graph
  • 50. TFMA - Model Analysis TensorFlow Model Analysis allows you to perform model evaluations in the TFX pipeline, and view resultant metrics and plots in a Jupyter notebook. Specifically, it can provide: ● Metrics computed on entire training and holdout dataset, as well as next-day evaluations ● Tracking metrics over time ● Model quality performance on different feature slices ● Supports evaluation on large amounts of data in the distributed manner
  • 51. TFMA - Model Analysis
  • 52. TFMA - Model Analysis
  • 53. TFMA - Model Analysis
  • 54. Demo ● CI/CD ● Serving Seldon (A/B testing) ● Monitoring with Prometheus and Grafana
  • 55. Machine Learning CI/CD - Gitops style Data Scientist
  • 56. Tensorflow Serving Serving and monitoring: Single model Model Repository Model BModel A Model AEngineClients REST / GRPC metrics
  • 57. Tensorflow Serving Serving and monitoring: A/B testing Model Repository Model BModel A Model A Model B A/B TestClients REST / GRPC metrics
  • 58. midi.as/papislatam CHAMELEON research code: http://bit.ly/chameleon_papis P.s. The code demonstrated in this workshop will be published soon on GitHub and will be referenced in the README of the above repo)