The Mathematical Model of Marine Engine Room Equipment Based on Machine Learning

This study is aimed at reducing the occurrence of oil spill accidents in the engine room of ships and carries out risk prevention for the equipment of the port ships, thereby reducing pollution to the marine ecological environment. Firstly, the concepts and principles of cluster analysis and ship automatic identi ﬁ cation system are expounded. Secondly, the data information collected by the ship ’ s automatic identi ﬁ cation system (AIS) is combined with density-based cluster analysis. The accident area and extent at di ﬀ erent stages of the ship ’ s engine room equipment are classi ﬁ ed. Finally, cluster analysis is used to evaluate the risk of equipment of the port ship engine room. The results show that there are 43000 ship operation information points in port a, the average operating speed of ships is 9 kilometers, and the fastest operation speed is 16.9 kilometers. In addition, many ship routes in port a need to take risk prevention measures to minimize the impact between ships and reduce the risk of oil leakage in the engine room. The proposed cabin model can easily and quickly analyze the orientation information of the ship and classify all the data into di ﬀ erent types according to the surrounding information points. AIS can realize the information transfer between ships and between ship and shore. Information such as the position, speed, and direction of the ship needs to be accurately known to ensure safety at sea. These data need to relate to some terminals and networks to form a maritime monitoring network. The ship AIS based on cluster analysis can cluster the areas where the ship ’ s speed and direction change signi ﬁ cantly in the port area, e ﬀ ectively preventing accidents. Scienti ﬁ c risk prevention measures can e ﬀ ectively reduce the oil leakage risk of ship engine room equipment, improve the working e ﬃ ciency of marine engines, and provide a strong foundation for the entire marine ecological environment protection.


Introduction
Since the 20th century, with the use of super large commercial ships, the pollution of the marine ecological environment caused by oil leakage in ship work has become more and more serious, which has also attracted the attention of all countries in the world. Since 1924, the United States promulgated the regulations on marine oil pollution caused by the ship oil spill. Most governments have also enacted conventions and rules on marine oil pollution. These laws and regulations have significantly reduced the oil pollution of the marine ecological environment, and the measures taken for the oil pollution of ships have changed from control to protection.
The marine oil spill is very harmful to the ocean, not only to the organisms in the sea but also to the restoration of the whole marine ecological environment. Therefore, the risk assessment of ship oil leakage equipment is also concerned by all countries [1]. At present, various electronic information devices have been used in the risk assessment of ship oil leakage equipment globally, such as GPS (global positioning system) and ship self-intelligent identification system [2]. At present, there are various ways to evaluate the risk of the data collected by electronic information devices. Analyzing the collected data is also a problem to be solved. Therefore, the clustering analysis of information mining [3] is born globally. It classifies the initially collected data and analyzes the meaning of these data.
The cluster analysis of ship engine room equipment risk assessment techniques is introduced, and the purpose and main motivation are to describe the concept and analysis method of cluster analysis. The main finding of the study is to implement a mathematical system model with an automatic ship identification function, which provides strong technical support for the entire marine ecological environment protection. This is also the main innovation point. The main problem is that there is too little detailed data on oil spills in ship engine rooms. Data can only be obtained through experimental simulation, which is also the fundamental problem of this discussion. The solution is to implement a mathematical model of ship engine room risk assessment by optimizing and improving machine learning-related algorithms combined with cluster analysis algorithms.
The overall structural logic is the following: Section 1 introduces commercial ships, and the theme is introduced through the introduction of the hazards of marine oil spills to the ocean related to the background. Section 2 implements a mathematical model for automatic identification of ship data by using the cluster analysis method combined with artificial intelligence technology. Section 3 takes port a as an example, the risk assessment level is constructed, and the corresponding measures should be taken through the case analysis of ship engine room equipment accidents. Section 4 introduces the experimental environment and the main data collection process and collects the main datasets. Section 5 draws conclusions by systematically analyzing the experimental results and expounds the content of marine ecological environment analysis. These research contents can provide the basis and direction for the risk assessment of ship engine rooms.

