【发布时间】:2017-01-08 02:47:11
【问题描述】:
我想用 TensorFlow 开发一个多标签分类器,我试图表示存在多个包含多个类的标签。为了说明你可以想象这样的情况:
- label-1 类:lighting raining、raining、partial raining、no raining
- label-2 类别:晴天、部分多云、多云、非常多云。
我想用神经网络对这两个标签进行分类。现在,我为每个 (label-1, label-2) 对类使用不同的类标签。这意味着我有 4 x 4 = 16 个不同的标签。
通过使用
训练我的模型电流损耗
cross_entropy = tf.reduce_mean(-tf.reduce_sum(ys * tf.log(prediction), reduction_indices=[1]))
# prediction is sofmaxed
loss = cross_entropy + regul * schema['regul_ratio'] # regul things is for regularization
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)
但是我认为在这种情况下多标签训练会更好。
- 我的特征将是 [n_samples, n_features]
- 我的标签将是 [n_samples, n_classes, 2]
n_samples of [x1, x2, x3, x4 ...] # 个特征
n_samples of [[0, 0, 0, 1], [0, 0, 1, 0]] # 没有下雨和多云
如何使用 tensorflow 制作 softmax 概率分布预测器。有没有像这样的多标签问题的工作示例。我的损失张量如何?
【问题讨论】:
标签: python machine-learning tensorflow classification multilabel-classification