I'm trying to make a simple neural network to be able to find the y valeu given x1, x2 and x3. So first I made the training data:
trainingdata = Dataset[{<|"x1" -> 0, "x2" -> 0, "x3" -> 1, "y" -> 0 |>, <| "x1" -> 0, "x2" -> 1, "x3" -> 1, "y" -> 1|>, <|"x1" -> 1, "x2" -> 0, "x3" -> 1, "y" -> 1 |>, <|"x1" -> 1, "x2" -> 1, "x3" -> 1, "y" -> 0 |>}] Then I designed the net with 2 layers and 3 nodes in each one.
net = NetGraph[{CatenateLayer[], LinearLayer[1], LinearLayer[1], LinearLayer[1], CatenateLayer[], CatenateLayer[], CatenateLayer[], LinearLayer[1], LinearLayer[1], LinearLayer[1], CatenateLayer[], LinearLayer[]}, {{NetPort["x1"], NetPort["x2"], NetPort["x3"]} -> 1 -> {2, 3, 4} -> {5, 6, 7}, {5 -> 8}, {6 -> 9}, {7 -> 10}, {8, 9, 10} -> 11 -> 12 -> NetPort["y"]}, "x1" -> "Scalar", "x2" -> "Scalar", "x3" -> "Scalar", "y" -> "Scalar"] Then using NetTrain I trained the net:
trained = NetTrain[net, trainingdata, MaxTrainingRounds -> 1500] But even with more training rounds I still getting a pretty bad result, even with the cases that were in the training data, so I have the felling that I'm making something wrong here.
Obs: I know that using Classify I would get this correctly with easy, but I'm trying to learn how to use this part of neural nets in mathematica.
