【发布时间】:2019-06-23 19:37:17
【问题描述】:
我有 8 个输入和 1 个输出的分类问题。我创建了以下模型:
const hidden = tf.layers.dense({
units: 8,
inputShape: [58, 8, 8],
activation: 'sigmoid'
});
const output = tf.layers.dense({
units: 1,
activation: 'softmax'
});
var model = tf.sequential({
layers: [
hidden,
output
]
});
现在当我预测时
const prediction = model.predict(inputTensor);
prediction.print();
我希望这个预测有 1 个输出值,但我得到了更多,这是如何工作的?
这些是形状
console.log(input.shape) // [1, 58, 8, 8]
console.log(prediction.shape) // [1, 58, 8, 1]
输出如下所示:
[[[[0.8124214],
[0.8544047],
[0.6427221],
[0.5753598],
[0.5 ],
[0.5 ],
[0.5 ],
[0.5 ]],
[[0.7638108],
[0.642349 ],
[0.5315424],
[0.6282103],
[0.5 ],
[0.5 ],
[0.5 ],
[0.5 ]],
... 58 of these
【问题讨论】:
-
可以给我们
inputTensor.shape和prediction.shape吗?
标签: javascript tensorflow machine-learning tensorflow.js