Applied ML with Keras

Train and deploy your own basic text classification model using this project guide.

9 activities
Applied ML with Keras
1

Overview: Applied ML with Keras

Text classification algorithms are at the heart of a variety of software systems that process text data at scale. Email software uses text classification to determine whether incoming mail is sent to the inbox or filtered into the spam folder. Discussion forums use text classification to determine whether comments should be flagged as inappropriate.

This pathway shows you how to train and deploy your own basic text classification model for use in your apps. It features a video with developer comments, steps that guide you through the process, definitions of commonly used terms, and links to sample code.

2

Applied ML with KerasCV and KerasNLP

Video

Watch this video to learn about KerasCV and KerasNLP, easy-to-use libraries for state-of-the-art computer vision and natural language processing. With just a few lines of code, you can employ the latest techniques and models for data augmentation, object detection, image and text generation, and text classification.

The video also demonstrates integration with the broader TensorFlow ecosystem including TFLite, TPUs, and DTensor.

3

Problem framing

Article

Problem framing is the first and crucial step to the success of an ML model. It defines the success criteria of a good model and determines whether or not machine learning is the right solution for the problem. Check out this helpful guide on machine learning for further reading.

Explore problem framing in the article linked in this step to reduce unnecessary cycles in the applied ML journey. Frame your problem to understand how to define success metrics for your project, and how to turn your problem into a machine learning problem.

We recommend framing your problem as classification to start to help you create a benchmark that a future, more complex model has to beat.

4

Dataset search

Article

Datasets are collections of raw data, commonly (but not exclusively) organized in either a spreadsheet or a comma-separated values (CSV) file. Read the article linked in this step to learn more about datasets.

Now you'll need to ingest data. You can use your own dataset or try to find a similar one for your problem using tools such as Google Dataset Search and Kaggle Datasets .

5

Data analysis

Code sample

Data analysis refers to obtaining an understanding of data by considering samples, measurement, and visualization. Data analysis can be particularly useful when a dataset is first received, before one builds the first model. It is also crucial in understanding experiments and debugging problems with the system. Check out the sample code linked in this step to learn more.

Learn more about data preparation in the newly updated Machine Learning Crash Course .

6

Feature engineering

Code sample

Feature engineering involves determining which features might be useful in training a model, and converting raw data from the dataset into efficient versions of those features. For example, you might determine that temperature might be a useful feature. Then, you might experiment with bucketing to optimize what the model can learn from different temperature ranges.

See how you can use TensorFlow Transform to help you with feature engineering.

You are ready to create your first baseline model, which more complex models need to beat. See the sample code linked in this step for a walkthrough of how to build a simple text classification model using a Keras framework.

7

Modeling

Article

Modeling is, in general, any mathematical construct that processes input data and returns output. Phrased differently, a model is the set of parameters and structure needed for a system to make predictions. In supervised machine learning, a model takes an example as input and infers a prediction as output, though models differ somewhat. Unsupervised machine learning also generates models, typically a function that can map an input example to the most appropriate cluster.

If you haven't met your expected model performance from the problem framing step, try using a more powerful pretrained model from TensorFlow Hub.

8

Model evaluation

Article

Model evaluation is the assessment of the quality or performance of your models. Some commonly-used metrics when evaluating model quality are loss, accuracy, precision and recall, and the area under the ROC curve (AUC).

The model evaluation step is for investigating and visualizing the performance of a model with respect to characteristics of the dataset. TensorFlow Model Analysis is a good tool to help you do this.

9

Deployment

Code sample

Deployment in ML refers to integrating your model into an existing production environment, where it can take in input and return output.

When you're ready, you can serve your model using TensorFlow Serving . The Pusher component is used to push a validated model to a deployment target during model training or retraining, as shown in the sample code linked in this step.