I saw an article How to build a simple neural network in 9 lines of Python code and want to reconstruct the result in Mathematica. I tried the below codes:-
input = {{0, 0, 1}, {1, 1, 1}, {1, 0, 1}, {0, 1, 1}}; output = {0, 1, 1, 0}; asso = Thread[input -> output]; trained = NetTrain[LinearLayer[], asso] trained[{1, 0, 0}] The output is 0.577605, which is far away from the result of the Python code (e.g. 0.999937). How can I modify the code to have a more similar approach/result?
In the Python article, they are using sigmoid function as the layer. I want to do it in a similar way and to replace LinearLayer[] (replacement of ElementwiseLayer[Sigmoid] doesn't work), but I'm not sure how to do.
How can I get it done? Many thanks!
The question:-
