3

I just started using CNTK C# API and, so far, I have had no problem loading files if I write them in a way that I can read using full matrix readers, e.g., the MNIST tutorial example:

MinibatchSource minibatchSourceExistModel = MinibatchSource.TextFormatMinibatchSource( Path.Combine(ImageDataFolder, "MNIST_test.ctk"), streamConfigurations);

I am confused with sparse data though. It would help to have a C# reference with examples of all possible forms of input to load using the MinibatchSource.

Do I need to save all the zeroes in the file? Is there an example file showing how to write sparse data and load it to use as MinibatchSource input?

Thanks

douglas125
  • 71
  • 1
  • 4

1 Answers1

1

I create my .CTF with sparse data like below. It is data with 4 different classes and has a sparse features array where all features included are set to 1

|c 0 0 0 1 |f 3:1 11:1 20:1 23:1 25:1 94:1

|c 0 0 1 0 |f 3:1 5:1 16:1 23:1 25:1 189:1 190:1

The CTF file format is more flexible but this works and I can feed it using the C# API as a minibatchsource.

There are good examples in this document (skip the first part) https://learn.microsoft.com/en-us/cognitive-toolkit/brainscript-cntktextformat-reader

IvoTops
  • 3,463
  • 17
  • 18