1 Introduction

Now that sensor devices and the global positioning system are popular and image processing technologies have made a great progress, the data analysis of movement trajectories have been actively studied. For example, Lin et al. [1] presented a model of person’s movement trajectory with a graph and formulated the elderly’s disorientation detection problem as abnormality detection in the trajectories. In the domain of weather analysis, Dodge et al. [2] investigated the validity of the similarity in analyzing the trajectory of tropical cyclones. Especially with regard to sports, the similarity analysis of player’s actions and movement trajectories has been performed for various kinds of sports [3,4,5,6]. For the RoboCup soccer simulation, Michael et al. [7] proposed a method that represents the trajectories of the ball and players in a game with a recurrent neural network.

Nakashima et al. [8] performed a tactical analysis based on kick distributions obtained by kicks of a soccer team in RoboCup soccer 2D simulation. In their analysis method, soccer teams were grouped in an unsupervised way such as hierarchical clustering using the kick distributions. The distance between two kick distributions was calculated to measure the similarity between them during the clustering process. In their paper, Earth Mover’s Distance (EMD) was used as the distance metric between two kick distributions. However, EMD has some problems. For example, the computational cost becomes intractably high as the number of kicks in the kick distributions increases. It is for this reason that EMD is not suitable for online tactical analysis. Furthermore, it is not clear whether the distance calculated by EMD agrees with the subjective similarity by human.

The purpose of this research is to show the validity of a computational way to understand team strategies in a similar manner to human’s subjectivity. This paper tackles the above problems in the kick distribution. That is, we try to reduce the computational cost for calculating the distance between kick distributions, and also we investigate the validity of various distance metrics for kick distributions. There are two key aspects in this research. One is to convert a discrete kick distribution into a continuous probability distribution called a kick probability distribution by using kernel density estimation for reducing the computational complexity. The other is to see whether the distance metrics conform to human subjectivity on the similarity between any two kick distributions.

The dissimilarity (or the distance) between two kick distributions is measured by calculating EMD, \(L^2\) distance and Jensen-Shannon (JS) divergence. In order to check whether these dissimilarity metrics agree with the human subjectivity, we use a paired comparison method in questionnaires and analyze them quantitatively. This paper examines the relationship between dissimilarity evaluation of human-subjective and dissimilarity analysis using kick distribution by calculating rank correlation. This allows us to show the effectiveness of using kick distributions as a method to calculate the dissimilarity in the team behavior in the same way as the human evaluate it.

2 Similarity in Team Strategies

Team strategy can be represented by the combinations of taken actions (e.g., passes and dribbles) and positional roles (e.g., forward and defender). This paper focuses on the actions taken by the players during games. The positional role is not discussed and left for future research.

In the RoboCup soccer 2D simulation, various strategies are developed by various teams. It is generally accepted that there is no perfect strategy which works well against any others. Thus, teams should adapt themselves by switching their strategies according to their opponent. In order to achieve this strategy switching, it is necessary to distinguish the strategies by similarity analysis. The similarity analysis can be also used to predict the game result (i.e. win or lose) with an assumption that both teams keep using their current strategies for the rest of the game. Based on the prediction result, we can switch the team strategy to more appropriate one which leads the team to win the game against the opponent team with a higher probability. Thus, the similarity analysis of team strategies is useful and necessary to increase the winning rate of the team.

The similarity between two team strategies is based on the similarity metrics between the corresponding kick distributions that are generated by the teams [8]. A kick distribution of a team is generated by collecting all kicks made by the team during the course of the game. An action trajectory (or an episode) is defined as a set of sequential actions by the team starting from the time when the team firstly intercepts the ball and ending with the time when the ball is intercepted or is delivered into the opponent penalty area. Figure 1 shows an example of such action trajectories. In this figure, dots represent the points where the ball was kicked during a game. The points are connected with a line if they were sequentially executed in an episode.

2.1 Kick Distribution

A kick distribution is a set of kicks that are executed during a game. Each kick includes the following information: (i) The position in the soccer field where the action was taken, and (ii) the movement length of the ball that was brought by the kick. Thus, each kick is represented by a three-dimensional vector (i.e., xy-coordinate of the kick point in the soccer field and the distance made by the kick). Figure 2 shows the kick distribution that is converted from the action trajectories shown in Fig. 1. In Fig. 2, the height of the poles represents the distance made by the kicks, and the position of the poles shows the place where the ball was kicked.

