Research on Ship Resistance Prediction Using Machine Learning with Different Samples

: Resistance serves as a critical performance metric for ships. Swift and accurate resistance prediction can enhance ship design efficiency. Currently, methods for determining ship resistance encompass model tests, estimation techniques, and computational fluid dynamics (CFDs) simulations. There is a need to improve the prediction speed or accuracy of these methods. Machine learning is gradually emerging as a method applied in the field of ship research. This study aims to investigate ship resistance prediction methods utilizing machine learning across various datasets. This study proposes two methods: employing stacking ensemble learning to enhance resistance prediction accuracy with identical ship samples and utilizing various ship resistance prediction models for accurate resistance prediction through transfer learning. Initially focusing on container ships as the research subject, the stacking ensemble learning model outperforms the basic machine learning model, the Holtrop and Mennen method, and the updated Guldhammer and Harvald method based on comparative prediction results. Subsequently, the container ship resistance prediction model achieves precise resistance prediction for bulk carriers. This study offers dependable guidance for applying machine learning in predicting ship hydrodynamic performance.


Introduction
As one of the paramount performance aspects of ships, resistance necessitates prioritization in ship design.It holds significant importance in the research of ship resistance prediction methods.
After over a century of research, model tests, estimation methods, and computational fluid dynamics (CFDs) simulations have emerged as three commonly employed approaches for determining ship resistance.Model tests, being the initial method employed for ship resistance prediction, are esteemed for their reliability.However, the outcomes of model tests can be influenced by various factors, including model geometry and test installation.ITTC gives recommended procedures and guidelines for model tests [1].Estimation methods encompass a range of techniques such as standard series, Ayre, Lap-Keller, admiralty coefficient, statistical regression, and empirical equations.These methods are developed utilizing data from both model tests and actual ship sailing.Each estimation method is tailored to suit different ship types.Savitsky's [2] method is suitable for calculating resistance in planning chine ships.The resistance of displacement ships can be calculated using the Hollenbach [3] and Holtrop and Mennen [4] methods.Calisal and Dan [5] proposed a resistance calculation method for smaller displacement ships with a small length/breadth ratio.Robinson [6] proposed a resistance calculation method for planning chine and round-bilge ships.These estimation methods have still been commonly used in recent years [7][8][9][10].Some older estimation equations are updated with newer ship data.Kristensen and Bingham [11] proposed an updated Guldhammer and Harvald method based on the model tests of newer ships.Tu et al. [12] modified the admiralty coefficient to estimate power curves in EEDI calculations accurately.Crudu et al. [13] modified the bulb immersion in the Holtrop and Mennen method to estimate the resistance of a 3700 dwt chemical tanker.CFDs simulations offer a viable alternative to towing tank tests [14] and are widely used in ship resistance prediction [15][16][17][18].The factors that affect the CFDs calculation results are computational grids, turbulence models, etc. Recommended procedures and guidelines for ship CFDs applications are also given by the ITTC [19].
Everything is a double-edged sword.Ngoc Vu Minh et al. [20] mentioned that model tests can yield reliable data, but they are time-consuming and expensive and usually performed at the end of the design cycle.Resistance can be rapidly obtained using estimation methods, but the accuracy is low.CFDs methods require high computer resources, especially for high-precision results and cases where there are many examples to calculate.Ravenna Roberto et al. [21] went through a lot of tedious computer calculations when using the StarCCM+ software (version 12.02.011-R8) to investigate the heterogeneous hull roughness effect on ship resistance.Both estimation methods and CFDs methods find common use in ship design.The rapid prediction capability of CFDs methods is contingent upon the advancement of computer technology.Meanwhile, improving the prediction accuracy of estimation methods remains challenging, constrained by the availability of data and expression methods.
The objective of this study is to identify a rapid and accurate method for predicting resistance using machine learning (ML).ML exhibits a robust capability to address nonlinear and complex problems.Numerous scholars have extensively researched ship resistance prediction using ML algorithms.Margari et al. [22] used an artificial neural network to predict the resistance of a series of ships designed according to the MARAD system.The results show that the multi-layer perceptron network model can be used to predict ship resistance.Using an artificial neural network, Cepowski [23] established a prediction model for ship-added resistance.The trained neural network was presented as the form of a mathematical function.Yildiz Burak [24] trained the neural network model using experimental data from a trimaran model in order to develop a more reliable model.Ivana Martić et al. [25] built a numerical model based on the results of hydrodynamic calculations in head waves, which can estimate the added resistance of container ships with sufficient accuracy.They [26] also used an artificial neural network to predict the added resistance coefficient for container ships in regular head waves for various speeds.Mentes Ayhan et al. [27] chose an artificial neural network (ANN) and an adaptive neuro-fuzzy inference system (ANFIS) as soft computation techniques to estimate the hawser tensions and displacements of a spread mooring system and compared the results of the two methods.Ozsari Ibrahim [28] uses an artificial neural network (ANN) model to predict the main engine power and pollutant emissions of container, cargo, and tanker ships.Yang et al. [29] also studied the performances of different ML algorithms on the resistance prediction of a container ship.Elik et al. [30] proposed a data-driven hull shape optimization method and used machine learning to establish a ship resistance prediction model.
Currently, research on the application of machine learning (ML) algorithms in ship resistance prediction is inadequate.Firstly, basic ML algorithms are more commonly utilized than complex ones, yet the prediction outcomes of these basic algorithms require enhancement.Additionally, ensemble learning, which enhances the ability to generalize systems, is seldom employed.Secondly, each prediction problem is treated in isolation, necessitating a large volume of data to achieve accurate forecasting results, thus increasing the modeling complexity.Transfer learning, which can achieve precise prediction outcomes with a limited sample size based on previous knowledge or prediction models, is also underutilized.This study researches ship resistance prediction utilizing stacking ensemble learning and transfer learning.Two estimation methods, the Holtrop and Mennen and the updated Guldhammer and Harvald, are employed for comparison.The study is divided into two main parts.In the first part, four representative models-linear regression (LR), k-nearest neighbor (KNN), support vector regression (SVR), and random forest (RF)-are selected as basic machine learning (ML) models.Stacking ensemble models are then constructed using these basic models.The prediction results for container ship resistance are obtained and compared across basic ML models, stacking ensemble models, and the two estimation methods.In the second part, stacking ensemble learning models utilized for container ship resistance prediction are repurposed to predict the resistance of a bulk carrier using transfer learning.The prediction results for the bulk carrier using different methods are compared.
This study is structured into four sections.Section 2 introduces the ship data of various vessels, including the KRISO container ship (KCS), 1100-TEU, 4250-TEU, 4700-TEU, 9000-TEU, and 13,500-TEU container ships, as well as a 47,500 dwt bulk carrier utilized in this research.Additionally, it outlines the definitions of basic machine learning (ML) models, stacking ensemble learning models, transfer learning models, and estimation methods, as well as elaborates on the training process of different models.
Section 3 presents the prediction results for both container ships and the 47,500 dwt bulk carrier using different methods.Furthermore, it analyzes the similarities between stacking ensemble learning and transfer learning.
Finally, Section 4 provides the concluding remarks.

