# TensorFlow Extended (TFX) & Hub (TensorFlow @ O’Reilly AI Conference, San Francisco '18)

Show Video

Tensorflow. Transform, allows you to express your. Data. Transformation, as a tensor. Flow graph and actually. Apply these transformations, at training in the serving time, now. Again this may sound trivial, because you can already express your transform, your. Transformations, with a tensor flow graph however. If your. Transformations, require an analyze phase over your data, it's. Less trivial and the. Easiest example for this is min normalization, so if you want to mean normalize a feature you have, to compute the mean and the standard deviation over, your, data and then you need to subtract the mean and divide by standard deviation right. If. You work. On the laptop with, a dataset that's, a few gigabytes you can do that with numpy and everything, is great however. If. You have terabytes of data and you actually want to replicate these transformations, in serving time it's less trivial so. Transform, provides, you with utility. Functions, that. And. For minimization there's one that's called scale to Z score. There. Is a one liner so you can say I want to scale this feature, such. That it's mean has it, has a mean of 0 and a standard deviation of 1 and then. Transform, actually creates a beam graph for you that computes. These metrics over your data and then. Beam handles, computing, those metrics over your entire data set and, then. Transform, injects the results of this, analysis phase as a constant, in your tensor flow graph and creates. A tensor flow graph to toast the computation, needed in the. Benefit of this is that this tensor, flow graph that, expresses, this transformation, can, now be carried forward to training so, training time you, applied those transformations to your training data and the. Exact same graph is also applied to the inference, graph such. That at inference time the, exact same transformations. Are being done now. That basically eliminates, training serving skew because. Now you can be entirely sure that the exact same transformations, is being applied it, eliminates, the need for you to have code in your serving system that, tries to replicate this transformation, because, usually the. Code paths that you use in your training pipelines, are different from the ones that you use in your serving system, because that's. Very, low latency.

The Estimate API with, 2.0, now has, a method called exports, if models and that. Actually, exports, a tentacle graph as a safe model such that it can be used by a tenth of the model analysis, in tentacle serving. This. Is just a code snippet from one of our examples of how, this looks like for, an actual example in this case it's, the Chicago taxi data set we. Just instantiate. It in and linear combined, the fire call trained and exported. Produced. By downstream components. Using. T of cameras it looks very similar in. This case we use the cameras sequential API where. You can configure. The layers of your network and the. Cares API is also getting a method called save Cara's model that, exports, the same format which is the saved model such that it can be used again by downstream. Components. Model. Evaluation validation. Is open, sourced as tensorflow model analysis. And. That. Takes that graph as an input so the crafted which is exported, from our estimator, or Kerris, model, flows. As an input into TF ma and Tifa. May compute evaluation, statistics, at scale, in. A, sliced manner so now this. Is another one of those examples where you may say well i already get my my. Metrics, from 10 support 10. Support metrics are computed in a streaming manner during training on mini-batches, TF. Ma uses, pin pipelines to compute. Metrics. In an exact manner over a large with, a 1 once, pass over, all of your data so, if you want to compute your metrics over a terabyte of data with. An exactly one pass you, can use TF MA now. In this case you run TF, may for that model and some some. Data set and if. You just call this method called render slicing metrics with. The result by itself the. Visualization, looks like this and I. Pulled this up for one reason and that reason is just to highlight. What. We mean by sliced metrics, this. Is the metric that you may, be used to when someone trains a model and tells you well my model has a 0.9. For accuracy, or. A 0.92. A you see that's. An overall. Metric over. All of your data it's, the aggregate, of. Those. Metrics for, your entire model that. May tell you that the model is doing well on average but, it will not tell you if the model is doing how the model is doing on specific, slices of your data. So. If you instead, render. Those slices for a specific, feature. In this case we actually, slice. These metrics by strip. Start our. So again this is from the taxi. Chicago. Taxicab data set. You. Actually get a visualization in which, you can now in, this case we should look at a histogram and. Tell your symmetric we, filter for pockets that only have 100 examples so that we don't get low buckets and then. You can actually see here how. The model, performs, on different, slices, of future values for a specific. Trip. Start our. So. This particular model is trained to, predict whether a tip is more or less than 20% and, you've, seen overall it has a very high accuracy. And very high AUC, but. It turns out that on some of these slices it actually performs, poorly so. If the trip start hour is 7 for, some reason the, model doesn't, really have a lot of predictive, power whether the tip is going to be good or bad now, that's informative to know because maybe that's.

And. I. Just. Want to reiterate this point if you, share a machine learning model what. You're really sharing is a combination, of all of these if. I spend fifty thousand GPU hours to, train an embedding and share. It with tensorflow hub, everyone. Who uses that embedding, can benefit from that compute power they. Don't have to go recompute. Recompute. That same model and and those same data right. So. All of these four ingredients come, together in, what, we call a module and what, you listed the unit that. We care about that, can be published in tensorflow hub and it. Can now be reused, by, different people in different models and. Those. Modules can our, tensor, flow graphs and they can also contain, weights, so. What it means is that they give, you a reusable, piece of tensor, flow graph that, has the trained. Knowledge of of the data and the algorithm, embedded. In it and. Those, modules are designed to be composable, so. They, have common. Signatures. Such that they can be attached to different models. They. Are reusable so, they come with the graph and the weights and. Importantly. They're also retain, able so, you can actually back propagate, through these modules and once. You attach them to your model you can customize. Them to your own data, and to your own use case. So. Let's go through a quick example for, text classification. Let's. Say I'm, a start-up and I want to build a new model that, takes. Restaurant. Reviews. And tries, to predict whether they are positive or negative so. In this case we have a sentence and if you've ever tried to train some of these text models you know that you need a lot of data to actually learn a good representation of text so. In, this case we, just want to put, in a sentence. And we want to see if it's positive or negative and. We. Want to reuse the code in the graph we. Want to reuse a train weight from, someone, else who's done the work before us and we. Also don't want, to do this with fewer data than is usually, needed. An.

2018-12-22 10:57

Show Video