The high computational time and a large amount of data become necessary to assume distributions as the dimensionality increase. In this paper, we assume that the kick distributions will be utilized for tactical analysis in an online manner, thus we only employ the absolute value of the kick point and the movement length of the ball to avoid the problem. In addition, another reason is that the kick distributions in the previous research [8] were expressed in the same say.

Fig. 1.
figure 1

An example of action trajectories

Fig. 2.
figure 2

Converted kick distribution from Fig. 1

2.2 Kick Probability Distribution

As the kick distribution is a collection of individual kicks, it is time-consuming to calculate the distance (or dissimilarity) between two kick distributions. This is because the calculation involves individual consideration of the kicks in the kick distribution. In order to calculate the distance efficiently, we propose to convert a kick distribution to a continuous probability distribution represented. Kernel Density Estimation (KDE) is employed for this purpose. KDE is a non-parametric method to estimate the probability density function of a population from a sample. In the KDE process of this paper, three-dimensional Gaussian kernels are used as each kick is represented by a three-dimensional vector.

Let us define \(p(\varvec{b}, w_{\varvec{b}})\) as the probability that the kick is executed at the position \(\varvec{b}\) with the distance \(w_{\varvec{b}}\). This probability is estimated by KDE using a set of Gaussian functions. We show the kick probability distribution in Fig. 3(a) and (b). These figures were generated by converting from the kick distribution shown in Fig. 2. Since it is not possible to graphically show the three-dimensional probability density function, Fig. 3(a) shows the kick probability distribution on the condition that the ball was kicked at the position \(\varvec{b} = (0.0, 0.0)\), and the kick probability distribution in Fig. 3(b) shows the probability density at the distance \(w_{\varvec{b}}=5.0\).

Fig. 3.
figure 3

Kick probability distribution

3 Distance Metrics for Kick Distributions

In order to measure the dissimilarity between two kick distributions, we use three distance metrics to compare. The problem here is how to calculate such distance metrics. The following subsections present the three distance metrics considered in this paper.

3.1 Earth Mover’s Distance

The number of data points in kick distribution is not constant because the number of kicks in a game is variable. Thus, it is not possible to use a straightforward approach for calculating the distance between two kick distributions. Earth Mover’s Distance (EMD) [9] is such a metric to measure the dissimilarity between two sets that may have different number of data points. This distance metric is defined as a solution of a transportation problem where one kick distribution is seen as a set of suppliers with the amount of available goods while the other distribution is seen as a set of consumers with a limited capacity. Both of these sets include the positions of suppliers and consumers. The transportation cost for one unit of goods is usually defined as the distance between a supplier and a consumer. The task here is to find the best assignment of the goods with the least transportation cost.

Let us consider the calculation of the distance between two kick distributions P and Q. It is assumed that each of the two distributions P and Q are represented as a set of weighted data points. That is, \(P=\{({\varvec{p}}_1,w_{\varvec{p}_1}),\ldots ,\) \(({\varvec{p}}_m,w_{\varvec{p}_m})\}\). We also assume that each data point in distribution P consists of d features (in our case, \(d=3\)). The i-th data point \(\varvec{p}_i\) has a weight \(w_i\). Likewise, the other distribution Q is assumed to be a set of n data points (i.e., \(Q=\{({\varvec{q}}_1,w_{\varvec{q}_1}),\cdots ,({\varvec{q}}_n,w_{\varvec{q}_n})\}\)). EMD between P and Q can be calculated even though the number of data points is different from each other.

Let us denote the ground distance between two data points \({\varvec{p}_i}\) and \({\varvec{q}_j}\) as \(d_{ij}\). In this paper, Euclidean distance is used as the distance between two data points. By calculating the distances for all combinations, we can obtain a ground distance matrix \(\mathbf{D}=[d_{ij}]\). Let us define the transportation amount of goods from \({\varvec{p}}_i\) to \({\varvec{q}}_j\) as \(f_{ij}\). Then, we have a transportation matrix \(\mathbf{F}=[f_{ij}]\). EMD is calculated as the transportation amount \(\mathbf{F}^*\) that minimizes the cost function in Eq. (1). The formulation of the optimization with a cost function W is defined in Eq. (2).