Ship Dimensions and Analysis
The ship dimensions of KCS, 1100-TEU, 4250-TEU, 4700-TEU, 9000-TEU, 13,500-TEU container ships, and the 47,500 dwt bulk carrier are shown in Table 1.The resistance data for the KCS are sourced from the Tokyo Workshop on Computational Fluid Dynamics (CFDS) in Ship Hydrodynamics [31].The resistance data for the 1100-TEU, 4250-TEU, 4700-TEU, 9000-TEU, 13,500-TEU container ships, and the 47,500 dwt bulk carrier are obtained from model tests conducted at the towing tank laboratory at the Huazhong University of Science and Technology (HUST), China.Details regarding the scale ratio of ship models and the number of test cases are provided in Table 2.The sample sizes for different ship capacities are as follows: 1100-TEU (80 samples with 8 drought and 10 velocities), 4250-TEU (120 samples with 8 drought and 15 velocities), 4700-TEU (10 samples with 1 drought and 10 velocities), 9000-TEU (60 samples with 5 drought and 12 velocities), 13,500-TEU (90 samples with 10 drought and 9 velocities), KCS (5 samples with 1 drought and 5 velocities), and 47,500 dwt (42 samples with 6 drought and 7 velocities).
In this research, ship resistance is dimensionless processed using Equation (1).
here, C t represents the total resistance coefficient, R t represents total resistance, ρ represents the density of water, v represents the velocity of the ship, and S represents the wetted area of the ship.There are many different decomposition methods of the total resistance coefficient C t .Among them, the total resistance coefficient C t can be divided into the frictional resistance coefficient C f and the residual resistance coefficient C r according to Froude's assumption, shown in Equation (2).
where C f is related to the Reynold number (Re) and can be obtained using Equation (3).
Currently, estimating C r accurately remains challenging.The accurate prediction of C r is the key to obtaining C t .According to the causes of resistance, C r can be divided into the viscous pressure resistance coefficient C pv and the wave-making resistance coefficient C w , and is in relation to the Froude number (Fn) and ship shape, shown in Equation (4).C t can be expressed using Equation (5).
Expressing the intricate details of ship shape proves challenging due to its complex surface.Many scholars have studied the relationship between hull form parameters and C pv , C w , and C r .Bafumier proposed that C pv can be expressed using Equation (6).
where A m represents the ship mid-section area, which can be expressed using the ship mid-section area coefficient C m .L r represents the length after a run.
From the perspective of wave energy, C w can be expressed as the function of Fn and ship length L wl , shown in Equation (7).
where A, B, C, and D are constant numbers.λ is the length of the wave.L wl is the length of the water line.mL wl is the length of the first crest of the bow transverse wave and the first crest of the stern transverse wave directly.
Based on the data of Taylor standard series ship models, Gertler pointed out that the breadth draft ratio B/T, prismatic coefficient C p , the coefficient of ship drainage volume and length ∇/L wl 3 , and Fn significantly influence C r .C r can be expressed using Equation (8).
In addition, statistics show that R pv is related to the block coefficient C b and the longitudinal position of the buoyancy center L cb .The waterplane shape has a significant influence on R w .C b can be expressed via the prismatic coefficient C p and the ship mid-section coefficient C m .The waterplane shape can be represented via the waterplane coefficient C wp and the longitudinal position of the flotation center L cf .
According to the related research, C r can be expressed using Equation ( 9).The parameters in Equation ( 9) are independent of each other and are used to establish prediction models in this study.
This study employs various machine learning techniques to predict C r for different types of ships.C f , generally stable, can be calculated using relevant formulas.C t is derived by summing C r and C f .

