Ok, I have achieved to create a small sample in Torch3. Cause of the bad documentation, I have just tried to build a multi layer perceptron for a xor-problem. As we should know, this problem can only be solved with at least one hidden layer and not by a simle perceptron.
Ok, the first problem was: how can I build a sample file. As I have seen in a tutorial, there exists a function to load simple ASCII-files. But there was no description on how to build them. But that’s really simple:
In the first line, there has to be to integers: the first specifies the number of examples, the second number specifies the number of datapoints in each example. Each sample exists of the input data and the output data. Each one is seperated by blank. The xor-problem can be seen in this sample-file. This file can be simple loaded:
MatDataSet *data = new(allocator) MatDataSet("XOR-ProblemData.txt", 2, 1);
The first parameter specifies the sample file. The second specifies the number of input data and the last number specifies the number of the output data. So in the xor-problem we have to inputs and one output.
And now, the complete source of our program. I think, it needn’t to be explained. If you have read the tutorial, it’s just easy to unterstand, what is done.
I hope, this short sample helps others who want to start with Torch3.