$$\begin{aligned} \mathbf{F}^*= \arg \min _{f_{ij}} \mathrm{W}, \end{aligned}$$
(1)
$$\begin{aligned} \mathrm{W}=\sum ^{m}_{i=1}\sum ^{n}_{j=1}d_{ij}f_{ij}. \end{aligned}$$
(2)

The restrictions in the minimization of the cost function W are as follows; \(f_{ij} \ge 0 ( 1 \le i \le m, 1 \le j \le n )\); \(\sum ^{n}_{j=1}f_{ij} \le w_{\varvec{p}_i} ( 1 \le i \le m )\); \(\sum ^{m}_{i=1}f_{ij} \le w_{\varvec{q}_j} ( 1 \le j \le n )\); \(\sum ^{m}_{i=1}\sum ^{n}_{j=1}f_{ij} = \mathrm{min}(\sum ^{m}_{i=1}w_{\varvec{p}_i},\sum ^{n}_{j=1}w_{\varvec{q}_j}).\)

EMD between the distributions P and Q is determined with the optimal transportation matrix \(\mathbf{F}^*=[f_{ij}^*]\) as follows:

$$\begin{aligned} \mathrm{EMD}(P,Q) =\frac{\displaystyle \sum ^{m}_{i=1}\sum ^{n}_{j=1}d_{ij}f_{ij}^*}{\displaystyle \sum ^{m}_{i=1}\sum ^{n}_{j=1}f_{ij}^*}. \end{aligned}$$
(3)

A metric \(d(\cdot , \cdot )\) is defined as a distance when the following conditions are satisfied for any xy,  and z; (a) non-negative \(d(x,y) \ge 0\); (b) non-degenerate \(d(x,y)=0 \Leftrightarrow x = y\); (c) symmetry \(d(x,y)=d(y,x)\); (d) triangle inequality \(d(x,z) \le d(x,y) + d(y,z)\).

There are some problems in applying EMD to RoboCup environment. By definition, the value of EMD always satisfies the properties (or axioms) of distance (a) and (c). On the other hand, (b) and (d) hold only when the total weights in the supplier group and those in the consumer group are exactly the same. In the case of the RoboCup soccer, these conditions are not usually satisfied. More concretely, the non-degenerate and the triangle inequality of EMD for kick distribution does not holds in almost all the time. Another problem in EMD is that the computational cost becomes intractably high with the number of data points. Therefore, EMD cannot work in an online manner.

3.2 \(L^2\) Distance

Another distance metrics for distributions is known as \(L^2\) distance. This subsection consider the \(L^2\) distance a distance measure between two kick distributions. This distance measure uses probability density functions \(p({\varvec{x}})\) and \(q({\varvec{x}})\) and is defined as follows.

$$\begin{aligned} L^2(p, q) = \int (p({\varvec{x}}) - q({\varvec{x}}))^2d{\varvec{x}}, \end{aligned}$$
(4)

where the probability density functions \(p({\varvec{x}})\) and \(q({\varvec{x}})\) are the kick probability distributions obtained from kick distributions by KDE (in Sect. 2). The \(L^2\) distance satisfies the properties of distance, that is, (a), (b), (c) and (d) that are discussed in the last subsection.

3.3 Jensen-Shannon Divergence

Jensen-Shannon (JS) divergence is known as another metric between probability distributions. The distance between the probability density functions \(p(\varvec{x})\) and \(q(\varvec{x})\), using the JS divergence is obtained as follows:

$$\begin{aligned} D_{JS}(p||q)=\frac{1}{2}D_{KL}(p||\frac{p+q}{2})+\frac{1}{2}D_{KL}(q||\frac{p+q}{2}), \end{aligned}$$
(5)

where \(D_{KL}\) is Kullback-Leibler (KL) divergence obtained by Eq. (6)

$$\begin{aligned} D_{KL}(p||q)=\int p({\varvec{x}})\mathrm{log}\frac{p({\varvec{x}})}{q({\varvec{x}})}d{\varvec{x}}. \end{aligned}$$
(6)

By putting \(M=\frac{p+q}{2}\), we have