Linear Regression
LR tries to learn linear predictor functions that reflect the relationship between data features and targets through the known data [32].It has been studied rigorously and used extensively in practical applications [33].Given a sample set composed of d features, x = (x 1 ; x 2 ; . . .; x d ), y = (y 1 ; y 2 ; . . .; y i ) represents actual values.Regression of the sample set can be expressed using Equation (10).
The purpose of LR is to find a set ω * = (ω * , b * ) to minimize the difference between prediction values and actual values, as shown in Equation (11).

K-Nearest Neighbors
The KNN was developed by Evelyn Fix and Joseph Hodges as a classification method and expanded for regression by Thomas Cover [34].
The distance from the test sample and training samples is Train- ing samples are sorted according to the distance values, and the sorted training set is In the regression problem, there are two ways to calculate the prediction result.One is to take the average value of the nearest k samples as the prediction result, which means α i = 1 in Equation (12).The other is based on the distance; the weighted average of the nearest K samples is taken as the predicted value and α i is the weight of y qi in Equation (12).

Random Forest
RF [35] is an ensemble learning algorithm based on decision trees.Decision trees split data according to the contribution of attributes.The classification and regression analysis are realized through the continuous division of data.
Given a training set composed of M samples and N features, . m (m < M) samples and n (n < N) features are randomly selected from set D to form the sample set D j .The decision tree h j (x) is obtained based on D j .In the regression problem, the output value of the random forest is the average of all decision tree prediction values, shown in Equation (13).

Support Vector Regression
SVR is a sub-category of the support vector machine (SVM) where it can solve regression problems.Given a training set D = {(x 1 , y 1 ), (x 2 , y 2 ), • • • , (x m , y m )}, y i ∈ R, the aim of SVR is to find a hyper-plane f (x) = ω T x + b , so that as many training samples as possible fall within the range of ε (ε ≥ 0) from the hyper-plane, as shown in Equation (14).
where C is the regularization constant and l ε is the insensitive function of ε.

