I'm trying to reproduce the result giving by a Predict function with a Neural Network as the chosen method.
So, I'm training from this set:
trainingset = {1 -> 2, 2 -> 3, 3 -> 6, 4 -> 8};
and train a simple NN with just one HL with 1 linear neuron:
p = Predict[trainingset, Method -> {"NeuralNetwork", "HiddenLayers" -> {{1, "Linear"}}}]
By using Options I can have access to the resulting weights from:
Normal[Options[p][[1]]][[7]]
"Models" -> {<|"Method" -> "NeuralNetwork", "NeuralNetwork" ->
<|"NeuronTypes" -> {"Linear", "Linear"}, "CostFunction" -> "SquaredCost",
"NumberOfNodes" -> {1, 1, 1}, "L1Regularization" -> 0, "L2Regularization" -> 0.1,
"DropOut" -> False, "Weights" -> {{{-0.9752752696739045}},
{{-0.9752752696739043}}}, "Biases" -> {{-5.738324013344273*^-17},
{-1.5516692498423558*^-17}}, "TrainingCostHistory" ->
{1.8283207510222368, 0.4788249850114622, 0.04910194009988826,
0.042738345120368906, 0.041599875787272395, 0.0410427527972165,
0.03861566085385098, 0.03761310711018569, 0.03599253089639499,
0.035775402536093924, 0.03573690274038513, 0.03573478075597261,
0.035734174870756356, 0.03573417449687247, 0.035734174496067674,
0.035734174496065876, 0.03573417449606588, 0.03573417449606589,
0.03573417449606589, 0.03573417449606589, 0.03573417449606589,
0.03573417449606589}, "TestCostHistory" -> {}|>, "EarlyStopping" -> False,
"MaxIterations" -> 2250, "FeatureIndices" -> All, "DistributionData" ->
{NormalDistribution, 0.1785506703441404}, "FeaturePreprocessor" ->
MachineLearning`PackageScope`Preprocessor["Standardize", {{2.5}, {Sqrt[5/3]}}],
"ExtractedFeatureNumber" -> 1|>}
They are both -0.9752. The predict function p gives me as a result:
p[2]=3.73555
and now I'm trying to obtain this same result by calculation it by hand. So, since it is a linear NN, and because the biases are nearly zero, we should have.
output = (x * w1) * w2 = (2 * -0.9752) * -0.9752 = 1.90203
So, what am I doing wrong?