[英]Tensorflow: trying to get toy neural network to 'learn'
尝试获取非常简单的(“玩具”)2层神经网络来构建模型,作为确保数学正确流动的学习示例。
该模型应了解到,第一个和最后一个特征上的“ 1”等于“ 1”输出。
features = []
features.append([[0, 0, 0, 0, 0], [0]])
features.append([[0, 0, 0, 0, 1], [0]])
features.append([[0, 0, 0, 1, 1], [0]])
features.append([[0, 0, 1, 1, 1], [0]])
features.append([[0, 1, 1, 1, 1], [0]])
features.append([[1, 1, 1, 1, 0], [0]])
features.append([[1, 1, 1, 0, 0], [0]])
features.append([[1, 1, 0, 0, 0], [0]])
features.append([[1, 0, 0, 0, 0], [0]])
features.append([[1, 0, 0, 1, 0], [0]])
features.append([[1, 0, 1, 1, 0], [0]])
features.append([[1, 1, 0, 1, 0], [0]])
features.append([[0, 1, 0, 1, 1], [0]])
features.append([[0, 0, 1, 0, 1], [0]])
# output of [1] of positions [0,4]==1
features.append([[1, 0, 0, 0, 1], [1]])
features.append([[1, 1, 0, 0, 1], [1]])
features.append([[1, 1, 1, 0, 1], [1]])
features.append([[1, 1, 1, 1, 1], [1]])
features.append([[1, 0, 0, 1, 1], [1]])
features.append([[1, 0, 1, 1, 1], [1]])
features.append([[1, 1, 0, 1, 1], [1]])
features.append([[1, 0, 1, 0, 1], [1]])
但是我无法显示任何错误/费用...
Epoch 3 completed out of 10 cost: 0.0
Epoch 5 completed out of 10 cost: 0.0
Epoch 7 completed out of 10 cost: 0.0
Epoch 9 completed out of 10 cost: 0.0
Accuracy: 1.0
在此先感谢您快速浏览: 这是笔记本电脑 ...
问题出在输出,它必须是2类数组。 不知道为什么一定要这样。
features.append([[0, 0, 0, 0, 0], [0,1]])
features.append([[0, 0, 0, 0, 1], [0,1]])
features.append([[0, 0, 0, 1, 1], [0,1]])
features.append([[0, 0, 1, 1, 1], [0,1]])
features.append([[0, 1, 1, 1, 1], [0,1]])
工作的笔记本在这里 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.