Winter 2018

Introduction to Deep Learning

 

Assignment 4: tf.Estimator & Assorted Programming Puzzles

Deadline: November 11th, 8pm

Same submission options as last time.

High-level Modeling in Tensorflow

You have hopefully seen that working with neural networks becomes more comfortable as you move from low- to higher-level interfaces. However, if you have been following the tutorials so far, you have been defining things such as training loops, evaluation procedures etc. yourself. This is rather annoying – compare this to libraries such as scikit-learn where such things can usually be done in a single line of code.

Luckily, Tensorflow also comes with similar high-level interfaces. In this assignment, we will be having a look at Tensorflow’s own Estimator class. Unfortunately, you will need to do quite a bit of extra reading again to get an overview. You can have a look at some or all of the following docs:

Note that the above tutorials mention “feature columns” quite a lot; feel free to ignore these beyond what is needed to follow along since we won’t be needing them anytime soon (they are not needed for “custom” estimators and are most interesting for categorial input data).

Build a functioning CNN using the Estimator interface, supporting all of training, evaluation and prediction on new inputs. You should have a grasp on these core components of building models with tf.Estimator:

Once again, if you haven’t done so, use the Fashion-MNIST dataset instead for more of a challenge (or feel free to train models on other datasets). With the more convenient Estimator interface, experimenting with different models/ hyperparameters is hopefully more comfortable. Try to achieve the best results you can!

Some Estimator fun facts:

Exploring Tensorflow

Following all those tutorials can be boring, so we will now be focusing on getting to know the Tensorflow core a little more. In the long run, knowing what tools you have available will allow you to write better/shorter/faster programs when you go beyond the straightforward models we’ve been looking at. Below you will find several (mostly disconnected) small programming tasks to be solved using Tensorflow functions. Most of these can be solved in just a few lines of code, but you will need to find the right tools first. The API docs will be indispensable here. Note: Below we are sometimes linking to the 1.10 API because for some reason the “API Guides” grouping functions by their usage etc. have been removed in the most recent API versions. If this leads to any issues, you might want to look at the most recent API version of the function you are interested in after you found it using the API Guides in the old version. Since the API can be a bit overwhelming at first, hints are included for each task.