0
$\begingroup$

How should I design my input layer for the following classification problem?

Input: 5 cards in a card game; vocabulary is 52 cards

Output: some classification using a neural network

How should I model the input layer?

Option A: 5 one hot encodings for the 5 cards, i.e. 5 one_hot vectors of length 52 = 260 input vector E.g.

[
[0,0,0,0,0,0,1,...],
[1,0,0,0,0,0,0,...],
[0,0,0,0,0,1,0,...],
[0,0,1,0,0,0,0,...],
[0,0,0,0,1,0,0,...]
]

Option B: 5 hot encoding encompassing all 5 cards in one 52 element vector

[1,0,1,0,1,1,1,...]

What are the disadvantages between A and B?

$\endgroup$
0
$\begingroup$

Option (A) - This would be the naive way to put it in network that operates on series. like RNN. (example of where you would need it - texas holdem)

Option (B) - This would be the way to put entire configuration at once, where you are dealt the entire hand in one shot. this would be the naive way to put it in a MLP (example - sorry, dont know many card games. Any card game where you are dealt entire hand at once)

my suggestion - Neither.

since there are relations among the cards dependent upon the design of the game use distributed representation and learn them along with network

$\endgroup$
  • $\begingroup$ Thanks for your insight. Just to confirm - you're saying it is OK to use n_hot inputs for MLPs right? I've only ever seen one_hot representations and I was wondering if n_hot is ok too or if it hinders learning in some way. $\endgroup$ – deekay42 Jun 28 '18 at 18:11
  • $\begingroup$ Yes it is. The reason you have seen only one-hot representations is because of NLP where it is used in time series data like natural language. But in this one hot representation make a tweak - instead of 0s in the places where the cards are not there, use some other number and be consistent with it. it would be hard to train this neural network. I would again recommend distributed representation $\endgroup$ – MiloMinderbinder Jun 28 '18 at 18:18
  • $\begingroup$ Why use some other number and not 0? $\endgroup$ – deekay42 Jun 28 '18 at 18:27
  • $\begingroup$ 0*anynumber = 0. for other numbers the network can learn some interactions $\endgroup$ – MiloMinderbinder Jun 28 '18 at 18:28
  • $\begingroup$ I was actually considering using an embedding layer as a distributed representation as you suggested. However, same question applies as above: How do I structure the input layer? Do I feed five separate one_hot encodings (for my five cards) into my embedding layer or one 5_hot encoding? I am clear how to encode one card (one_hot -> embedding layer->network) but how do I feed in 5 cards? $\endgroup$ – deekay42 Jun 28 '18 at 18:35

Your Answer

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

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