socceraction.atomic.vaep.features¶
Implements the feature tranformers of the VAEP framework.
- socceraction.atomic.vaep.features.actiontype_onehot(actions)¶
Get the one-hot-encoded type of each action.
- Parameters:
actions (Actions) – The actions of a game.
- Returns:
A one-hot encoding of each action’s type.
- Return type:
Features
- socceraction.atomic.vaep.features.direction(actions)¶
Get the direction of the action as components of the unit vector.
- Parameters:
actions (Actions) – The actions of a game.
- Returns:
The x-component (‘dx’) and y-compoment (‘mov_angle’) of the unit vector of each action.
- Return type:
Features
- socceraction.atomic.vaep.features.feature_column_names(fs, nb_prev_actions=3)¶
Return the names of the features generated by a list of transformers.
- Parameters:
fs (list(callable)) – A list of feature transformers.
nb_prev_actions (int, default=3 # noqa: DAR103) – The number of previous actions included in the game state.
- Returns:
The name of each generated feature.
- Return type:
list(str)
- socceraction.atomic.vaep.features.goalscore(gamestates)¶
Get the number of goals scored by each team after the action.
- Parameters:
gamestates (GameStates) – The gamestates of a game.
- Returns:
The number of goals scored by the team performing the last action of the game state (‘goalscore_team’), by the opponent (‘goalscore_opponent’), and the goal difference between both teams (‘goalscore_diff’).
- Return type:
Features
- socceraction.atomic.vaep.features.location(actions)¶
Get the location where each action started.
- Parameters:
actions (Actions) – The actions of a game.
- Returns:
The ‘x’ and ‘y’ location of each action.
- Return type:
Features
- socceraction.atomic.vaep.features.movement_polar(actions)¶
Get the distance covered and direction of each action.
- Parameters:
actions (Actions) – The actions of a game.
- Returns:
The distance covered (‘mov_d’) and direction (‘mov_angle’) of each action.
- Return type:
Features
- socceraction.atomic.vaep.features.play_left_to_right(gamestates, home_team_id)¶
Perform all action in the same playing direction.
This changes the start and end location of each action, such that all actions are performed as if the team plays from left to right.
- Parameters:
gamestates (GameStates) – The game states of a game.
home_team_id (int) – The ID of the home team.
- Returns:
The game states with all actions performed left to right.
- Return type:
list(pd.DataFrame)
- socceraction.atomic.vaep.features.polar(actions)¶
Get the polar coordinates of each action’s start location.
The center of the opponent’s goal is used as the origin.
- Parameters:
actions (Actions) – The actions of a game.
- Returns:
The ‘dist_to_goal’ and ‘angle_to_goal’ of each action.
- Return type:
Features