As a "toy problem" to explore the new neural net library, I wanted to train a neural net with:
Input: 1 real number in the range [0, 1)
Output: the nth digit (i.e. one of {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}).
Example:
0.548923584 -> 8
0.678438456 -> 8
0.894258973 -> 4
The following simple NetChain
does better than average at classifying the 2nd digit:
digit = 2;
target[x_] := Part[First[RealDigits[x, 10, 6, -1]], digit]
net =
NetChain[{100, Ramp, 100, Ramp, 100, Ramp, 100, Ramp, 100, Ramp,
100, Ramp, 10, SoftmaxLayer[]}, "Input" -> {1},
"Output" -> NetDecoder[{"Class", Range[0, 9]}]];
trainingData =
Table[{x} -> target[x], {x, RandomReal[1, 10^5]}];
trained = NetTrain[net, trainingData];
N[
Mean[Boole[
Table[target[x] == trained[{x}], {x, RandomReal[1, 1000]}]]]]
(* 0.55 *)
Very simple variants on the above can be trained to be 90% accurate. But I couldn't get something similar to classify the 3rd digit well.
What's a net design that can do well at classifying the 3rd digit of numbers?
More generally, what are the net design considerations that one should take into account to solve this type of problem?