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:


Winner
Loser
Winner rank
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.