0
$\begingroup$

I'm working with graph neural networks. I have a large graph. Each node has 4 features [A,B,C,D]:

  • 2 categorical with high cardinality: 86k (A) and 148k (B) different features
  • 2 integer with ranges: [0,4] (C) and [0,59] (D)

After mapping categorical in a set of integers, I encoded a single node concatenating 4 one hot encoded vectors in an embedding tensor T where:

length(T) = 86k+148k+5+59

and sub tensors:

  1. T[0 : 85k] sparse that one hot encodes feature A (single 1 in position n for feature n)
  2. T[86k : (86k+147k)] = T[86k:234k] one hot encoding feature B
  3. T[234k : (234k+5)] = T[234k:234005] one hot encoding feature C
  4. T[234005 : 234064] = one hot encoding feature D

Does this make any sense?

# i.e Node to encode: {A=85324 B=123839 C=5 D=34}
embedding = torch.tensor([A, 86k+B, 86k+147k+C, 86k+147k+5+D])
t = torch.sparse.FloatTensor(embedding.unsqueeze(0), torch.tensor([1,1,1,1]), (234064,))

If yes, can I reduce sparsity with autoencoders? Thanks in advance!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.