## 4 The Proposed Hybrid Driver Injury Severity Prediction Model
Using three different metrics, accuracy evaluates the proportion of correctly classified instances, the F1-Score evaluates the balance between precision and recall, and the ROC evaluates the model's ability to discriminate between different classes. With this proposed architecture, presented in Algorithm 1, DL and traditional ML techniques are effectively combined in terms of data preprocessing, feature selection, increased classification accuracy, and overfitting prevention. Figure 2: System architecture. ```
1 Initializeinput_dim fromX_train
2 Functioncosine_annealing(epoch,max_epochs,base_lr,min_lr):
3 Computecosine_decay using thecosine function based on the current epoch  And max_epochs. 4 Returnadjustedlearningrateusingcosine_decay. 5 Functioncreate_dnn_model():
6 InitializeSequentialmodel. 7 Addinputlayer:Dense(512,'relu'),BatchNormNormalization,Dropout(0.4). 8 Foreachhiddenlayer:
9 AddDenselayerwith512,256,128 and64 unitsandL2 regularization, respectively. 10 AddBatchNormalizationandDropout (0.4 onthefirstlayer,0.2 onsubsequentlayers). 11 Addoutputlayer:Dense(3,'softmax'). 12 CompilethemodelwithAdamoptimizer(lr=0.0001),categoricalcross-entropyloss,andmetricasf1-weighted. 13 Returnandcompilemodel. 14 Initializednn_modelbycallingcreate_dnn_model(). 15 Definecallbacksfortraining:
16 Monitorf1-weighted,stopifthereisnoimprovementfortenepochs,andrestorebestweights. 17 Usecosineannealingtoadjustthelearningrateoverepochs. 18 Traindnn_modelwithfit()usingtrainingandvalidationdata(80 epochs,batch_size=64). 19 Removethelastlayerofdnn_modelforfeatureextraction. 20 ExtractfeaturesfromX_trainandX_test. 21 InitializetheRandomForestmodelwithdefaultparameters. 22 FitRandomForestonDNNfeaturesextractedfromX_train. 23 PredictclassesonfeaturesfromX_test. 24 CalculatetheweightedF1 score. 25 UseRepeatedStratifiedKFoldwithfivesplitsand3 repeats. 26 Performcross-validationontheRandomForestmodelusingextractedfeatures. 27 PrinttheAccuracy,F1,andROCscoresachievedbycombiningDNNandRandomForestmodels. ```  
**Algorithm 1**The proposed hybrid multi-class DNN+RF algorithm. The differences between the proposed approach and the classical DL- and ML-based methods can be highlighted as follows:  
* In classic DNNs, the model performs feature extraction and classification as a single end-to-end process. In this approach, the DNN is used solely for feature extraction. The final classification is handled by an RF, leveraging the discriminative power of ensemble methods. * DL-based models are prone to overfitting, especially with smaller datasets. By using the DNN for feature extraction only, this risk is mitigated, as RF specializes in learning from pre-extracted, high-quality features. * The proposed approach incorporates the Cosine Annealing function, dynamically adjusting the learning rate during training to achieve smoother convergence and better optimization. This technique is not typically used in standard DNN implementations. * The DNN includes L2 regularization, Batch Normalization, and Dropout layers (with tailored dropout rates) to prevent overfitting and improve the stability of feature learning. * Classic RF uses raw input features directly from the dataset. In this approach, RF operates on deep features extracted by the DNN, which are likely to be more representative and discriminative. * RF typically works independently as a standalone classifier. Here, RF is part of a hybrid system, receiving input preprocessed and abstracted by a DNN, enhancing its ability to handle complex, high-dimensional data. * Classic RF often applies cross-validation directly to the raw dataset. In this method, cross-validation is performed using features learned by the DNN, effectively separating feature engineering from classification.