Measuring performance when working with minibatch sources

When you use a minibatch data source, you need a slightly different setup for the loss and metric. Let's go back and review how you can set up training using a minibatch source and extend it with metrics to validate the model. First, we need to set up a way to feed data to the trainer of the model:

from cntk.io import StreamDef, StreamDefs, MinibatchSource, CTFDeserializer, INFINITELY_REPEATdef create_datasource(filename, limit=INFINITELY_REPEAT):    labels_stream = StreamDef(field='labels', shape=3, is_sparse=False)    features_stream = StreamDef(field='features', shape=4, is_sparse=False) deserializer = CTFDeserializer(filename, StreamDefs(labels=labels_stream, features=features_stream)) ...

Get Deep Learning with Microsoft Cognitive Toolkit Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.