This is a sample of a time series regression problem I was working on. There are four input (aka feature) predictors values followed by a single value to predict. The CTF format is very convenient when you want to train a neural network because there’s built-in support to read and access.

But after training I wanted to walk through the input data, one at a time. Surprisingly, there’s no easy way to do this. So one work-around solution is to use the numpy loadtxt() function.

The code is a bit trickier than it appears. Notice that when reading the passengers field, I had to use ndmin (minimum dimension) to get a matrix as wanted by CNTK, and the usecols (which columns to use) parameter needs an enumerable list when you read only one column.

Once I have the input data, I can feed it to the trained neural network and call the eval() function to get the output. In my demo I simulate the prediction/output.

The moral of the story is that CNTK is a complex library and a strong knowledge of Python is at least useful and perhaps necessary in some scenarios.