I MPROVED S TRUCTURAL D ISCOVERY AND R EPRESENTATION L EARNING OF M ULTI -A GENT D ATA
Anonymous authors
Paper under double-blind review
A BSTRACT
Central to all machine learning algorithms is data representation.
For multi-agent systems, selecting a representation which adequately captures the interactions among agents is challenging due to the latent group structure which tends to vary depending on context.
However, in multi-agent systems with strong group structure, we can simultaneously learn this structure and map a set of agents to a consistently ordered representation for further learning.
In this paper, we present a dynamic alignment method which provides a robust ordering of structured multiagent data enabling representation learning to occur in a fraction of the time of previous methods.
We demonstrate the value of this approach using a large amount of soccer tracking data from a professional league.
I NTRODUCTION
The natural representation for many sources of unstructured data is intuitive to us as humans: for images, a 2D pixel representation; for speech, a spectrogram or linear ﬁlter-bank features; and for text, letters and characters.
All of these possess ﬁxed, rigid structure in space, time, or sequential ordering which are immediately amenable for further learning.
For other unstructured data sources such as point clouds, semantic graphs, and multi-agent trajectories, such an initial ordered structure does not naturally exist.
These data sources are set or graph-like in nature and therefore the natural representation is unordered, posing a signiﬁcant challenge for many machine-learning techniques.
A domain where this is particularly pronounced is in the ﬁne-grained multi-agent player motions of team sport.
Access to player tracking data changed how we understand and analyze sport (Miller et al., 2014; Franks et al., 2015; Wei et al., 2013; Cervone et al., 2014; Power et al., 2017; Sha et al., 2016; 2018;
Yue et al., 2014).
More relevantly, sport has risen to an increasingly key space within the machine learning community as an application to expand our understanding of adversarial multiagent motion, interaction, and representation (Lucey et al., 2013; Le et al., 2017; Felsen et al., 2018;
Zheng et al., 2016; Zhan et al., 2018; Yeh et al., 2019; Kurach et al., 2019).
In sport there exists strong, complex group-structure which is less prevalent in other multi-agent systems such as pedestrian tracking.
Speciﬁcally, the formation of a team captures not only the global shape and structure the group, but also enables the ordering of each agent according to a “role” within the group structure.
In this regard, sport possesses relational structure similar to that of faces and bodies, which can be represented as a graph of key-points.
In those domains, representation based on a ﬁxed key-point ordering has allowed for cutting edge work across numerous tasks with a variety of approaches and architectures (Antonakos et al., 2015; Cootes et al., 2001;
Akhter et al., 2012; Joo et al., 2015; Simon et al., 2017).
Unlike for faces and bodies, the representation graph in sport is dynamic as players constantly move and switch positions.
Thus dynamically discovering the appropriate representation of individual players according to their role in a formation affords us structural information while learning a useful representation for subsequent tasks.
This challenge was addressed by the original role-based alignment of Lucey et al.
(2013) and subsequently by Bialkowski et al.
(2016) and Sha et al.
Role-based alignment allows us to take unstructured multi-agent data, and reformat it into a consistent vector format that enables subsequent machine learning (Fig. 1).
Here we formulate the role-based alignment as consisting of the phases of formation discovery and role assignment.
Formation discovery uses unaligned data to learn an optimal formation template ; during role assignment a bipartite mapping is applied between agents and roles in each frame to
C
A
E
D
B
F
G
H
I
J
C
A
E
D
B
F
G
H
I
J produce “aligned data”.
A major limitation in past approaches was the speed of the template discov- process.
In this work we propose an improved approach to the above alignment methods which provides faster and more optimal template discovery for role-based representation learning.
Importantly, we seek to learn the same representation as Lucey et al.
(2013), Bialkowski et al.
(2016), and Sha et al.
by maximizing the same objective function of Bialkowski et al.
in a more effective manner
The reduced computational load enables on-the-ﬂy discovery of the formation
Our main contributions are: the formulation of this problem as a three-step approach (formation discovery, role assignment, template-clustering), the use of soft-assignment in the formation discovery phase thereby eliminating the costly hard-assignment step of the Hungarian Algorithm (Kuhn, 1955), a resetting training procedure based on the formation eigenvalues to prevent spurious optima, quantiﬁcation of the impact of initialization convergence and stability, a restriction of the training data to key-frames for faster training with minimal impact on the learned representation, and a multi-agent clustering framework which captures the covariances across agents during the template-clustering phase.
B ACKGROUND 2. R EPRESENTING S TRUCTURED M ULTI -A GENT D ATA
A collection of agents is by nature a set and therefore no deﬁned ordering exists a priori .
To impose an arbitrary ordering introduces signiﬁcant entropy into the system through the possible permutations of agents in the imposed representation.
To circumvent this, some approaches in representing multi-agent tracking data in sport have included sorting the players based on an “anchor” agent (Mehrasa et al., 2018).
This is limiting in that the optimal anchor is task-speciﬁc, making the representation less generalizable.
An “image-based” representation (Yue et al., 2014; Zheng et al., 2016; Miller et al., 2014) eliminates the need for an ordering, however, this representation is lossy, sparse, and high-dimensional.
The role-based alignment protocol for sport of Lucey et al.
(2013) used a codebook of hand-crafted formation templates against which frame-level 1 samples were aligned.
This work was extended by
Bialkowski et al.
(2016) which learned the template directly from the data.
Sha et al.
(2017) further employed a hierarchical template learning framework, useful in both retrieval (Sha et al., 2018) and trajectory prediction (Felsen et al., 2018;
Yeh et al., 2019).
Le et al.
(2017) similarly learned an agent-ordering directly from the data by learning separate role-assignment and motion-prediction policies in an iterative and alternating fashion.
2. P ERMUTATION -E QUIVARIANT A PPROACHES
Permutation-equivariant approaches seek to leverage network architectures which are insensitive to the ordering of the input data.
Approaches using graph neural networks (GNN) (Kipf & Welling, 2016; Gilmer et al., 2017; Battaglia et al., 2018; 2016; Hoshen, 2017) have become very popular and shown tremendous promise.
These approaches are particularly valuable for tasks (e.g. pedestrian tracking) which lack the strong coherent group structure of sport and therefore cannot leverage meth-
[Figure] [Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure]
ods such as role-alignment.
Within sport, Kipf et al.
(2018) used a GNN to predict the trajectories of players while simultaneously learning the edge-weights of the graph.
Yeh et al.
(2019) demonstrated the advantages in using GNNs to forecast the future motion of players in sports, surpassing both the role (Bialkowski et al., 2016) and tree-based approaches (Sha et al., 2017) on most metrics.
The success of these approaches, however, does not negate the value of role-based alignment.
The learned formation structure provides valuable insight into high-level organization of the group.
Furthermore, many traditional machine learning techniques and common deep architectures require an ordered-agent representation.
This is again similar to what is seen in the modeling of faces and bodies: great success has been achieved using geometric deep learning (Monti et al., 2017; Kipf et al., 2018), but approaches based on a ﬁxed representation remain popular and effective (Taylor et al., 2017; Kanazawa et al., 2019; Arnab et al., 2019; Walker et al., 2017; Rayat Imtiaz Hossain & Little, 2018).
Interesting work has also been done to learn permutations for self-supervised feature learning or ranking tasks (Adams & Zemel, 2011; Mena et al., 2018; Cruz et al., 2017).
Central to these approaches is the process of Sinkhorn normalization (Sinkhorn & Knopp, 1967), which allows for soft-assignment during the training process and therefore a ﬂow of gradients.
Exploring the application of Sinkhorn normalization to this task is beyond the scope of this current work, however, we provide additional context on this method in Section A.2.
A PPROACH 3. P ROBLEM F ORMULATION
Mathematically, the goal of the role-alignment procedure is to ﬁnd the transformation
A : { U 1 , U 2 , . . .
, U N } × M (cid:55)→ [ R 1 , R 2 , . . .
, R K ] which maps the unstructured set U of N player trajectories to an ordered set (i.e. vector) of K role-trajectories R .
Each player trajectory is itself an ordered set of positions U n =
[ x s,n ] Ss =1 for an agent n ∈ [1 , N ] and a frame s ∈ [1 , S ] .
We recognize M as the optimal permutation matrix which enables such an ordering.
Thus our goal is to ﬁnd the most probable set F ∗ of 2D probability density functions where
[Equation] [Equation]
Bialkowski et al.
(2016) transforms this equation into one of entropy minimization where the goal is to minimize the amount of overlap (i.e. the KL-Divergence) between each role.
The ﬁnal optimization equation in terms of the total entropy H then becomes
[Equation]
See A.1 for additional details.
The authors then use expectation maximization (EM) to approximate this solution and note similarity to k-means clustering.
However, as they represent that data non-parametrically in terms of per-role heat maps, hard assignment must be applied at each iteration so the distributions may be updated.
Instead, we note that equation 2 describes the occupancy of space by any agent in any point in time as a mixture of conditional distributions across each of the N -roles.
This is further equivalent to the sum over n -generating distributions.
Thus if we model these generating distributions as ddimensional Gaussian distributions, this reduces the template-discovery process to that of a Gaussian
Mixture Model.
3. T OY P ROBLEM F ORMULATION
Understanding the notion of independence under the different formulations of this problem is key.
This may be better understood by considering a toy problem: imagine we have
three independent 1D
Gaussian distributions we wish to sample S times from each.
It is known that we sample from each distribution in rounds, effectively generating the samples in “triplets”, although the order within the triplets is random.
We then seek to reassign the points back to their original distributions.
Following the approach of Bialkowski et al.
(2016), the “structure” imposed by the triplet sampling is enforced through the hard-assignment at each iteration.
Recall, however, that the original distributions were statistically independent; the triplet structure we wish to respect is imposed by the assignment step, not the underlying distributions.
Contrastingly, in our method the samples are treated as fully independent; had all samples been taken from the ﬁrst distribution, followed by the second, followed by the third, the outcome at the “distribution-discovery” phase would be identical to that having sampled the data in rounds.
Only after the three distributions are estimated would the assignment of each point in every triplet be assigned to the distribution which maximized the overall likelihood in that triplet.
Besides being more computationally effective (see Section 4.2), this allows us to ﬁnd the true MLE of the distributions.
Our method will always discover a more optimal estimate of Eq. 2.
This can be understood in considering how the assignment is performed during optimization.
For each triplet, the likelihood of assigning each point to each distribution is computed in both approaches.
In our approach, this gives the likelihood under each mixture component.
In the hard-assignment approach, however, if two (or more) points in a triplet have their highest likelihood under the same component, the exclusionary assignment must result in a lower likelihood than assigning each point to its preferred Gaussian.
Furthermore, in our approach, each sample contributes to every component of the mixture, thus the data under the mixture remains “ﬁxed” during the optimization process.
In contrast, as the hardassignments are made, the samples contributing to each distribution changes each iteration.
This, in combination with the sub-optimal likelihood above, effectively “breaks” the expectation maximization step and can cause solutions to diverge or oscillate, which is inconsistent with a maximum likelihood solution which must monotonically increase.
Thus our approach is computationally efﬁcient, more intuitively captures the independence of the generating distributions versus the structure of the sampling, and ensures a likelihood function that will converge under expectation maximization.
3. F ORMATION -D ISCOVERY
Our procedure explained here is presented visually in Figure 2 and algorithmically in Algorithm A.3.
effects.
approach
), we initialize the cluster centers for formation-discovery with the average player positions.
The impact of this choice of initialization is explored in Section 4.5.
We now structure all the data as a single ( SN ) ×
d vector where S is the total number of frames, N is the total number of agents (10 outﬁelders in the case of soccer), and d is the dimensionality of the data (2 here).
The K-Means algorithm is initialized with the player means calculated above and run to convergence; we ﬁnd that running K-Means to convergence produces better results than running a ﬁxed number of iterations as is commonly done for initialization.
The cluster-centers of the last iteration are then used to initialize the subsequent mixture of Gaussians.
Mixture of Gaussians are known to suffer from component collapse and becoming trapped in pathological solutions.
To combat this, we monitor the eigenvalues ( λ i ) of each of the components throughout the EM process.
If the eigenvalue ratio of any component becomes too large or too small, the next iteration runs a Soft K-Means (i.e. a mixture of Gaussians with spherical covariance) update instead of the full-covariance update.
We ﬁnd that the range 12 < λ 1 λ 2 < 2 works well.
In practice, we ﬁnd this is often unnecessary when analyzing a single game as the player-initialization provides the necessary stabilization, but becomes important for analysis over many teams/games where that initialization signal is weaker. We refer to this set of K distributions which maximizes the likelihood of the data the Formation , which we denote F ∗ .
Note that the formation is a set of distributions.
To enforce an ordering, we must align to a parent template, G ∗ , which is an ordered set of distributions.
The speciﬁc ordering of this template is unimportant so long as it is established and ﬁxed.
We align F ∗ to G ∗ by ﬁnding the Bhattacharyya distance (Bhattacharyya, 1943) between each distribution in F ∗ and G ∗ given by
D B = 18 ( µ F ∗ i − µ G ∗ j ) T σ − 1 ( µ F ∗ i − µ G ∗ j )
+ 12 ln( det σ (cid:113)
det σ F ∗ i det σ G ∗ j ) where σ = σ F ∗ i + σ G ∗ j to create a K × K cost matrix and then use the Hungarian algorithm to ﬁnd the best assignment.
We have now produced our Template , T ∗ an ordered set of distributions with an established ordering that maximizes the likelihood of the data.
3. R OLE -A SSIGNMENT
The process of role-assignment maps each player in each frame to a speciﬁc role with the restriction that only one player may occupy a role in a given frame.
We ﬁnd the likelihood that each agent belongs to each of the discovered distributions in each frame which was already calculated during the formation-discovery step.
This produces a N × K cost matrix in each frame; the Hungarian algorithm is again used to make the optimal assignment.
Thus we have achieved the tasks of formation-discovery and role-assignment having had to apply the Hungarian algorithm on only a single pass of the data.
We now represent the aligned data as a S × ( dK ) matrix R .
3. C LUSTERING M ULTI -A GENT D ATA
With an established well-ordered representation, we are now able to cluster the multi-agent data to discover sub-templates and perform other analysis.
Sub-templates may be found either through ﬂat or hierarchical clustering.
Generically, we seek to ﬁnd a set of clusters C which partitions the data into distinct states according to:
[Equation] [Equation]
For ﬂat clustering, a dN -dimensional K-Means model is ﬁt to the data.
To help initialize this clustering, we seed the model with the template means plus a small amount of noise.
To determine the optimal number of clusters we use a measure similar to Silhouette score (Rousseeuw, 1987):
[Equation]
where µ k is the mean of the cluster that example R i belongs to and µ kn is the mean of the closest neighbor cluster of example R i .
Equation 5 measures the dissimilarity between neighboring clusters and the compactness of the data within each cluster.
By maximizing E we seek to capture the most discriminative clusters.
To learn a tree of templates through hierarchical clustering, we follow the method of (Sha et al., 2017) with minor modiﬁcation on how the clusters and templates are initialized.
Algorithm A. outlines this procedure.
R ESULTS 4. D ATASET
For this work, we used an entire season of player tracking data from a professional European soccer league, consisting of 380 games, 6 of which were omitted due to missing data.
The data is collected from an in-venue optical tracking system which records the ( x, y ) positions of the players at 10Hz.
The data also contains single-frame event-labels (e.g. pass, shot, cross) in associated frames; these events were used only to identify which frames contained the onset of an event which we call eventframes .
Unless explicitly noted, the analysis used only event-frames for training, providing over 1.8million samples across the season.
4. R UN C OMPLEXITY
Finding the optimal solution to K-Means is NP-hard, even for 2 clusters.
However, through standard methods K-means clustering can achieve an average per-iteration complexity of ( samples · clusters · dimensions ) while Gaussian mixture models have a complexity of ( samples · clusters · dimensions 2 ) per iteration due to the additional calculation of the precision matrix (Lloyd, 1982;
Verbeek et al., 2003).
Note that for all algorithms, samples becomes SN since each agent in each frame contributes to the distributions.
The Hungarian Algorithm has a complexity of elements 3 per application.
In the original algorithm of Bialkowski et al.
(2016), the cost matrix per frame is calculated in a manner resembling that of the GMM, requiring the full distribution (i.e. mean and precision matrix) to be computed so the likelihoods may be calculated.
However, the Hungarian Algorithm is then applied across the N -agents in each of the S -frames.
This produces a per-iteration complexity of ( SN )
Kd 2 N 3 .
With K = N , this simpliﬁes to SN 5 d 2 (see Table 1 of Section A.5).
In contrast,
K-Means and GMM have a per-iteration complexity of SN 2 d and SN 2 d 2 , respectively.
Therefore, for a sport like soccer, N = 10 , causing the hard-assignment based algorithm to be ∼ 1000 times slower than the proposed approach.
4. C OMPARISON OF D ISCOVERED F ∗
As all of these methods are unsupervised, there is no notion of a “more accurate” formation.
However, as the goal is to ﬁnd the F ∗ which maximizes the likelihood of the data, for each team-gameperiod (TGP), we computed the formation via hard-assignment and our current method, and computed the per-sample average log-likelihood of the data under each method.
Our method produced a lower (i.e. more likely) log-likelihood for every TGP-formation, consistent with the theoretical guarantees (Figure 3A).
In general, the difference between the two approaches was very small, an average difference in log-likelihood of 0.028.
We compute the ﬁeld area covered by a role as A = π √ λ 1 λ 2 where λ 1 and λ 2 are the eigenvalues of the covariance matrix for that role.
On average, the ﬁeld area covered by a role under the current method is 0 .
m 2 smaller than the corresponding role under Bialkowski et al.
This is consistent with the formations learned via the two methods being extremely similar; the average
KL-Divergence (Kullback & Leibler, 1951) between corresponding roles under the two method is 0.14nats.
4. C OMPRESSION E VALUATION
Template-based alignment has been shown to produce a compressed representation of multi-agent spatiotemporal data (Lucey et al., 2013).
We repeat this analysis here in Figure 3.
Similar to the approach in (Sha et al., 2017), we evaluate the compressibility of the approach using clustering and principle component analysis (PCA).
We randomly selected 500,000 frames from the larger data set.
Frames were aligned according to Algorithm A.3 (”Role current” in Figure 3), via hard-assignment
[Figure]
(”Role hard”), or left unordered (”Identity”).
K-means clustering was applied to both the original unaligned data and aligned data for varying values of K. The average within-cluster-error (WCE) was calculated according to WCE = 1 | R | (cid:80) C k (cid:80)
R i ∈
C k (cid:107) R i − µ (cid:107) 2 where we again abuse C k to indicate the k th cluster after K-means clustering.
Similarly we run PCA on both the unaligned and aligned data and compute the variance explained by the eigenvectors: Variance Explained = λ k (cid:80) Di =
λ i where λ
i is the i th eigenvalue indicating the signiﬁcance of the i th eigenvector.
Role-based representation, regardless of the method used to compute it, is signiﬁcantly more compressive than an identity-based representation.
The representation computed via the current method is slightly more compressive than under hard assignment: the per player reconstruction error over the range in Figure 3B is on average 0.76m lower and the variance explained on average is 0. higher.
4. I MPACT OF I NITIALIZATION AND K EY -F RAMES
The original template-learning procedure proposed initializing the algorithm with the distributions of each player, as players tend to spend much of their time in a speciﬁc role.
In the subsequent work of Sha et al.
(2017), a random initialization at each layer was proposed.
To assess the impact of the player-mean initialization, we ran Alg.
A.3 20 times per-TGP, each of which contains about 1500 frames, and recorded the reconstruction error during the K-Means initialization phase of the algorithm.
While the exact reconstruction error is sample speciﬁc, all samples showed the same trend as Figure 4A: player-mean initialization begins with a much lower reconstruction error and converges signiﬁcantly more quickly, often within 10 steps.
In contrast, the random initialization is much more variable, takes many more iterations to converge, and often does not converge to as good a solution.
The use of event-only “key frames” is also a key performance and stabilization measure.
Limiting the data to event-only frames reduces the data by a factor of ∼ 10 , producing a speed-up of the same factor.
This has minimal impact on the learned template as seen in Figure 4B.
In most instances, the templates learned are almost identical: the average L2-distance between the center of two role distributions is 0.24m and the average Bhattacharyya distance (Bhattacharyya, 1943) between two role distributions is 0.078.
4. C ONTEXT -S PECIFIC F ORMATIONS
Previously, due to the slowness of the hard-assignment approach, templates had to be learned as a part of a preprocessing step before storage/analysis/consumption.
Usually this would be done at the
TGP-level, generating a total of 4 “specialist” templates per game.
In contrast, the proposed method allows templates to be computed “on the ﬂy”.
For several thousand rows of data, the formation can be discovered and aligned in only a few seconds.
This allows us to select data under interesting contexts and learn the template that best describes those scenarios across many games.
[Figure] [Figure]
Figure 5 shows two such analyses this method unlocks 3 .
On the left (A) we examine the formation of a team across an entire season when they are attacking in and defending against two very different “styles” of play (the very offensively aggressive counterattack and a conservative “hold the ball” maintenance style) (Ruiz et al., 2017).
Similarly, we can examine how a team positions itself when leading or trailing late in a game both at home or away (B).
In addition to learning the formation, we can add back in the overall group positioning to see where on the pitch the team attempts to position itself.
Additionally, we can learn and align the unique formations of every team across an entire season in a matter of minutes (see Figure 6 in A.6).
Other potential analyses could include computing the formation after substitutions or analyzing how teams perform when certain individuals occupy a given role; such analyses are left to future work.
S UMMARY
For multi-agent systems with a high degree of structure such as that seen in team sport, we are able to learn a mapping which takes the set of agents to an ordered vector of agents without introducing undue entropy from permutation.
In this work we have shown an improved method for learning the group representation of structured multi-agent data which is signiﬁcantly faster.
Additionally, the monotonically decreasing nature of its objective function provides stability.
Our approach exploits the independence of the role-generating distributions during the template-learning phase and enforces the hard assignment of a single agent to a single role only during the ﬁnal alignment step.
This new approach, in combination with a smart choice of key-frame selection and initialization, allows for this representation to be learned over n 3 times faster- a factor of more than 1000 for a sport like soccer.
By learning this representation, we are able to perform season-wide contextual and on-the-ﬂy representation learning which were previously computationally prohibitive.
A. S UMMARY OF THE F ORMATION D ISCOVERY A LGORITHM OF B IALKOWSKI ET AL .
[Equation]
To learn the per-role player distributions, the authors cast the problem as one of data paritioning where the goal is to minimize the overlap of an individual role P n ( x ) and that of the team P ( x ) by placing a penalty V n on that overlap as deﬁned by
[Equation]
where
[Equation]
Eq.
1 can then be written as
[Equation]
Substituting Eq.
6 into Eq.
8 yields
[Equation]
Written in terms of the entropy H ( x ) = − (cid:82) + ∞
−∞ P ( x ) log( P ( x )) dx this simpliﬁes to
[Equation]
yielding the ﬁnal equation of F ∗ as given in Eq. 3.
They approximate the solution by using expectation maximization (EM) as summarized here:
Initialization : The data is normalized such that the average team position in each frame is placed at the origin.
The formation is initialized by assigning a player to a single role for the entire game.
This allows the construction of n independent distributions describing the n different generating roles.
E-Step : An n × n cost matrix is computed for each frame which is based on the log-probability of
each player being assigned to a particular role distribution.
M-Step : The Hungarian Algorithm (Kuhn, 1955) is used to (hard) assign each player to a speciﬁc role in each frame.
Once all roles have been assigned for that iteration, the role distributions are recomputed.
Termination :
The process repeats until convergence.
A. R ELATION TO G UMBEL -S INKHORN
In the original template discovery formulation, application of the Hungarian algorithm at each iteration made the strong requirement that a single player be assigned to a single cluster in each frame, that is, π s,i = π s,j ∀ i, j ∈ K, ∀ s ∈ S .
Our method treats each agent in each frame as fully independent; if we examined at the assignment probabilities for a given frame during training, the likelihood would exceed 1.
Furthermore, during training, there are no restrictions on the values of each π beyond the standard requirement that (cid:80)
Kk =1 π k = 1 .
Thus at the end of the formation-learning step, there is no requirement that each π k = 1 K .
The requirement that each role be occupied by only a single agent in each frame and that weights are uniform is imposed only at the assignment step.
An approach based on Sinkhorn normalization can be seen as an intermediate between these two paradigms, allowing for soft -assignment of every agent in a frame to every cluster during the learning process.
Thus during training, a player could still contribute to multiple clusters, but the weighting of that contribution is restricted by Sinkhorn normalization which requires the assignment matrix in each frame to be doubly stochastic.
Following the notation of Cruz et al.
(2017), rows R and columns C are normalized according to
[Equation]
with the n th iteration deﬁned recursively as
[Equation]
Similar to our approach, Sinkhorn-based methods employ hard assignment via the Hungarian algorithm only after training completes.
The additional beneﬁt of this approach is that the Sinkhorn normalization function is differentiable and thus amenable to gradient-based methods.
However as our approach is based on expectation maximization, the drawback to Sinkhornnormalization is that the iterative normalization step is required in each frame at each EM iteration.
Thus within the EM framework, it remains cost-prohibitive although gives ﬁnal assignment results equivalent to both the original and current methods.
A.
O PTIMAL T EMPLATE L EARNING A LGORITHM
Algorithm
Input:
U =
{ U 1 , U 2 , . . .
, U N } unordered player positions
G ∗ a parent/global template
Output:
R =
[ R
, R
Normalization
Formation Discovery
4: conduct K-Means clustering for initialization: K-Means ( M , µ init =
[ ¯ M 1 , ¯ M 2 , . . .
, ¯ M N ]) 5: function E IGENVALUE R ESETTING GMM 6: while lower bound average gain < threshold do 7: if 1 r < λ n 1 λ n 2 < r ∀ n ∈ N then 8: µ , σ , π ← GMM Update 9: else 10: µ , σ , π ← Soft K-Means Update 11: return F ∗
Template Alignment
12: function A LIGN T EMPLATES ( F ∗ , G ∗ ) 13: create cost matrix C s.t.
C i,j is the Mahalanobis distance between the i th distribution in F ∗ and the j th distribution in G ∗ 14: apply Hungarian algorithm to ﬁnd optimal assignment of F i to G j 15: return T ∗
Role Assignment
16: function A PPLY A LIGNMENT ( R , T ∗ ) 17: for s in S do 18: create cost matrix C s.t.
C i,j is the likelihood the R s, ı
( i th -agent in frame s ), belongs to the j th distribution of T ∗ 19: apply Hungarian algorithm to ﬁnd optimal assignment of R s, ı to T ∗ 20: return R
A. T REE - BASED A LIGNMENT
This algorithm is adapted from Sha et al.
The overall structure is the same with changes to the initializations captured in A.3.
Input: R = { U 1 , U 2 , . .
, U N } unordered player positions
G ∗ a parent/global template
T = ∅ , C = ∅
Output: T, C 1: function L EARN T REE ( R ) 2: for each layer l do 3: for each node n do 4: learn F ∗ ln , T ∗ ln , R ln from Algorithm A.3 with G ∗ =
T ∗ l − 1 n and R =
R l − 1 n , the data contained in the parent node 5: store [ T ∗ l 1 , ..., T ∗ lZ ] in T 6: compute reconstruction loss with Eq.7: terminate when stropping criterion is met 8: for each node n do 9: create K initialization vectors by adding small amounts of noise (cid:15) to the cluster means of T ∗ ln 10: conduct K-Means on R ln with different K 11: select cluster set C ln that maximize E partition C ln to child nodes according to C ln
Store [ C l 1 , ..., C lZ ] in C 12: return T, C
A.
R UN C OMPLEXITY
Average per-iteration run-complexity for various methods.
[Table]
A. L EAGUE -W IDE A NALYSIS
We ran our formation discovery and alignment algorithm on every team-game-period combination of an entire season.
This analysis previously took upwards of 20 minutes to process a game under the original approach, but now can be run in less than 10 seconds a game.
Some teams consistently operate out of the same formation and therefore the templates and distribution centers are well isolated across the season (e.g. second row, far right).
Others play different formations in different matches and therefore the game-to-game templates can vary dramatically (e.g. third row, second from the left; bottom row, second from the left).
Our algorithm is able to learn these various templates and align them so that a common, structured representation can be used across matches.