我正在尝试使用tf.layers.dense接口在tensorflow中构建神经网络。我想知道如何使tensorflow将所有特征视为一组特征。
例如:
将一组人分类为好的/坏的篮球队(0-坏,1-好)。每个人都有自己的特征(性别、年龄、身高、体重、打篮球的年数)。要将整个团队分类为好或坏,神经网络需要看到5个人的特征,并输出0或1。
现在,在这个例子中,如何使网络看到与不同人相关联的所有不同特征并输出单个分类数字?
我认为这与输入张量的形状有关,我尝试制作形状为[batch_size,number_of_players,number_of_features]的张量,它看起来像这样:
[
[[gender, age, height, weight, years_playing_basketball],
[gender, age, height, weight, years_playing_basketball],
[gender, age, height, weight, years_playing_basketball], //team1
[gender, age, height, weight, years_playing_basketball],
[gender, age, height, weight, years_playing_basketball]],
[[gender, age, height, weight, years_playing_basketball],
[gender, age, height, weight, years_playing_basketball],
[gender, age, height, weight, years_playing_basketball], //team2
[gender, age, height, weight, years_playing_basketball],
[gender, age, height, weight, years_playing_basketball]]
]
自然地,如果将这个张量通过几个tf.layers.dense层,输出也将是一个三维张量,而我只需要一个单独的数字作为输出。另一方面,如果我将所有团队特征放入一个数组中,我相信网络不会知道这些实际上是5个不同人的特征。感谢您的帮助!