Answers.Body: <p>As you observed, convolutions are &quot;shift/translation equivariant&quot;. This is extremely useful and beneficial for image/video/audio processing where this &quot;symmetry&quot; exists in the underlying domain.<br />
  This is <em>not</em> the case in your settings. Each card from each suit carries a different meaning. You actually want to have a different (trainable) weight for each card for each player. A fully connected layer seems more suitable for this setting.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-01T12:18:21.840Z
Answers.LastActivityDate: 2021-12-01T12:18:21.840Z
Answers.UserDisplayName: Shai
Body: <p>My understanding of how CNN operates in image detection is through the use of kernels that slide through the image to detect features (edges and so on). So a single kernel could potentially be learning to detect an edge no matter where it is in the image. This is great for image recognition problems where an image of a dog shifted to the right or inverted is still an image of a dog. <a href="https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1" rel="nofollow noreferrer">This article</a> states &quot;the features the kernel learns must be general enough to come from any part of the image&quot;. The article also states how using CNN for categorical data where the order in which data is organised is irrelevant can be &quot;disastrous&quot;.</p>
  <p>However, there are instances where it is desirable for the algorithm to be location-aware in order to classify better. Take the case of using CNN to train a network that will predict card play in the game of bridge (a version of double-dummy where all cards are laid out open - perfect information, deterministic). At the beginning of the game the cards dealt to the four could look (very unrealistically) something like this.</p>
  <p><img src="https://i.sstatic.net/dQcnR.png" alt="Initial card Distribution between players" /></p>
  <p>where Leader = the player playing the lead card in round 1, and the subsequent players organised as Leader.LeftHandOpponent, Leader.Partner and Leader.RightHandOpponent. Each player's cards are organised in four suits starting from the Trump_Suit and then the other suits in the original suit hierarchy. Cards go from highest value in the top 'A' to lowest value in the bottom '2'.</p>
  <p>Here is a transpose of the image above.</p>
  <p><img src="https://i.sstatic.net/CMNgQ.png" alt="Transpose of above image" /></p>
  <p>This layout provides a lot of visual cues in terms of how the gameplay will proceed and who will end up winning how many tricks if viewed it from the perspective of control cards distribution within each suit and hand strength. So, the answer to the question of will CNN actually be able to process this data to provide good predictions is a resounding Yes (at least to me).</p>
  <p>However, here is the problem - A regular CNN with a sliding kernel with a (4, 1) stride and no padding would make no distinction between the red boxes when in reality there is a massive difference between them.</p>
  <p>Possible Solution? - A filter consisting of non-sliding kernels/kernels that only slide in one direction (perhaps horizontally or vertically) however would theoretically only seek to learn location-aware features and that could potentially improve accuracy? Just shooting arrow in the sky.</p>
  <p>Has this been researched? Has anybody implemented this already? Could this work?</p>
  <p>P.S: CNN has been used on AlphaGo Zero was great success. Obviously in the game of Go, patterns located in the top of the board carry the same weight as those located in the bottom. The gameplay does not change if the board is flipped 180 degrees. This however is not the case in the game of contract bridge. I am looking at ideas of how this can be resolved.</p>
  
Tags: <machine-learning><deep-learning><convolutional-neural-networks>
Title: Non-sliding kernels for location-aware processing in Convolutional Neural Networks
UserDisplayName: EveryFin
ThreadText: # Non-sliding kernels for location-aware processing in Convolutional Neural Networks
  
  (Asked by: username_0 on 2021-12-01)
  
  My understanding of how CNN operates in image detection is through the use of kernels that slide through the image to detect features (edges and so on). So a single kernel could potentially be learning to detect an edge no matter where it is in the image. This is great for image recognition problems where an image of a dog shifted to the right or inverted is still an image of a dog. [This article](https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1) states "the features the kernel learns must be general enough to come from any part of the image". The article also states how using CNN for categorical data where the order in which data is organised is irrelevant can be "disastrous".
  
  However, there are instances where it is desirable for the algorithm to be location-aware in order to classify better. Take the case of using CNN to train a network that will predict card play in the game of bridge (a version of double-dummy where all cards are laid out open - perfect information, deterministic). At the beginning of the game the cards dealt to the four could look (very unrealistically) something like this.
  
  ![Initial card Distribution between players](https://i.sstatic.net/dQcnR.png)
  
  where Leader = the player playing the lead card in round 1, and the subsequent players organised as Leader.LeftHandOpponent, Leader.Partner and Leader.RightHandOpponent. Each player's cards are organised in four suits starting from the Trump\_Suit and then the other suits in the original suit hierarchy. Cards go from highest value in the top 'A' to lowest value in the bottom '2'.
  
  Here is a transpose of the image above.
  
  ![Transpose of above image](https://i.sstatic.net/CMNgQ.png)
  
  This layout provides a lot of visual cues in terms of how the gameplay will proceed and who will end up winning how many tricks if viewed it from the perspective of control cards distribution within each suit and hand strength. So, the answer to the question of will CNN actually be able to process this data to provide good predictions is a resounding Yes (at least to me).
  
  However, here is the problem - A regular CNN with a sliding kernel with a (4, 1) stride and no padding would make no distinction between the red boxes when in reality there is a massive difference between them.
  
  Possible Solution? - A filter consisting of non-sliding kernels/kernels that only slide in one direction (perhaps horizontally or vertically) however would theoretically only seek to learn location-aware features and that could potentially improve accuracy? Just shooting arrow in the sky.
  
  Has this been researched? Has anybody implemented this already? Could this work?
  
  P.S: CNN has been used on AlphaGo Zero was great success. Obviously in the game of Go, patterns located in the top of the board carry the same weight as those located in the bottom. The gameplay does not change if the board is flipped 180 degrees. This however is not the case in the game of contract bridge. I am looking at ideas of how this can be resolved.
  
  **Tags:** machine-learning, deep-learning, convolutional-neural-networks
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-12-01. Score: 1
  
  As you observed, convolutions are "shift/translation equivariant". This is extremely useful and beneficial for image/video/audio processing where this "symmetry" exists in the underlying domain.  
  This is *not* the case in your settings. Each card from each suit carries a different meaning. You actually want to have a different (trainable) weight for each card for each player. A fully connected layer seems more suitable for this setting.
  
  
  ---
  
  