12int main(
int argc,
char **argv)
15 std::cerr <<
"usage: " << argv[0] <<
" path/to/mnist_subset.libsvm" << std::endl;
18 std::size_t hidden1 = 200;
19 std::size_t hidden2 = 100;
20 std::size_t iterations = 1000;
33 DenseLayer layer1(inputDim,hidden1,
true);
34 DenseLayer layer2(hidden1,hidden2,
true);
36 auto network = layer1 >> layer2 >> output;
42 std::cout<<
"training network"<<std::endl;
46 optimizer.
init(error);
47 for(std::size_t i = 0; i != iterations; ++i){
48 optimizer.
step(error);
56 std::cout <<
"classification error,train: " << loss01.
eval(data.
labels(), predictionTrain) << std::endl;
59 std::cout <<
"classification error,test: " << loss01.
eval(test.labels(), prediction) << std::endl;