## 2 Materials and Methods
### Procedure
#### 2.3.2 Data Processing  
Dataset  
The dataset consisted of the following variables:  
Independent variables:  
* Court side: Side of the court from where the serve is played. This variable was used to divide the dataset and perform the analysis for each side of the court.
* Effectiveness: -  
Type 1: The point finishes with one shot.  
-Type 2: The point finishes with two shots.  
-Type 3: The point finishes with three shots.  
-Type 4: The point finishes with four shots.  
Dependent variables:  
* Speed: Mean speed of the serve.
* Position: Position of the server when hitting the serve (A in Figure 2).
* Time: Time between ball impact and ball bounce.
* Speed loss: Loss of speed of the ball after its bounce.
* Impact Z: Height of the ball at impact.
* Net clearance: Height of the ball when passing over the net.
* \(\delta\): Serve angle (Figure 2).
* \(\beta\): Vertical projection angle.
* dL: Distance from ball bounce to the sideline of the service box  
Figure 1: Pipeline workflow architecture.  
process, commonly known as \"babysitting\", through the application of beneficial callbacks such as a state-of-the-art learning rate finder, early stopping, and model checkpointing.  
The backbone architecture for the deep learning model and the loss function included in the following steps are the following:  
Backbone Network: A tabular model with 5 layers of feature size: 256, 128, 128, 128, 64. The basic layer block (named LinBnDrop) is formed by the following transformations:  
Linear Layer (torch.nn.linear);  
Rectified Linear Unit--ReLU (torch.nn.relu);  
Batch Normalization--BatchNorm1d (torch.nn.BatchNorm1d).  
The determination of the optimal number of layers and feature size were driven by experimentation. A standard backbone for tabular data was initially employed in the investigation. For the dataset under consideration, it was observed that a shallow deep neural network (DNN) possessed an adequate capacity to extract relevant patterns. The introduction of additional layers resulted in overfitting the model, whereas a reduction in the number of layers led to underfitting. Similar considerations were applied to feature sizes, commencing with a standard size and subsequently adjusting them iteratively until the size yielding optimal performance on the dataset was identified.  
Loss function: Focal loss flat [36]. The focal loss works especially well with imbalanced data as it adapts its weights to focus learning on hard misclassified examples. The primary rationale behind its utilization stems from the presence of imbalanced classes in the dataset. Additionally, an exploration of the flat cross entropy loss was conducted, revealing a comparable performance to the focal loss. However, it was observed that the flat cross entropy loss exhibited a slightly diminished robustness in addressing class imbalances when compared to the focal loss on our dataset.  
Optimization algorithm: The Adam optimization method [37] was employed in this study. Adam is characterized as an adaptive learning rate optimization algorithm, with its principal hyperparameters being the learning rate and momentum. The rationale behind incorporating momentum in conjunction with re-scaling lacks clear theoretical motivation. Nevertheless, Adam is widely acknowledged for its robustness across a range of hyperparameter choices.  
Callbacks: Several callbacks were implemented to enhance training performance in this study. Early stopping was employed to halt training when the model ceased to exhibit improvement over the last epochs. The model checkpoint callback was also utilized to create copies of the model at specific intervals during training. This allowed for the subsequent selection of the best-performing model among the saved copies.