# Application of Machine Learning in the Identification and Prediction of Maritime Accident Factors
## 2 Materials and Methods
### Neural Networks  
Once the behaviour of these accidents is understood, it is the time to define a model that may let us predict the probability of an accident and to propose a control system that lets us, by altering some of the main variables, prevent the accident. Different statistical curve-fitting processes were developed in the past with a decreased determination factor. Based on the machine learning tools, it was proposed to train a neural network that may predict the type of accident. The software employed for curve fitting was Matlab 2024 in its most recent version. In consequence, a feedforward neural network was trained, validated and tested with the sampled data (three predictors (length, beam and minimum crew) to define the type of accident. In particular, a 10-layer neural network was employed, and the training algorithm was the stochastic gradient descent (sgd) with a learning rate drop factor of 0.1. As a result, the error of this network is shown in Figure 10. These clusters are the most common and show a general tendency to not meet the minimum crew members, and its difference is in the year of construction. Finally, the clusters related to meeting the minimum number of crew members are the remaining surfaces in the three figures. In general terms, it can be concluded that each cluster is associated with each type of accident and the number of crew members. From Figure 10, it can be concluded that most cases are within an error of 2 points at the time to predict the type of accident. To understand the behaviour of this neural network, curve fitting of each training, validation and test process is represented in Figure 11 by randomly employing 70% of the 300 accidents in the training, 15% for validation and 15% of the input data for testing, respectively. From Figure 11, it can be concluded that the neural network has adequate precision with a determination factor of 0.64 in the training process and 0.60 in general, which ensures a decreased overtraining of the network as an interesting predictive tool. By increasing the number of relevant variables (year construction, wind force, night-time, length, beam and minimum crew) to define the type of accident, an increase in the accuracy and the determination factor was obtained, as is shown in Figures 12 and 13. From Figure 12, it can be observed that errors are more concentrated and decreased with respect to the target values, with a clear increment in the accuracy of the neural network. Figure 12: Error histogram of the trained neural network. Figure 13: Curve fitting of the training, validation and test processes. From Figure 13, it can be observed that the determination factor of the training process is higher than before (0.67) and increases the general determination factor (0.63) but maintains higher validation and test values, which ensure decreased overfeeding. Once the neural network of the process was obtained with a high accuracy, it was proposed to obtain a three-dimensional understanding of the accidents and, in the posterior section, to develop an artificial intelligence that lets us know if we are near or far from an accident. To accomplish this, we obtain a graphical 3D representation of a constant value of wind force 3 (gentle breeze), construction year of 2000, accident during the day hours (1) and a beam of 20 m, in accordance with the highest frequency obtained previously in the figures. In consequence, a combination of ship lengths from 10 to 300 m and different conditions of minimum crew members (codes from 1 to 5) were simulated and represented in a 3D chart. In consequence, 1140 simulations were completed, and it was possible to develop 3D charts, as shown in Figure 14.  
From this figure, it can be concluded that values of 1 and 5 of the minimum crew members are related to complying with the requirements and types of accidents like list and stranded and flooding and grounding, respectively.