Ensemble Learning
Ensemble learning is the method of combining machine learning models to improve the learning and generalization ability of machine learning systems [36].
Stacking is a type of ensemble learning.Stacking ensemble learning usually consists of two levels of learners.The first-layer learners h 1 (x), h 2 (x), • • • , h J (x) are called individual learners, or basic learners, and the second-layer learners g(x) are called combiners.
Given a training set D = {(x 1 , y 1 ), (x 2 , y 2 ), , and a subset D k is taken as the validation set.The output C j of individual learners is shown in Equation (15). where The prediction value of x k is shown in Equation (16).
Prediction values of validation sets constitute the training set of the combiners Combiners trained using D ′ are shown in Equation (17).
The output of the stacking ensemble learning learner is shown in Equation (18).
The topology of stacking ensemble learning models used in this study is shown in Figure 1.According to the different second layer models, four stacking ensemble learning models are called ensemble-LR (E-LR), ensemble-KNN (E-KNN), ensemble-SVR (E-SVR), and ensemble-RF (E-RF), respectively.The output of the stacking ensemble learning learner is shown in Equation ( 18).'( (x), (x), , (x) The topology of stacking ensemble learning models used in this study is shown in Figure 1.According to the different second layer models, four stacking ensemble learning models are called ensemble-LR (E-LR), ensemble-KNN (E-KNN), ensemble-SVR (E-SVR), and ensemble-RF (E-RF), respectively.

Transfer Learning
Transfer learning [37] is a machine learning method in which a trained model is reused on another related task as a starting point.
Fine-tuning [38] is a popular method for realizing transfer learning.It belongs to the category of parameter-transfer learning.Transfer learning can be implemented using finetuning in two ways.In the first way, models obtained from the source domain are taken as pre-training models.The model of the pre-training model is frozen.A classification or regression network is added after pre-training models.Samples from the target domain are used to train the added network.The second way is to freeze part parameters of pretraining models and use samples from the target domain to train the unfrozen network parameters.
This research uses stacking ensemble learning models for predicting the Cr of container ships as the pre-training models for predicting 47,500 dwt bulk carrier resistance.In transfer learning, the first layer parameters are frozen, and the second layer parameters are trained using the bulk carrier data.According to the units in the second hidden layer,

Transfer Learning
Transfer learning [37] is a machine learning method in which a trained model is reused on another related task as a starting point.
Fine-tuning [38] is a popular method for realizing transfer learning.It belongs to the category of parameter-transfer learning.Transfer learning can be implemented using fine-tuning in two ways.

Estimation Methods
Two estimation methods are used in this research as comparisons.One is the Holtrop and Mennen method, and another is the updated Guldhammer and Harvald method.

Estimation Methods
Two estimation methods are used in this research as comparisons.One is the Holtrop and Mennen method, and another is the updated Guldhammer and Harvald method.
(1) Holtrop and Mennen method (H-M) J. Holtrop and G.G.J. Mennen developed the Holtrop and Mennen method for resistance and propulsion prediction based on the regression analysis of model tests and trial data of MARIN, the model basin in Wageningen, The Netherlands.In this method, the ship's total resistance can be expressed using Equation (19).
where R f is frictional resistance, 1 + k is the form factor, R app is appendage resistance, R w is wave-making resistance, R b is the resistance caused by the bulbous bow, R tr is the resistance due to immersed transom, and R a is the model ship correlation resistance.Equation ( 19) is valid for: R app and R tr are ignored in this research.Therefore, the total resistance can be expressed using Equation (20).
R f can be obtained using the ITTC-1957 equation.The sum of kR f , R w , and R b is called the residual resistance R r , shown in Equation (21).
It is a flexible process to solve k, R w , and R b .The detailed process has been described by Holtrop [4].
(2) The updated Guldhammer and Harvald method (updated G-H) In 1965~1974, Guldhammer and Harvald developed an empirical method for ship resistance based on an extensive analysis of many published model tests.Harvald presents C r as the curves of three parameters: the length-displacement ratio (M = L/∇ 1/3 ), C p , and Fn.Guldhammer proposed the regression equation in 1978 based on the analysis of C r curves, shown in Equation (22).
Considering the impact of hull form, bulbous bow, and position of L cb , C r is corrected, as shown in Equation (23).
where the corrected resistance caused via L cb is ignored.In recent years, the shape of the bulbous bow has changed greatly.New C r correction equations caused by the bulbous bow are proposed by Kristensen [11].
For tankers and bulk carriers, the C r correction caused by the bulbous bow can be approximated using Equation (24).

Training Process
The training process of machine learning includes ship feature selection, data set division, model parameter tuning, and evaluation metrics.
(1) Ship feature selection In this research, Fn and the hull form parameters ∇/L wl 3 , B/T, C p , C m , C w , L cb /L wl , and L cf /L wl are taken as the input features of prediction models.C r is taken as the prediction target.C t can be obtained by summing C r and C f .
The distribution of Fn, ∇/L wl 3 , B/T, C p , C m , C w , L cb /L wl , L cf /L wl , and C r is shown in Table 3, where the italicized numbers are values of the bulk carrier.It can be seen that the distribution of features is different between the bulk carrier and the container ships.(2) Data preprocessed The preprocessed data include standardization and normalization.Data normalization involves scaling the data to fit within a specific interval or distribution.It is commonly employed when processing indicators for comparisons and evaluations, removing unit limitations, and converting data into dimensionless values.The objective of normalization is to confine the preprocessed data within a defined range to mitigate the undesirable effects of individual sample data.
(3) Data set division of container ships In machine learning, a dataset is typically split into two distinct sets, the training set and the test set, based on a predetermined proportion.This study adopts the K-fold crossvalidation method for dataset partitioning.The K-fold cross-validation approach divides the data into K mutually exclusive subsets, with each subset serving as the test set, while the remaining K-1 subsets are utilized as the training set to train the model.Subsequently, the outcomes of K models are aggregated using averaging or other techniques to determine the final model performance.
In ensemble learning, the dataset includes data from the 1100-TEU, 4250-TEU, 9000-TEU, and 13,500-TEU container ships designated as the training set.Meanwhile, the data from the 4700-TEU container ship and the KCS at the design draft serve as the test set, as illustrated in Figure 3.The training samples are partitioned into five subsets using the stratified sampling method.Each subset group is alternatively assigned as the validation set, with the remaining four subsets utilized for training.This division maintains a ratio of 4:1 between training and validation samples.
(3) Data set division of container ships In machine learning, a dataset is typically split into two distinct sets, the training set and the test set, based on a predetermined proportion.This study adopts the K-fold crossvalidation method for dataset partitioning.The K-fold cross-validation approach divides the data into K mutually exclusive subsets, with each subset serving as the test set, while the remaining K-1 subsets are utilized as the training set to train the model.Subsequently, the outcomes of K models are aggregated using averaging or other techniques to determine the final model performance.
In ensemble learning, the dataset includes data from the 1100-TEU, 4250-TEU, 9000-TEU, and 13,500-TEU container ships designated as the training set.Meanwhile, the data from the 4700-TEU container ship and the KCS at the design draft serve as the test set, as illustrated in Figure 3.The training samples are partitioned into five subsets using the stratified sampling method.Each subset group is alternatively assigned as the validation set, with the remaining four subsets utilized for training.This division maintains a ratio of 4:1 between training and validation samples.It is worth noting that the number of test samples in this research is equal to that of training samples, aiming to investigate the prediction performance of transfer learning with a small training sample size. (

5) Model parameters tuning
To achieve the best prediction performance, the parameters of the prediction models are tuned using evolutionary strategies in this research.The initial mutation strength of each model parameter is set to 2/3 of the search range, and the number of iterations is set to 200.The properties and search ranges of the parameters for the k-nearest neighbor (KNN), support vector regression (SVR), and random forest (RF) models are detailed in Table 4.  26).Both Max-RAE and the mean relative absolute error (Mean-RAE) are utilized to assess the accuracy of prediction results, expressed in Equations ( 27) and ( 28), respectively. Max Mean where Value E represents the experimental value, Value P represents the predicted value, and RAE i represents the RAE of the ith sample.

