First Steps with TensorFlow: Programming Exercises

As you progress through Machine Learning Crash Course, you'll put the principles and techniques you learn into practice by coding models using tf.estimator, a high-level TensorFlow API.

The programming exercises in Machine Learning Crash Course use a data-analysis platform that combines code, output, and descriptive text into one collaborative document.

Programming exercises run directly in your browser (no setup required!) using the Colaboratory platform. Colaboratory is supported on most major browsers, and is most thoroughly tested on desktop versions of Chrome and Firefox. If you'd prefer to download and run the exercises offline, see these instructions for setting up a local environment.

Run the following three exercises in the provided order:

  1. Quick Introduction to pandas: pandas is an important library for data analysis and modeling, and is widely used in TensorFlow coding. This tutorial provides all the pandas information you need for this course. If you already know pandas, you can skip this exercise.
  2. First Steps with TensorFlow: This exercise explores linear regression.
  3. Synthetic Features and Outliers: This exercise explores synthetic features and the effect of input outliers.

    Common hyperparameters in Machine Learning Crash Course exercises

    Many of the coding exercises contain the following hyperparameters:

    • steps, which is the total number of training iterations. One step calculates the loss from one batch and uses that value to modify the model's weights once.
    • batch size, which is the number of examples (chosen at random) for a single step. For example, the batch size for SGD is 1.

    The following formula applies:

    \[ total\,number\,of\,trained\,examples = batch\,size * steps \]

    A convenience variable in Machine Learning Crash Course exercises

    The following convenience variable appears in several exercises:

    • periods, which controls the granularity of reporting. For example, if periods is set to 7 and steps is set to 70, then the exercise will output the loss value every 10 steps (or 7 times). Unlike hyperparameters, we don't expect you to modify the value of periods. Note that modifying periods does not alter what your model learns.

    The following formula applies:

    \[ number\,of\,training\,examples\,in\,each\,period = \frac{batch\,size * steps} {periods} \]

     

Send feedback about...

Machine Learning Crash Course