10 using namespace shark;
12 int 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 layer2(layer1.outputShape(),hidden2);
35 auto network = layer1 >> layer2 >> output;
41 std::cout<<
"training network"<<std::endl;
45 optimizer.
init(error);
46 for(std::size_t i = 0; i != iterations; ++i){
47 optimizer.
step(error);
55 std::cout <<
"classification error,train: " << loss01.
eval(data.
labels(), predictionTrain) << std::endl;
58 std::cout <<
"classification error,test: " << loss01.
eval(test.labels(), prediction) << std::endl;