Recent Related Work
Many related studies have been carried out by scholars on ship engine room equipment and digital modeling technology. Yunlong et al. [4] conducted 3D design and research on ship engine room equipment based on knowledge engineering. Based on the knowledge engineering module, they studied the 3D layout design of the multipurpose cargo ship engine room. They established the classification rules of the ship engine room to improve the efficiency of knowledge acquisition. The result is as expected. The feasibility and effectiveness of knowledge engineering are verified in the 3D layout design of the ship engine room. Zhang et al. [5] designed and researched the virtual ship engine room system based on the Unity3D platform. The mathematical model of the rudder is established based on the introduction of the related concepts of the ship system. Their proposed method enhances the operating experience with the same working environment in the cabin. Park [6] used transfer learning to classify marine engine room machines. The results show that the ship's engine room has improved automation systems. Wang et al. [7] studied the condition monitoring method of marine engine room equipment based on machine learning and proposed a condition monitoring method based on manifold learning and isolation forest. They introduced the isolation forest algorithm to train and build multiple state models using standard condition data. The model has a significant reference value for detecting and repairing marine engine room equipment. Jou et al. [8] studied the bonded discrete element method of ship-ice interaction in sea ice fields. They conducted icebreaking studies on continuous horizontal ice sheets by loading a single-degree-of-freedom model of the icebreaker. The experimental simulation results verify the effectiveness of the proposed model. Cheng et al. [9] studied the data-driven modeling method of ship motion based on a neural network. They present a global sensitivity analysis method that combines artificial neural networks and sparse polynomial chaos expansion techniques. The findings can provide technical support for high-dimensional sensor data collected from ship motion. Liu et al. [10] conducted research on ship collision risk modeling based on the cloud model and developed an inference engine system based on the cloud model to assess ship collision risk. The results are used to verify the feasibility of the proposed ship collision risk modeling. Compared with the traditional ship collision risk model, the proposed ship collision risk model has the advantages of simple implementation, accurate results, and short time required to generate the risk model.
In summary, to avoid collisions with key objects during navigation, many scholars have constructed a cloud model of ship navigation based on global sensitivity and uncertainty. The model can be used in ship collision risk analysis to reduce the dimension of risk parameters and reveal the main factors of unstable collision risk [11][12][13]. However, these results are insufficient for evaluating the uncertain results in hazard calculations, making it challenging to predict accidents accurately. Therefore, the proposed risk assessment model of ship engine room combined with clustering analysis and AI can provide reasonable suggestions for basic navigation safety. In this way, marine pilots can make timely and correct decisions to reduce or avoid collisions.

Mathematical Model of Room Risk Assessment of Ship Engine Combined with Cluster Analysis and AI
During the navigation of the ship, the condition of the ship's engine room directly affects the navigation risk of the ship.
To assess the risk of the ship's voyage, firstly, the data from the ship's engine room is analyzed in detail. During the voyage of the ship, the dimension and total amount of data in the engine room will increase exponentially. Manual processing of all the data in the dataset is difficult to accomplish. Therefore, through the clustering method, the data with the same characteristics in the data is gathered in a group and analyzed and evaluated as a whole.
3.1. Cluster Analysis. Cluster analysis [14] divides the data information into relatively similar groups and then analyzes the data information of these groups. Cluster analysis is a kind of thinking mode of human beings. Its purpose is to gather and analyze information based on a comparable basis. There are many types of clustering, including digital-related data, computer information, statistical information, biological information, and economic-related information. Although they are all in different fields, they are all similar analyses of data, and similar data information is gathered. From the perspective of machine learning, clustering analysis is unsupervised learning. It depends on a predefined group or part of the data information that has been analyzed. Cluster analysis is also learning with observation property and exploration significance. At the beginning of cluster analysis, there is no need for a clustering basis model. Cluster analysis can analyze and classify according to the most original data information, and the beginning and end of clustering must be the same. Clustering analysis can be used as a feature task of data mining, which can aggregate the scattered data information and then analyze it. At present, clustering analysis includes system clustering, decomposition, addition, dynamic clustering, ordered sample clustering, overlapping clustering, and fuzzy clustering [15]. The clustering analysis calculation method is shown in Figure 1.