$$\begin{aligned} \begin{aligned} D_{JS}(p||q)&= \frac{1}{2}D_{KL}(p||M)+\frac{1}{2}D_{KL}(q||M) \\&= \frac{1}{2}\int p({\varvec{x}})\mathrm{log}\frac{p({\varvec{x}})}{M({\varvec{x}})}d{\varvec{x}} + \frac{1}{2}\int q({\varvec{x}})\mathrm{log}\frac{q({\varvec{x}})}{M({\varvec{x}})}d{\varvec{x}}. \\ \end{aligned} \end{aligned}$$

Note that the probability density functions \(p({\varvec{x}})\) and \(q({\varvec{x}})\) are the kick probability distributions described in Subsect. 2.2. JS divergence has properties of distance (a), (b) and (c), but does not satisfy (d).

4 Experiment

We would like to know whether the distance metrics for kick distributions are suited to human subjectivity. Through numerical experiments, the similarity of action trajectories is calculated by using the distance measures described in Sect. 3. In addition, we conduct a questionnaire to verify how much these dissimilarity measures in Sect. 3 agree with the human subjectivity. We also compare the calculation time of the three different distance measures.

Note that it might be faster to calculate the distance using the kick distributions than using the kick probability distributions when the number of data points in the kick distribution (i.e., the number of kicks) is extremely small. In this paper, we assume that the kick distribution has so a large amount of data points that the calculation on the kick distribution is computationally unfeasible.

4.1 Experimental Settings

In the numerical experiments in this section, the dissimilarity between two action trajectories is calculated by using the distance between the corresponding kick (or kick probability) distributions. Action trajectories are extracted from logs of those games where the following seven teams played against a well-known base team agent2D [10].

figure a

The above teams are top teams in the world competitions of RoboCup Soccer Simulation 2D League. The action trajectories of HELIOS2018 playing against agent2D are set as target action sequences. The task of the experiment participants is to evaluate how close the strategies of the seven teams are to those of the target team (in our experiments, the target team is HELIOS2018). Note that Team D is actually the target team, which means that the experiment participants are expected to identify Team D as the target team. Note also that the action trajectories of Team D are different from those of the target teams because different game logs are used to extract the action trajectories.

The action trajectories for each team are extracted from logs of five games against agent2D. The distance between the action trajectories of Teams A\(\sim \)G and the target trajectories is calculated by using the kick distributions in the case of EMD. For the other distance measures (i.e., \(L^2\) distance and JS divergence), the probability density functions generated by the KDE method are used. The value of the distance is expected to be small when the corresponding two action trajectories (i.e., the corresponding team strategies) are close to each other. In the numerical experiments of this section, a paired-comparison method is used in order to verify whether the similarity matches with the human subjectivity. In our numerical experiments, the paired comparison is performed where “similarity to the target team” is evaluated by the experiment participants. In a questionnaire, each experiment participant answers the degree of similarity between two teams in one of the nine scale ratings as shown in Fig. 4.

Fig. 4.
figure 4

Nine scale rating for evaluating the similarity between two action trajectories

In the paired comparison method, the experiment participants should pick up one scale out of them for each combination of the action trajectories. That is, the experiment participant subjectively selects one scale regarding how close Team i is to the target team in comparison to how close Team j is to the target team (for \(i \ne j\) in A\(\sim \)G). For each scale, the point is assigned and used for summarizing later.

For example, if the selected scale corresponding to “Team A is more similar to the target team than Team B”, nine points are added to A\(\rightarrow \)B and 1/9 points are added to B\(\rightarrow \)A. By continuing this procedure for all combinations, we can obtain a \(7 \times 7\) pairwise comparison matrix \({\varvec{A}}\). Then, the principal eigenvector \({\varvec{w}}\) for the principal eigenvalue \(\lambda _{max}\) of the paired comparison matrix \({\varvec{A}}\) is obtained. The principal eigenvector normalized by \(\sum _{i = 1}^{n}w_i=1\) is treated as the similarity. In this way, similarity evaluations of the human subjectivity between the target trajectories and each team’s ones are calculated quantitatively.

We rank the “similarity to the target trajectory” according to the dissimilarity between the target and each team’s trajectories. The rank correlation are calculated by the four types of distance metrics, EMD, \(L^2\) distance, JS divergence and human subjectivity. By using the calculated correlations, we show the effectiveness of kick distributions in calculating the similarity of action trajectories.

The rank correlation is calculated using Spearman’s rank correlation coefficient. Spearman’s rank correlation coefficient \(r_{xy}\) is obtained by the following equation:

