Computations based on the geometric center of all players, commonly referred to
as a team’s centroid.
Upon calling the fit()-method, this model calculates a team’s
centroid. The following calculations can subsequently be queried by calling the
corresponding methods:
Team centroids are computed as the arithmetic mean of all player positions (based on
numpy’s nanmean function). For a fixed point in time and \(N\) players with
corresponding positions \(x_1, \dots, x_N \in \mathbb{R}^2\), the centroid is
calculated as
Returns the team centroid positions as computed by the fit method.
Returns:
centroid – An XY object of shape (T, 2), where T is the total number of frames. The two
columns contain the centroids’ x- and y-coordinates, respectively.
Calculates the Euclidean distance of each player to the fitted centroids.
Parameters:
xy (XY) – Player spatiotemporal data for which the distances to the fitted centroids
are calculated.
axis ({None, ‘x’, ‘y’}, optional) – Optional argument that restricts distance calculation to either the x- or
y-dimension of the data. If set to None (default), distances are calculated
in both dimensions.
Returns:
centroid_distance – A PlayerProperty object of shape (T, N), where T is the total number of
frames. Each column contains the distances to the team centroid of the
player with corresponding xID.
Fit the model to the given data and calculate team centroids.
Parameters:
xy (XY) – Player spatiotemporal data for which the centroid is calculated.
exclude_xIDs (list, optional) – A list of xIDs to be excluded from computation. This can be useful if one
would like, for example, to exclude goalkeepers from analysis.
Calculates the Stretch Index, i.e., the mean distance of all players to the
team centroid.
Parameters:
xy (XY) – Player spatiotemporal data for which the stretch index is calculated.
axis ({None, ‘x’, ‘y’}, optional) – Optional argument that restricts stretch index calculation to either the x-
or y-dimension of the data. If set to None (default), the stretch index is
calculated in both dimensions.
Returns:
stretch_index – A TeamProperty object of shape (T,), where T is the total number of
frames. Each entry contains the stretch index of that particular frame.
Computations based on the convex hull of player positions.
Upon calling the fit() method, this model calculates convex
hull objects for each frame. The following calculations can subsequently be queried
by calling the corresponding methods:
The convex hull is computed using scipy’s ConvexHull class and can be understood as the minimal convex area containing all (outfield)
players.
The convex hull is also known in the literature under the terms ‘surface area’,
‘coverage area’ and ‘playing area’ [3].
When multiple XY objects are provided, all players from all teams are combined and
the convex hull encompasses all of them. This is commonly referred to as the
Effective Area of Play (EAP)[4].
convex_hull_area – A TeamProperty object of shape (T,), where T is the total number of frames.
Each entry contains the area enclosed by the convex hull for that frame.
Frames with insufficient valid points have NaN values.
Fit the model to the given data and calculate convex hulls.
Parameters:
xy (XY or list[XY]) – Single XY object or list of XY objects. If list, all XY objects will be
combined and the convex hull will encompass all players (effective playing
space).
exclude_xIDs (list[list], optional) – For each XY object, a list of xIDs to exclude from computation. This can be
useful to exclude goalkeepers from analysis. Length must match number of XY
objects.
Upon calling the fit()-method, this model
calculates pairwise distances between all players for each frame. The
following calculations can subsequently be queried by calling the
corresponding methods:
Calculates the distance to the nearest teammate for each player.
Returns:
distance_to_nearest_mate – A PlayerProperty object of shape (T, N), where T is the total number
of frames and N is the number of players. Each entry contains the
distance to the nearest teammate for that player in that frame.
Calculates the team spread (Frobenius norm of distance matrix).
Returns:
spread – A TeamProperty object of shape (T,), where T is the total number of
frames. Each entry contains the team spread (Frobenius norm of the
pairwise distance matrix) for that frame.
Upon calling the fit()-method, this model
calculates pairwise distances between players of opposing teams. The
following calculations can subsequently be queried:
Calculates distance to nearest opponent for each player on both teams.
Returns:
distance_to_nearest_opponent – A tuple of two PlayerProperty objects of shape (T, N) containing distances
to nearest opponent for each player in the first and second team for each
frame.