AIS.
Firstly, the AIS [16] is a piece of information and maritime safety intercommunication system between ships and between ships and shore. It consists of VHF (very high frequency) communication equipment, GPS, ship display equipment, sensor equipment, and other devices that can communicate. The equipment realizes the information between ships and between ships and the shore and accurately grasps the ship's position, sailing speed, direction, and other information. The AIS in the vessel can send data to the outside. The VHF equipment can accept similar information from other ships so that the ship can automatically answer. AIS is an information dissemination system that communicates with the outside world. It can connect some terminals and networks to form a marine monitoring network. In the absence of radar, AIS can effectively reduce ship traffic accidents. Among them, the main body of AIS equipment is composed of shore-based (base station) facilities and ship-borne equipment. With the help of the global positioning system, dynamic ship data such as ship position, ship speed, course change rate, and heading can be transmitted to nearby waters through high-frequency digital signals. The test information of AIS is shown in Figure 2.
In Figure 2, if the data of the automatic identification system (AIS) are similar or close to the same level, the similar data is filtered, and only the data points with the same feature in the center of the set are retained. The rest of the data information will be packed and compressed [17]. If the distance between two ship track points is less than 1/2 of the ship length, lossless data compression can be adopted to compress data signals by converting the values of all attributes of the same column in the storage column into binary groups to improve the efficiency of data transmission. The information compression process is shown in Figure 3.
Through preliminary analysis of the information of the AIS, the service identification code, operation address, and operation track point of each ship's waterborne mobile communication are known, as shown in Table 1.
The information in Table 1 is initially analyzed. Then, the form of the data is analyzed. After the data features are extracted, the similarity between the data is calculated [18]. If the extracted information is N, the calculation method is as shown in x or represents the r-dimensional information of the 0th data. 1d represents the number of samples.
The basic equations are used to calculate ship distance: Equations (2)-(4) denote different representations of the space position coordinates of the ship's distance. ðd o , d r Þ represents the distance between two ships during the voyage. The calculation of the spatial position Q op and the angle θ op of the ship's sailing distance from the port is shown in Finally, the density-based clustering algorithm is selected according to the information characteristics [19]. This clustering algorithm uses the path between the information to analyze whether the information is a unit. It can analyze the orientation information easily and quickly and significantly reduce noise to the analysis results. In the densitybased clustering algorithm, information points can divide all information into three types under the information points around them, including center points, edge points, and noise points. Its distribution is shown in Figure 4.
How to judge the area described by the information point mainly depends on two coefficients. One is the area of the information point, which is determined by the radius of the circular area. The other is the total number of other information points. The center point refers to the information point in the radius field of the circular area that exceeds the initial range value of the area, as point c shown in Figure 4. The edge point refers to the information point in the radius field of the circular area that cannot meet the initial range value of the area, as point b showed in Figure 4. The noise point refers to the information point collected that does not meet the above two situations, as point a shown in   [20]. According to the number and area of the oil leakage, the measures taken are also different. It is necessary to prepare the actions to be taken in the face of emergencies to reduce the risk of accidents. The international marine management organization has formulated a unified risk specification for ships' engine rooms [21]. The scope and quantity of all risks can be represented by a matrix, including the probability matrix and the resultant impact matrix. Different engine room accidents lead to different risk levels. The risk levels of varying engine rooms are analyzed.
Firstly, the base level of the matrix represents the risk of an accident in the ship's engine room, which is minimal, and the threat it poses is relatively tiny. Therefore, preventive measures are not needed.
Secondly, the upper part next to the base layer is the middle part of the matrix. This part has a medium probability of engine room accidents. Therefore, specific prevention measures are needed to reduce the possibility of risk.
Thirdly, the section close to the upper level has the most significant probability of accidents in the ship's engine room. Moreover, this type of accident has a significant impact on the ocean, causing severe pollution and the slow recovery of the sea. For the risk of this kind of level, reduce the risk of the upper deck to the middle tier by preventing it in advance. If the means of prevention cannot downgrade this kind of risk, it should be analyzed from the source of this kind of accident.
According to different risk levels, the required solutions are shown in Table 2.

