Can a single label be a vector/matrix in a neural network and not a scalar?

My training data consists of individual sentences and each sentence has a few labels (say 10) and each of these labels has a discrete score from 1-10 -- so in essence, a single training example has a label that is not a scalar, but rather a matrix/vector of (10,10) or (1,10*10). Can a softmax adjust the weights in accordance to a label that on its own, is a matrix/vector? I'm looking to fine-tune a model that has this capability.

Thanks.

Topic softmax regression deep-learning neural-network machine-learning

Category Data Science


If I understand your question right the answer is yes. For example in tensorflow functional API could you have as your final layers:

out = tf.keras.ayers.Dense(10*10)(previous_layer)
out = tf.keras.layers.Lambda(lambda t: tf reshape(t, [..., 10, 10]))(out)
out = tf.keras.Lambda(lambda t: tf.nn.softmax(t, axis=-1))


Your output would have shape [batch, 10, 10] and the softmax would be applied on your last dimension

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.