4 Classification and regression

 

This chapter covers

  • Your first examples of real-world machine learning workflows
  • Handling binary and categorical classification problems
  • Handling continuous regression problems

This chapter is designed to get you started with using neural networks to solve real problems. You’ll consolidate the knowledge you gained from chapters 2 and 3, and you’ll apply what you’ve learned to three new tasks covering the three most common use cases of neural networks – binary classification, categorical classification, and scalar regression:

  • Classifying movie reviews as positive or negative (binary classification)
  • Classifying news wires by topic (categorical classification)
  • Estimating the price of a house, given real-estate data (scalar regression)

These examples will be your first contact with end-to-end machine learning workflows: you’ll get introduced to data preprocessing, basic model architecture principles, and model evaluation.

By the end of this chapter, you’ll be able to use neural networks to handle simple classification and regression tasks over vector data. You’ll then be ready to start building a more principled, theory-driven understanding of machine learning in Chapter 5.

4.1 Classifying movie reviews: a binary classification example

4.1.1 The IMDb dataset

4.1.2 Preparing the data

4.1.3 Building your model

4.2 Validating your approach

4.3 Using a trained model to generate predictions on new data

4.4 Further experiments

4.5 Wrapping up

4.6 Classifying newswires: a multiclass classification example

4.6.1 The Reuters dataset

4.6.2 Preparing the data

4.6.3 Building your model

4.6.4 Validating your approach

4.6.5 Generating predictions on new data

4.6.6 A different way to handle the labels and the loss

4.6.7 The importance of having sufficiently large intermediate layers

4.6.8 Further experiments

4.6.9 Wrapping up

4.7 Predicting house prices: a regression example