Wireless Communications and Mobile Computing
Secondly, judge the critical areas in port a where accidents may occur.
Step 1. Judge the navigation speed of the ship. If there is a potential safety hazard, the ship will change the navigation speed. According to the specific technology, the operating rate of vessels in port a is analyzed, as shown in Figure 5.
According to the analysis of the figure, there are 43000 ship operation information points in port a. The average operation speed of the ship is 9 km, and the fastest operation speed is 16.9 km.
Step 2. Judge the ship's direction of navigation. The vessel has seven recommendations in total, and there is a 45degree difference in each order.

Density-Based Cluster Analysis Method to Process Data.
The density-based clustering method can better identify the same feature of the data and can ensure that all the data in the database can be processed. Therefore, the densitybased cluster analysis method is used to process the data during the ship's voyage. Through the analysis of AIS data and information, port a is basically from south to north and from east to west. Density-based cluster analysis is employed.
Step 1: find a relatively close information point and increase the density of the central area.
Step 2: calculate the information by density-based cluster analysis-the highdensity range where the speed and direction of ships in port a change rapidly are obtained. The navigation channels are complex in the above measurements compared with other areas. Firstly, the threshold is fixed. The threshold is generally derived from the specific ship performance of the ship sailing, and the speed and direction of the ship are regulated by the threshold [22]. After the threshold is specified, the information points of the ship's operating route that need to be calculated can be obtained. Then, density-based cluster analysis is used to perform calculations on the data to remove noise points. Clustering data for port a is obtained.
In Figure 6, the A sea area is the gathering point of ship speed and direction changes. There are many berthing areas in this sea area, these areas are scattered on the edge of the sea area, and collision accidents are very likely to occur in the process of ships entering and leaving the sea area. Therefore, ships entering and leaving the sea should reduce their speed, pay attention to changes in direction, and assess risks promptly to avoid collisions.

Risk Prevention Measures.
From the result of cluster analysis on the data obtained from the AIS of ships, it is known that many ship routes in port need to take risk prevention measures, thus minimizing the impact between vessels and reducing the risk of oil leakage in the engine room. According to the data results of the above analysis, the prevention of oil leakage accidents in the engine room of the ship can be carried out from the following aspects: (1) The computer network and radar are used to monitor the ship and provide helpful information for the vessel in motion, thus improving the ship's safety.
During the ship's operation, the communication between the vessels and the working post in the port shall be strengthened to form a real-time intelligent management system [23] (2) When the total oil volume of ships in the port exceeds 3000 tons, the port should set up prompt signal devices in the water area with high ship density, making the ships passing by or ready to stop pay attention to the current port conditions. Additionally, the silt at the border of the port shall be removed. In extreme weather, the port shall timely inform the ship of a lower speed or prohibit the vessel from passing (3) Scientific berthing specifications shall be formulated in the port's ship berthing area and anchoring water area, and the berthing application shall be made before the ship enters the port, as well as the traveling speed after entering the port. In the case of many vessels, separation measures should be taken [3] to avoid collision and oil leakage between ships, thus causing pollution to the marine ecological environment (4) The ships entering and leaving should be supervised with antipollution measures. Spot check the antipollution equipment of the vessel and prohibit the vessels with weak antipollution equipment from entering and leaving the port. The ship's antipollution equipment is mainly divided into complicated and soft equipment [24]. The hard equipment specifically includes the oil filtering device, degreasing agent, and water-oil separation device in the ship. The supervision of this equipment must be subtle and careful. The soft equipment is mainly related to norms and systems. According to different risk prevention, different prevention and solution measures are developed, reducing the risk rate of oil leakage. The international standards include Oil Pollution Prevention Certificate and Oil Pollution Emergency Plan on Board

Risk Assessment of Ship Engine Room Equipment
4.1. Experimental Environment. The sea area in ports is divided into grids, and the average speed of ships in ports is calculated to study the behavior characteristics of vessels in ports. After the data is analyzed, the grid width is defined