$$\begin{aligned} r_{xy} = 1 - \frac{6}{n(n^2-1)} \sum _{i=1}^{n}(x_i - y_i)^2, \end{aligned}$$
(7)

where each of x and y represents one of the four distance metrics, i means each team from which action trajectories are extracted, and n is the number of the experiment participants. That is, \(x, y \in \{\mathrm{EMD}, L^2\ \mathrm{distance}, \mathrm{JS~divergence}\), \(\mathrm{human~subjectivity}\}\), \(i \in \{\mathrm{A, B, C, D, E, F, G}\}\) and \(n=7\).

4.2 Experimental Results

The action trajectories that are used in the questionnaire are shown in Fig. 5(a)–(g). These are only a subset of the action trajectories that were presented during the questionnaire. In the experiments with the experiment participants, five figures (which correspond to five games) are presented for each team.

One of the action trajectories by the target team is already shown in Fig. 1. The calculated distances between the kick distributions using the three types of distance metrics and their rank of similarity are presented in Table 1(a)–(c). From these results, we can see that the distances between the kick (probability) distributions of the target and ones of the Team D (same as the experimental setting of the target) is the smallest for any distance metrics. This demonstrates the validity of using kick distributions for similarity analysis. We can also see from Fig. 1 that kick distributions consider strategic positioning of the players without the ball possession. For example, Team A (i.e. Fig. 5(a)) have asymmetrical strategy by assigning offensive players to the upper side in the soccer field.

Table 2 shows the calculated similarity between each of the seven teams and the target team for all the experiment participants. Note that this table shows the similarity, not dissimilarity. In addition, Fig. 6 depicts the box plot of the similarities between the target and each team’s action trajectories using human subjectivity. We can see that most of the experiment participants have evaluated the action trajectories of Team D (or Team C, E) as close to the target team. On the other hand, we can also see that there is a large variances in the evaluations among the experiment participants. The Consistency Index (C.I.) tended to be high when the similarity of the action trajectories was measured by the paired comparison method as shown in Table 2. Generally, the consistency is very low when C.I. is very high (\({\ge }0.15\)). Therefore, we found that it was difficult for humans to measure the similarity of action trajectories. Table 1(d) shows the average value of the similarities obtained by the eigenvectors in the paired comparison metrics of all experiment participants. We can find that the results with a high similarity when using the same team (HELIOS2018) as the target is obtained for the setting regardless the distance metrics. Even consistent evaluation is difficult with human subjectivity.

We can see that EMD and JS divergence have a positive correlation with the human subjectivity. We also find that \(L^2\) distance has a weak correlation as compared to the other distance metrics. Therefore, it is shown that there is no significant difference between similarity analysis of action trajectories by kick distributions and human subjectivity for the evaluation of the similarity. That is, the presented way of calculating the dissimilarity between action strategies using kick distribution agrees with human subjectivity.

We now discuss the relationship between the rank correlation and the computational time to calculate the distances. These are shown in Table 3. We can see that the calculation time and the computational cost can be significantly reduced in the distance metric by using the continuous kick probability distributions as compared to the discrete kick distributions. Thus, it is possible to analyze the dissimilarity more quickly by converting the discrete kick distributions to the continuous ones when calculating the distance between kick distributions during a game in an online manner.

Fig. 5.
figure 5

Kick sequences extracted from the teams (excerpt)

Table 1. Calculated similarities of action trajectories
Table 2. Calculated similarity with the human subjectivity
Table 3. Spearman’s rank correlation and calculation time
Fig. 6.
figure 6

The similarity in action trajectories using human subjectivity.

5 Conclusions

In this paper, we calculated the distance between kick distributions for dissimilarity analysis of action trajectories. We used EMD, \(L^2\) distance, and JS divergence as metrics for the distance between kick distributions. In order to show the validity of kick distributions for the similarity analysis, we compared the proposed similarity analysis methods with the human subjective evaluations.

The human subjective evaluations for the similarity of the action trajectories were calculated by using a paired comparison method. We showed that our similarity analysis methods have a positive correlation with the human subjectivity. Thus, we also showed that our method has the validity for the similarity analysis. Another contribution of the paper is that the calculation time can be reduced by using the continuous kick probability distributions.

For future work, we will consider a new similarity analysis method that can distinguish kick directions. Moreover, we will apply the proposed method to other experimental environment.