## 5 First Medal Prediction Model (FMPM)
### Construction of the Neural Network Model  
A neural network is a computational model inspired by biological nervous systems, which is widely used in machine learning tasks such as pattern recognition, classification, and regression [9; 10]. It has a powerful nonlinear modeling ability and performs excellently in prediction tasks, such as financial market prediction and medical diagnosis.  
In this study, a three-layer fully connected neural network is employed to predict the probability of winning Olympic medals [37]. Features are utilized to capture the complex relationships between these factors and the medal-winning results. The implementation is carried out using the TensorFlow framework, and the pseudo-code is as follows:  
Algorithm 1 describes the process of constructing and training a three-layer fully connected neural network to predict the probability of winning Olympic medals. The visualization result of the structure is shown in Figure 13. Lines 1-14 define the model structure, which consists of layers with 64, 32, and 1 neuron, respectively. The ReLU and Sigmoid activation functions are used, and Dropout (with a dropout rate of 0.2) is introduced to prevent overfitting. Lines 15-18 configure the model, using the Adam optimizer and binary cross-entropy loss. Lines 19-29 outline the training process, which iterates for 50 epochs with a batch size of 32. The parameters are updated through back propagation, and the validation metrics are tracked. This algorithm effectively learns the relationship between the features and the medal results.  
Figure 13: Neural network hierarchical structure diagram.  
```
Input: Training data \(X_{\text{train}}\), labels \(y_{\text{train}}\), test data \(X_{\text{test}}\), labels \(y_{\text{test}}\), epochs \(E=50\), batch size \(B=32\) Output: Trained neural network model \(NN\), training history \(H\) (loss and accuracy)
1 Step 1: Initialize the model structure
2 Initialize \(NN\) as a sequential neural network
3 Add input layer:
4 - Number of neurons: 64
5 - Activation function: ReLU
6 - Input dimension: 3
7 Add dropout layer (dropout rate: 0.2) // Prevent overfitting
8 Add hidden layer:
9 - Number of neurons: 32
10 - Activation function: ReLU
11 Add dropout layer (dropout rate: 0.2)
12 Add output layer:
13 - Number of neurons: 1
14 - Activation function: Sigmoid // Output probability of winning a medal
15 Step 2: Compile the model
16 Set optimizer to Adam (learning rate \(\eta=0.001\))
17 Set loss function to binary cross-entropy \(L=-\sum_{i}(y_{i}\log(\hat{y}_{i})+(1-y_{i})\log(1-\hat{y}_{i}))\)
18 Set evaluation metric to accuracy \(A=\frac{TP+TN}{TP+TN+FP+FN}\)
19 Step 3: Train the model
20 Initialize training history \(H\leftarrow\{\}\)
21 forepoch\(\leftarrow\) 1 to Edo
22 Divide \(X_{\text{train}}\) into batches of size \(B\)
23 foreach batch \((X_{\text{batch}},y_{\text{batch}})\)do
24 Forward pass: Compute predictions \(\hat{y}_{\text{batch}}=NN(X_{\text{batch}})\)
25 Compute batch loss \(L_{\text{batch}}\)
26 Backward pass: Update \(NN\) parameters (using Adam optimizer)
27 Compute validation accuracy \(A_{\text{val}}\) and loss \(L_{\text{val}}\) on \((X_{\text{test}},y_{\text{test}})\)
28 Record \(H[\text{epoch}]\leftarrow(L_{\text{batch}},A_{\text{val}},L_{\text{val}})\)
29 return\(NN\), \(H\)
```  
**Algorithm 1**Fully connected neural network (FCNN) training.