5
Wireless Communications and Mobile Computing as 100 m. The overall grid division of the study area is carried out with a grid of 100 m * 100 m. According to the grid width, the sea area to be studied is divided into 11457 grids. The experimental equipment adopted is a navigation simulator experimental platform. Firstly, data on the hydrological conditions of Tianjin Port are collected. Ship navigation conditions are modeled by simulating ship operations.

Dataset Collection and Data
Preprocessing. The experimental dataset is from the Maritime Comprehensive Database. When the ship is sailing, the intelligent sensors installed on the waterway will transmit the on-site ship data to the data acquisition unit through standard signals. The standard digitized signal is loaded into the server via the communication network. In addition, the data receiving equipment on the ship will be connected through the cloud server of communication network language. The processed data will be sent to the coast center server. The data is subjected to preprocessing operations. The data collected in the experiment are divided into a training set, validation set, and test set according to the ratio of 6 : 3 : 1. The data in the training set can enhance the model training, while only the data in the test set is used to obtain the final model output. The experimental dataset includes ship number, driving speed, heading, system reporting time, and ship navigation coordinates. A sample example of the dataset is shown in Table 3.

Parameter
Setting. In traditional model training, elements in the dataset with significant numerical differences may make model training difficult. For this purpose, the ship data is subjected to data tagging. The route trajectory of each ship is interpolated and smoothed. The state values of all trajectories are placed between ½0, 1. In the spatial network of nonlinear function mapping, the number of hidden nodes in each layer is set to 128. The number of iterations is set to 500, and the batch size is set to 1024. The ship's trajectory data is used for model testing. The initial learning rate is 0.001, and the learning rate decay factor is 0.95.  After cluster analysis divides all ship navigation data into information, an AI algorithm constructs ship navigation AIS. The service identification code, operation address, and operation tracking point of each ship's water mobile communication are recorded through the preliminary analysis of AIS data. Additionally, ship engine room accidents are analyzed by measuring ship speed and distance. Port a is used as an example, and the density-based cluster analysis method is used

Risk level Risk resolution
Low level In the basic situation, no measures should be taken, but the problem should be prevented from expanding. For example, the oil leakage in the ship's engine room is less than ten tons.
Medium level Take risk reduction measures, and the funds needed to be considered when using the standards, which shall not exceed the budget. For example, the amount of oil leakage in a ship's engine room is between ten and fifty tons.
High level Take all feasible measures to reduce the risk level until it reaches the medium level. For example, the amount of oil leakage in a ship's engine room is more than fifty tons.    Table 4. Therefore, the prediction error of the proposed LSTM algorithm is smaller than the other two algorithms, and the model prediction accuracy is higher.

Conclusion
Marine pollution damage caused by oil spills in ship engine rooms is not only persecution of aquatic life but also massive harm to the entire marine ecological environment. This contamination requires a very long recovery time. Effective measures must be taken to prevent oil spills in engine rooms and reduce pollution to the marine environment. Cluster analysis and artificial immune systems are presented and analyzed. Density-based cluster analysis is combined with data information collected by AIS. The risk of ship engine room accidents is classified through cluster analysis. Additionally, the speed and direction of the ships in port a are analyzed. Ships in a port are subject to accident risk management. Finally, the corresponding risk prevention measures are proposed. Port a is used as an example to assess the risk of ship engine room equipment. The results show that the adjustment of the ship's running speed and direction by the threshold significantly impacts the occurrence of oil leakage accidents in the ship's engine room. Therefore, ships should pay attention to changes in ship speed and direction when entering and leaving the sea. The risk assessment of ship engine room accidents has high value for protecting the marine ecological environment. However, some shortcomings are unavoidable. Some vessels are operating illegally in port waters, and these vessels with abnormal behavior need further behavior detection. In future research, the features of ship data in different ports are extracted to strengthen the monitoring of ship behavior.

Data Availability
The raw data supporting the conclusions of this article will be made available by the authors, without undue reservation.

Ethical Approval
This article does not contain any studies with human participants or animals performed by any of the authors.

Consent
Informed consent was obtained from all individual participants included in the study.