# How to handle the target variable being in the features

I am trying to predict the winner of a tennis match from the players participating and their respective ranks.

Labels of my data:

1. Winner
2. Loser
3. Winner rank
4. Loser rank

The problem is that the columns holding the player names in my data are labeled 'Winner' and 'Loser'. What is the best course of action to render this dataset usable for machine learning?

Could I just assign the 'Winner' column/vector as my target variable, and construct two new columns ('Player1', 'Player2') and populate them with random choices from 'Winner' and 'Loser'?

I think you need to formalize your problem a little bit.

If I were to predict the winner of a tennis match, I would do something like this. I will be predicting the probability of Player 1 winning (or Player 2, without loss of generality). Then, this is a simple classification problem.

Then, for the features, I will organize it in a way that uses player 1 or player 2 to represent the features.

For example, if the variables are: players-current-ranking and face-to-face-win-rate. Then the feature vector will be something like:

player1_current_rank: 10
player1_2_face_to_face_win_rate: 0.7
player2_current_rank: 20
player2_1_face_to_face_win_rate: 0.3


You can never have target variable in your feature, otherwise it won't make any sense predicting it.

• Isn't the player information lost this way? As I understand it, not only the player stats are important, but their name/ID also carries a weight. – George Feb 8 '18 at 20:01
• Each player can be represented using his/her player stats, that's the representation, you will not need the player's name or ID. – TYZ Feb 8 '18 at 20:03
• That makes a lot of sense. I was just thinking that the player IDs could hold some additional hidden information e.g. some factor could be implied based on player IDs that renders Player1 more likely to win over Player2. – George Feb 8 '18 at 20:19
• Name and ID are just an ID, the value itself does not provide any information. The most important variables are the player statistics. If you want something that's more related to player 1 and player 2, you can add variables that show face-2-face statistics (just like the f2f win rate, or other statistics). – TYZ Feb 8 '18 at 20:25