Prediction Results of Container Ships and Comparison
The C r of a 4700-TEU container ship and KCS are predicted using basic ML models (LR, KNN, SVR, and RF), stacking ensemble learning models (E-LR, E-KNN, E-SVR, and E-RF), and estimation methods (H-M, updated G-H), respectively.The prediction results and errors of C t of these two container ships using different methods are shown in Figures 4 and 5 and Table 5.

Prediction Results of Container Ships and Comparison
The Cr of a 4700-TEU container ship and KCS are predicted using basic ML models (LR, KNN, SVR, and RF), stacking ensemble learning models (E-LR, E-KNN, E-SVR, and E-RF), and estimation methods (H-M, updated G-H), respectively.The prediction results and errors of Ct of these two container ships using different methods are shown in Figures 4 and 5 and Table 5.

Prediction Results of the Bulk Carrier and Comparison
Transfer learning is a machine learning method that leverages the 'experience' gained in one domain to a similar domain to address a problem.One of its advantages is that it requires only a small amount of data to fine-tune the model, leading to better learning outcomes and reduced dependence on the number of samples.
In this study, the C r of the 47,500 dwt bulk carrier is predicted using stacking ensemble learning models (E-LR, E-KNN, E-SVR, and E-RF) trained on data from container ships, transfer learning models (T-LR, T-KNN, T-SVR, and T-RF), and estimation methods (H-M, updated G-H).The prediction results and errors associated with different methods are illustrated in Figures 6-8 and summarized in Table 6.

Prediction Results of the Bulk Carrier and Comparison
Transfer learning is a machine learning method that leverages the 'experience' gained in one domain to a similar domain to address a problem.One of its advantages is that it requires only a small amount of data to fine-tune the model, leading to better learning outcomes and reduced dependence on the number of samples.
In this study, the Cr of the 47,500 dwt bulk carrier is predicted using stacking ensemble learning models (E-LR, E-KNN, E-SVR, and E-RF) trained on data from container ships, transfer learning models (T-LR, T-KNN, T-SVR, and T-RF), and estimation methods (H-M, updated G-H).The prediction results and errors associated with different methods are illustrated in Figures 6-8 and summarized in Table 6.

