How do I use NetChain
to obtain a fit that is at least accurate on the training data?
I am trying to get a hopefully predictive fit for some data (see my question Fitting smooth monotonic function (low number of points, irregular grid)). But in the process I found I was already getting stumped on something much more elementary. I couldn't even managed to get a (possibly over-fitted) fit that actually goes close to the points in the training data.
What do I need to do adjust to obtain a fit that is at least accurate on the training data? (Should I add more layers, change the training termination criteria...?)
data={{3.38, 1.028877662, 2.009398505, 2.067322478, 4.214191194}, {3.4,
1.030082372, 1.995543604, 2.105894366, 4.234656059}, {3.5,
1.035994874, 1.992385102, 2.200815333, 4.282937808}, {3.57,
1.036731784, 1.986961442, 2.224357922, 4.307824219}, {3.6,
1.036978228, 1.985081926, 2.231988058, 4.315914728}, {3.62,
1.037229736, 1.983076125, 2.239730469, 4.323988127}, {3.78,
1.038461995, 1.969909372, 2.283628754, 4.374960036}, {3.8,
1.038741973, 1.96716995, 2.291334094, 4.384253554}}
Example try (I tried different things with more or less layers or different activation functions too):
net = NetChain[{30, Tanh, 30, Tanh, 30, Tanh, 30, Tanh, 30, 1}, "Input" -> "Scalar",
"Output" -> "Scalar"]
trainingSet = (#1 -> #3 & @@@ data);
NetInitialize[net];
net = NetTrain[net, trainingSet];
Example fit:
I would like to have a fit that deviates from the data in the training set at most by say 10^-15. (The data is exact up to 30 digits and so I would like a fit to reproduce it to high accuracy.)
P.S. The data as posted here is obviously only accurate to at most 9 digits but that is just the truncation I used here to keep the post readable. I don't think the error introduced by this rounding will pose any problem to finding a fit but if for some method it does I can provide the high precision data.