# Multimodal Shot Prediction Based on Spatial-Temporal Interaction between Players in Soccer Videos
## 2 Proposed Multimodal Shot Prediction in Soccer Videos
### Uncertainty-Based Event Prediction
#### 2.3.2 Loss Function  
In the proposed method, the variational distribution \(q(\mathbf{\theta}|\mathbf{\lambda})\) is optimized to be close to the true posterior distribution \(p(\mathbf{\theta}|\mathcal{D})\), as shown in Equation (13). Hence, we first employ the loss functions \(\mathcal{L}_{\text{PP}}\) given by the following equation:  
\[\mathcal{L}_{\text{PP}}=\sum_{k=1}^{K}[\log q(\mathbf{\theta}_{k}|\mathbf{\lambda})- \log p(\mathbf{\theta}_{k})]. \tag{16}\]  
This loss function is the aggregation of the first and second terms in Equation (13), that is, the difference between the variational posterior distribution and the prior distribution. Furthermore, to minimize the third term in Equation (13), which is the negative log-likelihood, it is equal to minimizing the mean-square error. Therefore, we adopt the weighted binary cross-entropy loss \(\mathcal{L}_{\text{BCE}}\) as follows:  
\[\mathcal{L}_{BCE}=\sum_{t=1}^{T}-[e^{-\text{max}(0,\frac{T_{\text{s}}-t}{ \text{IPS}})}y^{(p)}\log g_{t}^{(p)}+(1-y^{(p)})\log{(1-g_{t}^{(p)})}], \tag{17}\]  
where \(T_{\text{s}}\) represents the time of event occurrence and FPS indicates the frame rate of input video \(v\). \(\mathbf{y}=(y^{(n)},y^{(p)})^{\top}\) and \(\mathbf{\hat{y}}_{t}=(g_{t}^{(n)},g_{t}^{(p)})^{\top}\) are the target labels at the video level and the prediction probability at the time step level of training data, respectively. Here, in a positive video containing the event occurrence, it is considered that the probability of the event occurrence may be low at the beginning of a video. Therefore, by introducing the weight \(e^{-\text{max}(0,\frac{T_{\text{s}}-t}{\text{IPS}})}\), we gradually decrease the importance of the loss in the pre-event time instances as time moves away from the event moment. By using the above loss functions, we can achieve the acquisition of optimal variational approximations.  
In addition, we introduce the loss function \(\mathcal{L}_{\text{RANK}}\), which considers the prediction uncertainty as follows:  
\[\mathcal{L}_{RANK}=\text{max}(0,\text{trace}(\mathbf{u}_{t}^{ept}-\mathbf{u}_{t-1}^{ept })). \tag{18}\]  
The epistemic uncertainty \(\mathbf{u}_{t}^{ept}\) represents a measure of uncertainty about the model's predictions. Thus, by introducing this loss, it is expected that the epistemic uncertainty does not increase with time, that is, the uncertainty is reduced or stabilized as the model learns new information. As for the aleatoric uncertainty \(\mathbf{u}_{t}^{all}\), since it is a measure of the inherent variability of the latent feature's output from the GCRNN, we do not include it in the loss function in the proposed method.  
Eventually, the proposed method optimizes the prediction model by training with the combination loss function \(\mathcal{L}\), which is expressed as:  
\[\mathcal{L}=\mathcal{L}_{\text{BCE}}+w_{1}\cdot\mathcal{L}_{\text{PP}}+w_{2} \cdot\mathcal{L}_{\text{RANK}}, \tag{19}\]  
where \(w_{1}\) and \(w_{2}\) are employed to balance respective loss function values. In this way, the proposed method achieves accurate shot prediction while considering prediction uncertainty.