Discussion
The prediction results of container ships show that the prediction errors using stacking ensemble learning models are smaller than those using estimation methods.Moreover, compared with the corresponding basic ML models, the prediction accuracy of the ensemble learning model is enhanced.For instance, the prediction results of E-LR exhibit greater accuracy than those of LR.Notably, among the basic ML models, the model with the best performance corresponds to the ensemble learning model that exhibits the best performance among all ensemble learning models.
The ranges of Mean-RAE and Max-RAE using four stacking ensemble learning models of the 4700-TEU container ship are [0.919%,1.257%] and [1.803%, 2.627%], and those of KCS are [0.915%,2.337%] and [1.461%, 2.878%].Prediction curves varied with Fn of all stacking ensemble learning models are similar and close to experimental values.In basic ML models, the ranges of prediction errors are larger compared to stacking ensemble

Discussion
The prediction results of container ships show that the prediction errors using stacking ensemble learning models are smaller than those using estimation methods.Moreover, compared with the corresponding basic ML models, the prediction accuracy of the ensemble learning model is enhanced.For instance, the prediction results of E-LR exhibit greater accuracy than those of LR.Notably, among the basic ML models, the model with the best performance corresponds to the ensemble learning model that exhibits the best performance among all ensemble learning models.
The ranges of Mean-RAE and Max-RAE using four stacking ensemble learning models of the 4700-TEU container ship are [0.919%,1.257%] and [1.803%, 2.627%], and those of KCS are [0.915%,2.337%] and [1.461%, 2.878%].Prediction curves varied with Fn of all stacking ensemble learning models are similar and close to experimental values.In basic ML models, the ranges of prediction errors are larger compared to stacking ensemble learning models.The prediction curves of the KNN, the RF of the 4700-TEU container ship, and the KNN, SVR, and RF of KCS are also similar to those of experimental values.The prediction curves of LR used for the 4700-TEU container ship and KCS are similar.This is because the prediction results of LR are determined via all training samples.The prediction curves of SVR and LR of the 4700-TEU container ship are also similar, but the prediction results of SVR are mainly affected by local training samples.In the two estimation methods, the prediction results of the updated Guldhammer and Harvald method are smaller than those of H-M.The prediction curves of the two estimation methods are similar.
The ranges of Mean-RAE and Max-RAE using the four stacking ensemble learning models for the 4700-TEU container ship are [0.919%,1.257%] and [1.803%, 2.627%], respectively, while for the KCS, they are [0.915%,2.337%] and [1.461%, 2.878%].It is observed that the prediction curves, varying with Fn, of all stacking ensemble learning models are similar and closely align with experimental values.
In contrast, the basic ML models exhibit larger ranges of prediction errors compared to the stacking ensemble learning models.Despite this, the prediction curves of certain basic ML models, such as KNN and RF for the 4700-TEU container ship and KNN, SVR, and RF for the KCS, are similar to the experimental values.The prediction curves of LR for both the 4700-TEU container ship and the KCS are also similar, as LR's prediction results are determined using all training samples.Interestingly, the prediction curves of SVR and LR for the 4700-TEU container ship are also similar, but SVR's prediction results are primarily influenced by local training samples.Among the two estimation methods, the prediction results of the updated Guldhammer and Harvald method are smaller than those of the H-M method.Nevertheless, the prediction curves of both estimation methods are similar.
Based on the comparison of errors in resistance prediction for both the KCS and the 4700-TEU container ships among the four stacking ensemble learning models, E-KNN emerges as the recommended choice for predicting the resistance of container ships.
In the prediction results for the bulk carrier, transfer learning models exhibit higher prediction accuracy compared to stacking ensemble learning models and estimation methods.The prediction curves of transfer learning models show better alignment with experimental values across different Froude numbers.Conversely, the prediction curves of stacking ensemble learning models sometimes diverge from the experimental values, indicating that models trained on data from container ships may not be suitable for predicting the resistance of the bulk carrier.Additionally, the prediction curves of the two estimation methods, H-M and updated G-H, differ, making it challenging to determine the bulk carrier resistance using these methods accurately.
T-LR is recommended for predicting bulk carrier resistance based on the comparison of errors among the four transfer learning models.
The large errors observed in the H-M and updated G-H methods may be attributed to several factors.Firstly, these methods may have limitations due to their relatively older nature, suggesting potential for further refinement and improvement.Secondly, while these methods are commonly used for estimating ship resistance across various vessel types, their application may not be optimized for specific ship types, such as container ships and bulk carriers.Consequently, the errors in prediction may be more pronounced when applied outside their typical range of application.However, in cases of insufficient data samples, resorting to traditional empirical formulas remains an effective method for resistance forecasting.
The performance of stacking ensemble learning and transfer learning models indeed appears promising, and their structures share similarities.Both methods utilize a multilayer network structure where the first layer network parameters are trained using data from container ships.However, their application and training processes differ.
In stacking ensemble learning, both training and test samples come from container ships.On the other hand, transfer learning involves training pre-existing models with container ship data and then fine-tuning them using data from a bulk carrier for re-training and testing.
The choice of input features significantly influences prediction accuracy.Stacking ensemble learning models employ a multi-layer network structure, where each layer learner aims to predict target values.This structure enhances the relationship between the prediction results of each basic learner and the target values, thus improving prediction accuracy.

