1
$\begingroup$

Let's say you have a very wide feature vector, all 0s and 1s, all 500 players in Premier League as features, out of which only 22 participate in a match. Those that participate are marked with 1s, those that don't with 0s.

I want to create a model (for fun) to compute the impact of a player on the outcome of the match - if he is present / absent, how would the odds change. The output of the model is a classification, will it be a home, draw or away win (Softmax).

1/ Is "0" enough of a representation for the absence of players in a match or should the input (or loss?) be treated differently to better capture the absence? (not in the sense that the player was not there but it could have been, but rather that it was not there and had nothing to do with the match).

I am thinking that the players that were not on the field should be completely ignored when computing the match outcome (e.g. "dropped" as in Dropout)

2/ If "0" is enough to be dropped, should the 1s be scaled somehow upwards? I am thinking that the total sum for the input is rather low. Similar to how Dropout handles scaling to preserve the sum of inputs.

3/ Do things change if I standardize the inputs? If I do, the 0s are already not 0s, they will shift towards a negative value, completely destroying the meaning of absence as in "dropped" ?

4/ How would you otherwise deal with the absence of data? There are 380 matches and over 500 players?

Note: in my toy model I generate fake seasons, distribute the total goals each player scored to and these compute the scores for the resulted matches. E.g. I know Player X scored 26 goals during the real season, I'd generate random seasons where he scores 26 goals but distribute them across different matches. (I know the model is incomplete and it does not take into consideration the opposing team defense, but I'd like to see where this approach leads me and how much of the odds it explains).

$\endgroup$

1 Answer 1

1
$\begingroup$

Lots of different approaches, you could instead of 1 or 0 you could have more granular information of their time on the pitch (if your data supports it). I think number of goals is a bad feature to use for all players as presumably defenders and goal keepers generally dont score. You could keep it if you reduce it to known strikers maybe.

Also I question if number of goals directly correlates to a win/draw/lose. A match can be won with only one goal scored and could still be lost if many are scored but feel free to model it.

Otherwise 1 and 0 should be fine. I am assuming you have players as the columns and rows are matches played. In which case there is no point in standardising the data as each column represents the same range of possible values.

Ideally you would have more rows than columns but if its for fun I would say why not model it.

I produced a psuedo-random dataset (ie random unless player 0 playes then score that as a win) that simulates what you are asking then did simple Logistic regression.

import pandas as pd
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split

player_list = [f'player_{i}' for i in range(500)]
players_selected = []
for i in range(380):
  a_list = np.array([0 for i in range(500)])
  for j in np.random.choice(np.arange(500),size = 380):
    a_list[j] = 1
  players_selected.append(a_list)

players_selected = np.array(players_selected)

df =pd.DataFrame(players_selected, columns=player_list)
df['game_result'] = np.random.choice([0,1,2],size = (380))
df['game_result'] = df['player_0'].apply(lambda x:2 if (x == 1) else np.random.choice([0,1]))

X = df.iloc[:,:-1]
y = df.iloc[:,-1]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
LR = LogisticRegression(random_state=0, max_iter=10000).fit(X_train, y_train)
print(LR.predict(X_test))
print(LR.score(X_test, y_test))

enter image description here

output was:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.