socceraction.vaep.labels

Implements the label tranformers of the VAEP framework.

socceraction.vaep.labels.concedes(actions, nr_actions=10)

Determine whether the team possessing the ball conceded a goal within the next x actions.

Parameters:
  • actions (pd.DataFrame) – The actions of a game.

  • nr_actions (int, default=10 # noqa: DAR103) – Number of actions after the current action to consider.

Returns:

A dataframe with a column ‘concedes’ and a row for each action set to True if a goal was conceded by the team possessing the ball within the next x actions; otherwise False.

Return type:

pd.DataFrame

socceraction.vaep.labels.goal_from_shot(actions)

Determine whether a goal was scored from the current action.

This label can be use to train an xG model.

Parameters:

actions (pd.DataFrame) – The actions of a game.

Returns:

A dataframe with a column ‘goal’ and a row for each action set to True if a goal was scored from the current action; otherwise False.

Return type:

pd.DataFrame

socceraction.vaep.labels.scores(actions, nr_actions=10)

Determine whether the team possessing the ball scored a goal within the next x actions.

Parameters:
  • actions (pd.DataFrame) – The actions of a game.

  • nr_actions (int, default=10 # noqa: DAR103) – Number of actions after the current action to consider.

Returns:

A dataframe with a column ‘scores’ and a row for each action set to True if a goal was scored by the team possessing the ball within the next x actions; otherwise False.

Return type:

pd.DataFrame