As the question says, I want to feed labels into a neural net that are three dimensional. Let's say that I have 3 possible labels and each one of my data points corresponds to a percentage of those labels. e.g, my first datapoint contains 20% of label A, 30% of label B, and 50% of label C.

Is there any architecture able to deal with this shape of label data?


1 Answer 1


Since the probability are summing up to zero, so you can simply treat it as Multi-class problem and use a network with Softmax at the end.

Last layer and compile -

model.add(keras.layers.Dense( 3, activation="softmax"))
model.compile( optimizer='adam, loss="categorical_crossentropy", metrics='accuracy')

Metrics - Accuracy is not appropriate. Define a custom metrics based on the interpretation of 3 probabilities

The labels will be as per the probability-
e.g. This is for MNIST 10 digits -

Digit 1 - [0.05, 0.55, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05]

Prediction - [0.064, 0.356, 0.059, 0.069, 0.068, 0.050, 0.044, 0.122, 0.064, 0.101]

Code for MNIST - Colab link

  • $\begingroup$ Do you have a MNIST worked example with this label input that I could run?? $\endgroup$ Commented Jul 20, 2020 at 6:01
  • $\begingroup$ Added in the answer. $\endgroup$
    – 10xAI
    Commented Jul 20, 2020 at 6:44
  • $\begingroup$ Thanks! I can't accept the answer because I have low rep, but well, your solution works! $\endgroup$ Commented Jul 20, 2020 at 7:01
  • $\begingroup$ Reputation is for upvote not Accept. You should see a Green check $\endgroup$
    – 10xAI
    Commented Jul 20, 2020 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.