Conclusions
In summary, the research on machine learning ship resistance prediction using stacking ensemble learning and transfer learning has yielded the following conclusions:

•
Novel prediction methods: The proposed methods based on stacking ensemble learning and transfer learning offer efficient and accurate means of predicting ship resistance.These methods utilize ship data containing relevant parameters to evaluate resistance, which is particularly beneficial in the early stages of ship design; • Improved accuracy for container ships: Stacking ensemble learning models outperform basic machine learning models and traditional estimation methods in predicting resistance for container ships.Among these models, E-KNN is recommended for the most accurate predictions; • Transfer learning for bulk carriers: By leveraging pre-training with stacking ensemble learning models developed for container ships, transfer learning enables accurate prediction of bulk carrier resistance even with limited data.T-LR emerges as the preferred model for this prediction task.
These findings highlight the efficacy of machine learning techniques, particularly stacking ensemble learning and transfer learning, in ship resistance prediction across different ship types.They offer valuable insights for optimizing ship design processes and improving overall performance evaluation.
By leveraging machine learning techniques, such as stacking ensemble learning and transfer learning, the accuracy of resistance prediction has been substantially improved compared to traditional methods.The smaller error rates achieved using these novel approaches demonstrate their potential for enhancing the efficiency and effectiveness of ship design processes.
Moreover, the introduction of these advanced prediction methods opens up new avenues for research and development in the field of ship intelligence.Future studies can further refine and optimize ship resistance prediction models by incorporating cutting-edge machine learning algorithms, leading to even greater accuracy and efficiency in ship design and performance evaluation.
Overall, the findings presented in this study mark a significant contribution to the field of ship resistance prediction and lay the foundation for future advancements in ship intelligence and design optimization.
x 1 , x 2 , • • • , x n represent the input features, which are Fn, ∇/L wl 3 , B/T, C p , C m , C w , L cb /L wl , L c f /L wl in this research.y 1 , y 2 , y 3 , y 4 represent the predicted C r of E-LR, E-KNN, E-SVR, and E-RF, respectively.
T C C C L L L L  in this research.1 2 3 4 , , , y y y y represent the predicted Cr of E-LR, E-KNN, E-SVR, and E-RF, respectively.

Figure 1 .
Figure 1.The topology of stacking machine learning models.

Figure 1 .
Figure 1.The topology of stacking machine learning models.

2 ,
In the first way, models obtained from the source domain are taken as pre-training models.The model of the pre-training model is frozen.A classification or regression network is added after pre-training models.Samples from the target domain are used to train the added network.The second way is to freeze part parameters of pre-training models and use samples from the target domain to train the unfrozen network parameters.This research uses stacking ensemble learning models for predicting the Cr of container ships as the pre-training models for predicting 47,500 dwt bulk carrier resistance.In transfer learning, the first layer parameters are frozen, and the second layer parameters are trained using the bulk carrier data.According to the units in the second hidden layer, four transfer learning models are marked as transfer-LR (T-LR), transfer-KNN (T-KNN), transfer-SVR (T-SVR), and transfer-RF (T-RF), shown in Figure 2. x 1 , x 2 , • • • , x n represent the input features.y 1 , y 2 , y 3 , y 4 represent the predicted C r of T-LR, T-KNN, T-SVR, and T-RF, respectively.J. Mar.Sci.Eng.2024, 12, x FOR PEER REVIEW 8 of 18 four transfer learning models are marked as transfer-LR (T-LR), transfer-KNN (T-KNN), transfer-SVR (T-SVR), and transfer-RF (T-RF), shown in Figure 2. 1 y y y y represent the predicted Cr of T-LR, T-KNN, T-SVR, and T-RF, respectively.

