socceraction.xthreat.ExpectedThreat.rate

ExpectedThreat.rate(actions, use_interpolation=False)

Compute the xT values for the given actions.

xT should only be used to value actions that move the ball and also keep the current team in possession of the ball. All other actions in the given dataframe receive a NaN rating.

Parameters:
  • actions (pd.DataFrame) – Actions, in SPADL format.

  • use_interpolation (bool) – Indicates whether to use bilinear interpolation when inferring xT values. Note that this requires Scipy to be installed (pip install scipy).

Raises:

NotFittedError – If the model has not been fitted yet.

Returns:

The xT value for each action.

Return type:

np.ndarray