Mapping
Transform each individual observation in a dataset through mapping.
We'll cover the following...
We'll cover the following...
Chapter Goals:
- Learn how to map a function onto each observation of a dataset
- Implement a function that creates a dataset of serialized protocol buffers and parses each observation
A. Mapping function
After initially creating a dataset from NumPy arrays or files, we oftentimes want to apply changes to make the dataset observations more useful. For example, we might create a dataset from heights measured in inches, but we want to train a model on the heights in centimeters. We can convert each observation to the desired format by using the map function.
In the example above, d1 is a dataset containing the height values from data, measured in inches. We ...