I have data where each row in the batch is a fixed sized vector of mutually exclusive "words". Ex:
batch:
[1, 2, 3]
[4, 5, 6]
[4, 7, 8]
global dictionary:
{
0: {1, 4}
1: {2, 5, 7}
2: {3, 6, 8}
}
In the above example, for cols 0, 1, and 2...we have vocabs of [1, 4], [2, 5, 7], and [3, 6, 8] which are mutually exclusive. I also have a giant dictionary of all vocab words for all the columns. How do I use that dictionary of dict(column_idx) -> {vocab set} to build a one hot encoder in tensorflow?
For the above example I would want an output of:
[1, 0, 1, 0, 0, 1, 0, 0]
[0, 1, 0, 1, 0, 0, 1, 0]
[0, 1, 0, 0, 1, 0, 0, 1]
with the one hot mappings being:
[1, 4, 2, 5, 7, 3, 6, 8]