Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果您只想预测一个类。然后首先你需要以这样一种方式标记你的向量,可能将所有这些向量标记为“一个”,它具有基本事实 5 和“零”到那些基本事实不是 5 的向量。我如何使用 puthon 在 tensorflow 中实现这一点
在准备数据时,您可以使用 numpy 将第 5 类中的所有数据点设置为 1,而其他数据点将使用 .
arr = np.where(arr!=5,arr,0)
arr = np.where(arr=5,arr,1)
然后您可以使用 Tensorflow 创建一个二元分类器来对它们进行分类,同时使用binary_crossentropy损失来优化分类器
binary_crossentropy