+ 5

Encoding features in ML task

I'm building a model to learn how to play card game. I'm wondering the best encoding to apply. For example how to encode each card's name such that if name ace of spades as 8, it shouldn't mean it's closer to card named 9 than the one named 1. I've read about different encoding techniques like onehot, leaveoutone etc but I just can't understand the one best suited for my needs.

20th Jan 2019, 9:45 AM
Dan Rhamba
Dan Rhamba - avatar
4 Réponses
+ 6
The "best" encoding method depends on how the game is played. In ML, oftentimes 8 doesn't necessarily mean it is closer to 9 than it is to 1. That is also dependent on how the encoding result is interpreted. That said, for the typical card game, cards can be encoded as a vector of characteristics. To avoid from the semantics of distance implied by numbers, you can differentiate them based on: isSpade, isDiamond, isClub, isHeart, value which is a variation of one-hot encoding, but without a boolean aspect to the last characteristic (since value is indeed relative). E.g. Ace of Spades [1, 0, 0, 0, 1] King of Diamonds [0, 1, 0, 0, 13] As such, each card is distinct and the "distance" between two vectors actually makes sense.
20th Jan 2019, 11:01 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Great Hatsy Rei ...this gonna work.👍👍👍. This is more than what I was expecting.
20th Jan 2019, 11:48 AM
Dan Rhamba
Dan Rhamba - avatar
0
..ььлгеениреу
21st Jan 2019, 7:49 AM
Татьяна Березовская
Татьяна Березовская - avatar