Can I constrain my TensorFlow 2.x predictions to sum to 1 along the rows and columns of the prediction matrix?

Viewed 25

I am attempting to predict a matrix target in TensorFlow. Each row is a student, and each column is the probability of a student finishing the semester in that rank. So every row has a single 1, and 0s elsewhere, since a student can only finish in one rank, and each column has a single 1, and 0s elsewhere, since a single rank can only be held by 1 student, no ties.

I would like to predict the probabilities of each student finishing in each rank, such that each row sums to one, since a student must have a final rank, and each column sums to one, since each rank must have a student in it.

Is this possible with TensorFlow 2.x?

0 Answers
Related