Figure 2 .
Figure 2. The topology of transfer learning models.

( 1 )
Holtrop and Mennen method (H-M) J. Holtrop and G.G.J. Mennen developed the Holtrop and Mennen method for resistance and propulsion prediction based on the regression analysis of model tests and trial data of MARIN, the model basin in Wageningen, the Netherlands.In this method,

Figure 2 .
Figure 2. The topology of transfer learning models.

Figure 3 .
Figure 3. Data division of container ships.

Figure 3 .
Figure 3. Data division of container ships.

( 4 )
Data set division of the bulk carrierThe K-fold cross-validation method is employed in the dataset partitioning for the 47,500 dwt bulk carrier.Six draft states (5 m, 6.2 m, 7.5 m, 9 m, 10.2 m, and 10.7 m) are considered for the bulk carrier.Among these, the data corresponding to draft states of 5 m, 7.5 m, and 10.2 m are designated as the training set, while the remaining data are allocated to the test set.Validation samples are derived from the training set utilizing the stratified random sampling method, maintaining a ratio of 2:1 between training and validation samples.

Figure 4 .
Figure 4.The predicted Ct of 4700-TEU container ship using different methods.

Figure 4 .
Figure 4.The predicted C t of 4700-TEU container ship using different methods.

Figure 4 .
Figure 4.The predicted Ct of 4700-TEU container ship using different methods.

Figure 5 .
Figure 5.The predicted Ct of KCS using different methods.

Figure 5 .
Figure 5.The predicted C t of KCS using different methods.

Figure 6 .
Figure 6.The predicted Ct of the 47,500 dwt bulk carrier using different methods at Ts = 6.2 m.Figure 6.The predicted C t of the 47,500 dwt bulk carrier using different methods at T s = 6.2 m.

Figure 6 .
Figure 6.The predicted Ct of the 47,500 dwt bulk carrier using different methods at Ts = 6.2 m.Figure 6.The predicted C t of the 47,500 dwt bulk carrier using different methods at T s = 6.2 m.

Figure 6 .
Figure 6.The predicted Ct of the 47,500 dwt bulk carrier using different methods at Ts = 6.2 m.

Figure 7 .
Figure 7.The predicted Ct of the 47,500 dwt bulk carrier using different methods at Ts = 9 m.Figure 7. The predicted C t of the 47,500 dwt bulk carrier using different methods at T s = 9 m.

Figure 7 . 18 Figure 8 .
Figure 7.The predicted Ct of the 47,500 dwt bulk carrier using different methods at Ts = 9 m.Figure 7. The predicted C t of the 47,500 dwt bulk carrier using different methods at T s = 9 m.J. Mar.Sci.Eng.2024, 12, x FOR PEER REVIEW 14 of 18

Figure 8 .
Figure 8.The predicted C t of the 47,500 dwt bulk carrier using different methods at T s = 10.7 m.

Author Contributions:
Methodology, B.Z.; Software, Y.Y., Z.Z., J.Z. and Q.H.; Validation, Q.H.; Investigation, Y.Y. and L.Z.; Resources, J.S.; Data curation, Z.Z., J.Z., B.Z. and J.S.; Writing-original draft, Y.Y. and L.Z.; Writing-review & editing, Y.Y. and Z.Z.; Supervision, J.S.All authors have read and agreed to the published version of the manuscript.Funding: The authors gratefully acknowledge the financial support from the National Natural Science Foundation of China (approval No. 12072126 and No. 51679097) and the Major Project for Special Technology Innovation of Hubei Province (Grant No. 2019AAA041).

Table 1 .
Principal dimensions of ships.

Table 2 .
Scale ratios of ship models and number of test cases.

Table 3 .
Distribution of samples.The italicized numbers are the bulk carrier values, and the upright numbers are the values of container ships.

Table 4 .
The parameter properties and search range of the KNN, SVR, and RF models.In this research, the maximum relative absolute error (Max-RAE) is employed for training prediction algorithms to mitigate the influence of the actual value on model training, as depicted in Equation (

Table 5 .
The prediction errors of Ct of 4700-TEU container ship and KCS using different methods.

Table 5 .
The prediction errors of C t of 4700-TEU container ship and KCS using different methods.

Table 6 .
The prediction errors of Ct of 47,500 dwt bulk carrier using different methods.

Table 6 .
The prediction errors of C t of 47,500 dwt bulk carrier using different methods.