Answers.Body: <p>Depends on how your game is played. Is there any meaning assigned to the order of cards, or are all 5 played simultaneously? If order matters, use 5 one-hot vectors so you can choose how to order them, otherwise use a single 5-hot input vector. I would also add that if <strong>temporal</strong> order matters, you could also use a <strong>recurrent</strong> net with a 52-element input and feed the five one-hot vectors one after another.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-29T03:21:54.190Z
Answers.LastActivityDate: 2018-06-29T03:21:54.190Z
Answers.UserDisplayName: cantordust
Body: <p>How should I design my input layer for the following classification problem?</p>
  <blockquote>
  <p><strong>Input</strong>: 5 cards (from a deck of 52 cards) in a card game;</p>
  <p><strong>Output</strong>: some classification using a neural network</p>
  </blockquote>
  <p>How should I model the input layer?</p>
  <p><strong>Option A</strong>: 5 one-hot encodings for the 5 cards, i.e. 5 one-hot vectors of length 52 = 260 input vector. For example</p>
  <pre><code>[
  [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,...]
  ]
  </code></pre>
  <p><strong>Option B</strong>: 5 hot encoding encompassing all 5 cards in one 52 element vector</p>
  <pre><code>[1,0,1,0,1,1,1,...]
  </code></pre>
  <p>What are the disadvantages between A and B?</p>
  
Tags: <neural-networks><machine-learning><ai-design><data-preprocessing>
Title: How should I encode the input which are 5 cards from a deck of 52 cards?
UserDisplayName: deekay42
ThreadText: # How should I encode the input which are 5 cards from a deck of 52 cards?
  
  (Asked by: username_0 on 2018-06-28)
  
  How should I design my input layer for the following classification problem?
  
  Input: 5 cards (from a deck of 52 cards) in a card game;
  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. For example
  [
  [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?
  
  **Tags:** neural-networks, machine-learning, ai-design, data-preprocessing
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-29. Score: 2 | Accepted answer
  
  Depends on how your game is played. Is there any meaning assigned to the order of cards, or are all 5 played simultaneously? If order matters, use 5 one-hot vectors so you can choose how to order them, otherwise use a single 5-hot input vector. I would also add that if **temporal** order matters, you could also use a **recurrent** net with a 52-element input and feed the five one-hot vectors one after another.
  
  
  ---
  
  