1. Introduction
Target prediction is the prediction of a target associated with an input based on existing data by some method. Target prediction is increasingly important in finance [
1,
2], healthcare [
3], manufacturing [
4], power [
5,
6], weather [
7], transportation [
8], etc. Excellent prediction results can identify potential risks, provide credible prediction data, and improve users’ risk management ability; it can develop executable future plans and provide decision-making support for enterprises.
Neural networks, decision trees, linear regression, polynomial regression, etc., are methods to achieve target prediction. Kim [
9] used multiple target prediction methods, conducted experiments under different numbers of features, feature types, and numbers of samples and concluded that the performance of artificial neural networks with target prediction is better under multi-categorical variable input conditions.
Overall, neural networks are the dominant model for solving target prediction problems at this stage. It is important to note that neural network models, such as BP, LSTM, etc., support only numerical data inputs; however, a large portion of the dataset contains non-numerical variables, i.e., categorical variables. For example, the binary categorical variable “drug reaction” includes two categories of “positive” and “negative”, and the “assessment result” is also a binary categorical variable, including “pass” and “fail”; another example is the multi-categorical variable “occupation”, which includes “teacher, firefighter, construction worker, doctor…” and other categories. Numerical variables are easier to interpret, but when categorical variables dominate the dataset, it is not easy to view data trends and make predictions [
10]. Therefore, a method must be taken to map categorical variables to numerical values before inputting them into the neural network [
11].
Categorical variable coding methods include one-hot encoding, label encoding, target encoding, embedding, etc. In this, one-hot encoding is applicable to unordered categorical variables, which generates N-dimensional binary vectors using 0, 1 for N categories. Label encoding applies to ordered categorical variables, and it maps each category to an integer starting from 0. Target encoding uses the target mean corresponding to the category variables instead of the categorical variables. Embedding, on the other hand, randomly generates weight vectors according to the specified embedding dimensions and maps the text into word vectors according to the indexes of the categorical variables.
Unordered multi-categorical variables are categorical variables that contain several (usually more than three) categories with no differences in order or distance between categories.
Some existing encoding methods are not entirely suitable for unordered multi-categorical variables; for example, when the number of categories is large, applying one-hot encoding or applying embedding with a large embedding dimension creates the risk of dimensionality explosion, and the data are too sparse after one-hot encoding. Embedding and label encoding also introduce additional order and distance to an originally unordered categorical variable. Target encoding, on the other hand, affects the ability of the neural network model to extract information with the risk of overfitting.
In the current research on the target prediction problem, scholars are more concerned about how to design a better model structure to make better prediction results, and when carrying out the input data processing, the data either do not include the categorical variables [
12,
13,
14] or use other traditional coding methods. For example, Bu et al. [
15] used label encoding for both ordered and unordered categorical variables for data preprocessing when adopting selective integrated learning for ship painting man-hour prediction. Hur et al. [
16] predicted ship construction man-hours using deployable data at different times during the manufacturing process and converted the categorical variables into dummy variables when processing them. Sasan et al. [
17] converted binary categorical variables into 1 and 2 labeled coding. Wang et al. [
18] set working time and non-working time as 0 and 1 coding, respectively. Carrizosa et al. [
19] processed all the categorical variables using one-hot encoding in a binary categorical problem in the presence of categorical variables. All of the above studies adopted the existing conventional encoding methods to carry out the codes for unordered multi-categorical variables but ignored the fact that the encoded values did not maintain the characteristics of unordered multi-categorical variables and also additionally introduced the misleading order and distance bias.
In his research on encoding methods for categorical variables, Sebastian [
20] applied five encoding methods to three regression models in his experiments and proved that the regression results varied according to the encoding methods of categorical variables; Hien et al. [
21] also verified that the three encoding methods of categorical variables, namely label encoding, one-hot encoding, and embedding, had different effects on the performance of a deep dense neural network and long- and short-term memory neural network models. Li et al. [
22] proposed an ordered log-linear model for ordered categorical variables that can convert ordered categorical data into model-describable multi-categorical lists; Meulemeester et al. [
23] used unsupervised embedding to convert categorical variables into word vectors. Dahouda et al. [
24] extended the word-embedding approach by proposing a deep learning method to codify categorical variables. All of the above methods are more suitable for ordered categorical variables or for categorical variables with dependencies. Namgil et al. [
25] devised a Bayesian network based method for converting categorical variables into data variables, and Jung et al. [
26] proposed a method for updating data points in the kernel space of a continuous variable by using SVMs to reflect the effect of each categorical variable; all of the above methods are only suitable for the target value of a binary categorical variable.
In general, there is no encoding method for transforming unordered multi-categorical variables into numerical codes with the characteristics of unordered variables and small dimensions. Based on this need, this paper carries out a research on encoding methods for unordered multi-categorical variables. This paper also extends the problem of predicting the working hours of cruise ship production design tasks by analyzing the relationship between task workload and task working hours through the previous working hours data and the design attribute data in the ship area, such as the task type, the number of model structures, the planned working hours, the feedback working hours, etc., so as to provide credible and standards-based working hours solutions for the planning and scheduling of the design tasks when designing and constructing a new ship in the future, which is also the key link to promote the standardization of ship design and construction. In the ship production design task working hour prediction problem, ship area and task type are categorical variables containing dozens of unordered categories, so the unordered multi-categorical variables cannot be ignored.
Autoencoder, as a classical tool for feature extraction and data dimensionality reduction, has continued to show its unique value in the field of data processing in recent years. For example, the research of Yang et al. [
27] is a profound exploration, in which they cleverly integrate a deep autoencoder network into the Orthogonal Nonnegative Matrix Factorization (ONMF) framework, which achieves an accurate capture and hierarchical parsing of the intrinsic structure of complex data. This innovation not only highlights the ability of the autoencoder to automatically extract high-level features from data in an unsupervised learning environment but also effectively reduces the data dimensionality while preserving key information through its unique network structure.
Based on this core feature of autoencoder, this paper proposes a new encoding method, O-AE, for unordered multi-categorical variables, which first uses an orthogonal matrix to numerically encode the unordered multi-categorical variables, ensuring that the codes are independent of each other in terms of position, are equal distance, and are the same size; second, it uses autoencoder to carry out representation learning on the numerical codes and then performs the dimensionality reduction to ensure that the data inputted to the neural network has learned the relevant characteristics of the orthogonal matrix at the same time low dimensionality. This paper is structured as follows.
Section 2 introduces four traditional methods for encoding multi-categorical variables;
Section 3 describes the encoding mechanism of O-AE proposed in this paper;
Section 4 introduces the Bayesian optimization of the hyperparameters of autoencoder for O-AE;
Section 5 designs seven encoding experiments for six encoding methods (including O-AE), designs the Bayesian optimization of the hyperparameters of the autoencoder for O-AE, designs seven encoding experiments, introduces the specific information of five datasets, and proposes the validation metrics; and
Section 6 carries out the example validation and demonstrates and discusses the experimental results.
2. Encoding of Categorical Variables
This section presents the theory of several types of encoding methods that are used frequently. First, the parametric representation of unordered multi-categorical variables is presented along with the parametric representation after encoding.
Definition 1. Unordered multi-categorical variables are non-numerical variables with no size or positional differences between categories.
Definition 2. The sample size of unordered multi-categorical variables is set as , and the variable contains categories .
There are multiple data points of the same category in , among which there are data points in category , Using the encoding method
, the category
is mapped to the numerical value
such that the unordered multi-categorical variables
are mapped to the numerical variables
.
The categorical data of the same category have the same numerical data under the same encoding method mapping.
The
identical categories
in
, under
mapping,
, are transformed into numerical values
, respectively, and
.
2.1. Label Encoding
The label encoding
maps the category
to integers from 0 to
.
2.2. Target Encoding
The target encoding maps the category to the mean of the target value corresponding to that category.
Assuming that the predicted target is
, the target value corresponding to category
is
. When
contains multiple similar data
within
, the corresponding target values are
.
2.3. One-Hot Encoding
One-hot encoding
maps the
categories
into
binary row vectors with
-dimensional size, where each binary vector has only one valid digit 1 and the rest of the positions are 0, and the positions of the valid digits are different between different vectors.
For example, the categorical variable “Occupation” contains three categories “Teacher, Firefighter, Construction Worker”, which are mapped to binary vectors [1,0,0], [0,1,0], [0,0,1] using one-hot encoding .
From this encoding method, it is easy to see that each vector is a unit vector and the vectors are orthogonal to each other, i.e., the vectors are equal in distance and independent of each other, which is fully consistent with the characteristics of unordered categorical variables.
However, one-hot encoding also has some problems: the vectors are only composed of 0 and 1, and when the categorical variables are of large categories, the encoding obtained from the mapping will be sparse and of huge dimensions, which will make the computational cost large.
2.4. Embedding
The embedding encoding maps each category to a point in a vector space, and vectors with similar categories are closer together in the vector space.
Setting embedding converts the categorical variable into a numerical variable with a specified embedding dimension . The embedding dimension denotes the dimension of the mapped , i.e., .
Embedding is roughly divided into four steps.
(1) Predefine the vector space, determine the number of categories contained within the categorical variables, specify the embedding dimension , and construct a weight matrix of rows and columns. The weight matrix is randomly generated by default from a standard normal distribution with mean 0 and standard deviation 1. That is, .
(2) Assign an integer index starting from 0 to each category in the categorical variables.
(3) Map the integer indexes into a predefined vector space by means of a lookup table (this table is the weight matrix ), where each index is associated with a vector corresponding to the number of the weight matrix.
(4) Return the mapped numeric variables for the categorical variables.
3. Orthogonal Matrix-Autoencoder-Based Encoding Method for Unordered Multi-Categorical Variables
Among the existing methods for encoding categorical variables, part of the methods is not applicable to unordered multi-categorical variables with no size, order, or distance requirements between categories, and the other part of the methods have large dimensionality after encoding. Therefore, this paper proposes the method O-AE based on orthogonal matrix-autoencoder for encoding and dimension reduction of unordered multi-categorical variables. O-AE for unordered multi-categorical variables encoding and dimensionality reduction process is shown in
Figure 1.
The model is mainly divided into two parts, the original code generation part and the code reduction part.
The original code generation part is . The code dimensionality reduction part is .
First, according to the number of categories in the unordered multi-categorical variables, the -order orthogonal matrix is constructed, and the orthogonal matrix is mapped one by one with the original unordered multi-categorical variables according to the positional indexes into an orthogonal numerical coding matrix with the same data size, independent positions, and equal distances.
Second, the orthogonal matrix of numerical code matrix is input to the autoencoder, and the autoencoder is trained step by step by compressed reconstruction coding through the encoder and decoder in the autoencoder; finally, the learned feature is obtained.
3.1. Code Generation
The -order square matrix is set as , , where is the column vector of and .
There exists a series of transformations that decompose into an orthogonal matrix and an upper triangular matrix , i.e., . These transformations are also called QR decomposition of .
The orthogonal matrix is set to consist of column vectors, , where .
The row and column vectors of an orthogonal matrix are two-by-two orthogonal unit vectors.
Therefore, mapping unordered multi-categorical variables into orthogonal numerical codes can ensure that the different categories are independent of each other in terms of location, are equal distances, and are the same size, and at the same time increase the data richness to avoid underfitting in the subsequent prediction process brought about by data impoverishment.
The steps for encoding unordered multi-categorical variables using an orthogonal matrix are as follows.
(1) Construct -order square matrix based on the number of categories in the unordered multi-categorical variables.
(2) Perform the QR decomposition of using the Gram–Schmidt orthogonal transformation to obtain the orthogonal matrix .
The Gram–Schmidt orthogonal transformation is able to convert non-orthogonal bases into orthogonal bases by first orthogonalizing the non-orthogonal bases and, second, unitizing them.
(3) Construct the
-order identity matrix
. Using matrix multiplication, map the orthogonal matrix to the original unordered multi-categorical variables one by one according to the position indexes to obtain the orthogonal numerical code matrix
, which consists of row vectors.
where
and
is the row vector of
.
After the encoding of unordered multi-categorical variables, input the orthogonal matrix of numerical codes into the autoencoder for representation learning and dimension reduction.
3.2. Code Dimensionality Reduction
An autoencoder (AE) [
28] is an unsupervised neural network model, which mainly consists of two parts, an encoder and decoder, and has a symmetric structure. Through neural network training, an autoencoder can achieve the tasks of data denoising, feature learning, or data dimensionality reduction [
29].
An example of the structure of the autoencoder and the working principle of the autoencoder is shown in
Figure 2. The autoencoder includes an input layer, a hidden layer, latent space, and an output layer, each with a different number of nodes. In this case, the structure from the input layer to the latent space is referred to as the encoder, and the structure from the latent space to the output layer is referred to as the decoder. The number of nodes in the input layer is the size of the original dimension of the data, the number of nodes in the latent space is the dimension in which the data needs to be compressed, and the number of nodes in the hidden layer is in between the original dimension and the compressed dimension.
The working principle of the autoencoder is as follows: the encoder compresses the input data into a predefined low-dimensional encoding through a series of transformations , and the decoder tries to reconstruct the low-dimensional encoding into the original input data through a series of transformations . Iterative training of the autoencoder is carried out by minimizing the reconstruction error between the input and the output, and ultimately, it is hoped that the autoencoder learns the abstract feature representation of the samples .
The working principle of the autoencoder to carry out data dimensionality reduction is shown in Equation (16).
In this paper, multiple symmetric fully connected layers are designed in the encoder and decoder of the autoencoder to increase the complexity of the model and feature extraction capability by stacking multiple connected layers.
ReLU is used as the activation function; ReLU is simpler to compute and has relatively stable performance. ReLU can avoid the gradient disappearing during model training, increase the nonlinear fitting ability of the model, and have good performance on multi-class tasks and datasets. The ReLU formula is .
Taking the autoencoder model containing four hidden layers and one-dimensional data compression dimension as an example in
Figure 3,
denotes the orthogonal numerical code matrix, and
denotes the numerical matrix after the reconstruction of the autoencoder. Let
denote the process data compressed by the encoding layer. Let
denote the process data that has been reconstructed by the decoding layer, and let
denote the coded data that has undergone dimensionality reduction.
all consist of row vectors.
The change in data dimensions during the encoding and decoding of the orthogonal numerical code matrix by AE is shown in Equation (17).
More specifically, the steps for the dimensionality reduction of the orthogonal vector in the orthogonal numerical coding matrix are as follows.
(1) By means of the encoder, the orthogonal vector
is mapped from a high-dimensional space to a low-dimensional space to achieve data dimensionality reduction.
The coded data
after feature extraction of the model is obtained by linearly transforming the output of the previous layer to avoid introducing additional nonlinear relationships to enhance the complexity of the coded data, as in Equation (19).
(2) The original data
is reconstructed by mapping the low-dimensional space back to the high-dimensional space through the decoder.
The final output of the decoding layer,
, is obtained by linearly transforming the output of the previous layer to satisfy the purpose of output data reconstruction, as in Equation (21).
(3) The error is calculated between the reconstructed data
and the original data
, generally using the mean-square error as a loss function
.
(4) With the goal of minimizing the reconstruction error, the weights
and bias
in the encoder and decoder are optimised by error back propagation using a gradient-based method for the purpose of training the autoencoder.
(5) After autoencoder training, the autoencoder learns the feature
of the data.
The same is true for the other orthogonal vectors, which ultimately results in the reduced dimensionality of the orthogonal numerical code matrix with numerical code
.
From Equation (3), the values are the same after encoding in the same category. Therefore, the coded values after dimensionality reduction are expanded to the original sample size
to obtain the coded expressions for all unordered multi-categorical variables.
4. Bayesian Optimization of Autoencoder Hyperparameters
The structure of the autoencoder model is not fixed. Since a dataset may include multiple unordered multi-categorical variables with varying numbers of categories, the number of hidden layers and nodes in the autoencoder adapts according to the dataset’s size and the required level of data compression. Therefore, parameters such as the number of layers and nodes in the hidden layer of the autoencoder are the key influencing factors that affect the performance of the autoencoder and the effect of data dimensionality reduction.
Bayesian optimization is suitable for black-box optimization problems where the target function is complex and has no analytical expression and the computational cost is high. The core idea is to use a probabilistic agent model (e.g., Gaussian process or random forest) to approximate the objective function and use this model to select the next evaluation point so that the objective function can converge to the optimal value as soon as possible, which is a kind of optimization method based on a priori information. There are two core components in this process: the probabilistic model and the acquisition strategy.
Bayes’ theorem is shown in Equation (27).
This paper uses the TPE (Tree-structured Parzen Estimator) algorithm in the Optuna framework to specify the implementation of the Bayesian optimization technique. The TPE is a tree-structured Bayesian optimization method. In the TPE, two density functions are used to define
.
The TPE uses Kernel Density Estimation (KDE) to model the probability distribution of objective function values. Specifically, the TPE divides the objective function value into two components: a probability distribution for the better objective value and a probability distribution for the worse objective value.
The TPE uses Expected Improvement (EI) as a collection function.
This leads to Equation (30).
The value of EI is proportional to and depends on the ratio of the two probabilities, so it is necessary to find the that makes the ratio maximal and, in each iteration, return the maximum EI.
5. Experimental Design
5.1. Dataset
In order to validate the feasibility and effectiveness of the proposed method, this section carried out example validation on five datasets and compared the results with those of one-hot encoding, embedding, label encoding, and target encoding.
In this paper, the working-hour dataset of two typical majors in the cruise ship production design process, namely piping majors and hull structure majors, were selected from the major cruise shipbuilding yards in domestic market, and three public datasets containing unordered multi-categorical variables from UCI and Kaggle were also selected. The sample sizes of the five datasets as well as the number of categories in the unordered multi-categorical variables differed from each other, which made the method of this paper feasible to validate the universality of the method.
In particular, the sample size in the Gait dataset was so large that we randomly selected 1000 pieces of data to form a new dataset for the experiment.
The sample size of the data set, the number of variables, the number of categorical variables, the number of categories in the categorical variables, and the targets used for prediction are shown in the following table,
Table 1.
5.2. Detailed Experimental Design
The dimension of the values obtained by different encoding methods is not the same. In this paper, we set the dimension of autoencoder compression to be one-dimensional.
Therefore, O-AE, label encoding, and target encoding received one-dimensional codes, one-hot encoding received the same dimensionality as the number of categories in the categorical variables, and embedding methods were free to set the dimensionality size.
We were concerned with the effect of different encoding methods on the input dimensions of the dataset as well as on the target prediction results of the neural network, so we designed 2 experiments with different embedding dimensions for embedding and for O-AE, one-hot encoding, embedding, label encoding, target encoding, and Bayesian optimization of the hyperparameters of the autoencoder for the O-AE-b method, respectively, in 1 experiment.
The encoded dataset was input to BP neural network to carry out target prediction.
In this paper, only the multi-categorical variables “subject” in the Gait dataset were encoded; the categorical variables “condition” and “joint” in the Gait dataset contained a small number of categories, and “leg” was a binary categorical variable, so the experiments were conducted using the labeled data that came with the original dataset.
The multi-categorical variables “Cuisine_Type” in the Restaurant dataset were encoded and the binary categorical variables “Promotions” were experimented with using the labeled data that came with the original data.
Continuous variables in the dataset were mapped to a standard normal distribution with a mean of 0 and standard deviation of 1 by Z-Score standardization.
The specific methods of the seven experiments and the total dimensions of the five datasets input to the BP neural network under each of the seven experimental codes are shown in
Table 2.
5.3. Evaluation Metrics
In this paper, three classical evaluation metrics were used to assess the performance of different encoding methods in the BP neural network target prediction task, including Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and coefficient of determination (
).
where
is the number of samples,
is the actual value,
is the predicted value, and
is the mean of the actual value.
MAE is the mean of the absolute errors, and RMSE is the square root of the mean of the sum of squares of the errors. MAE and RMSE are both measurements of the deviation of the predicted values from the actual values, with smaller values indicating better final predictions. is used to assess the linear relationship between the actual values and the predicted values, with values closer to 1 indicating a better fit of the model.
6. Example Validation
In this section, we analyze the performance of seven experiments. We implemented all the algorithms in Python and conducted all the experiments on a computer with an i7-11390H processor, 3.40 GHz CPU, and 16.0 GB RAM.
6.1. Parameter Setting
The relevant parameters of the autoencoder when carrying out Experiment 1 and Experiment 7 are shown in
Table 3 below. The batch size is set as the sample size of the dataset due to the small sample size of the dataset for the experimental design.
In particular, in Experiment 7, the unordered multi-categorical variables are divided into training and validation sets according to 7:3. The early-stopping strategy is introduced, and the patience parameter for early stopping is set to 100. The number of AE hidden layers and the number of nodes per layer are obtained with Bayesian optimization. The number of encoder hidden layers is set to be no more than five, and the decoder and encoder structures are symmetric.
The number of hidden layers of the autoencoder and the number of nodes in each layer in Experiment 1 are manually and dynamically adjusted according to different datasets. The epoch of Experiment 1 was kept the same as Experiment 7. Also, since there is no additional autoencoder hyperparameter optimization procedure for Experiment 1 and in order to compare with other experiments to demonstrate the applicability of Experiment 1, the early-stopping strategy is not used.
To carry out target prediction using a BP neural network, the dataset is divided into a training set, validation set, and test set in the ratio of 7:2:1.
The relevant parameters are shown in
Table 4. The batch size is set as the sample size of the dataset due to the small sample size of the dataset for the experimental design. In order to quickly conduct experiments and obtain a better prediction result, the hyperparameter optimization method of a 5-fold cross-validation grid search is used, and the number of nodes in each hidden layer is set to be the same; the number of optional hidden layers and the number of optional nodes are shown in
Table 4. In order to improve the model performance and avoid overfitting, we introduce L2 Regularization and early-stopping strategy and set the patience parameter of early stopping to 100.
Meanwhile, the original code generation step randomly generates -order square matrix based on the number of categories in the unordered multi-categorical variables and fixes the random seed to ensure that the experimental data are the same.
6.2. Target Prediction Results
Under the above parameter settings, several calculations are carried out to obtain the results of the evaluation metrics for the five datasets in seven experiments. The number of nodes per layer of the encoding layer of the autoencoder (the decoding layer is symmetrical to the structure of the encoding layer, so the description is omitted) and the number of layers and nodes in the hidden layer of the BP neural network after hyperparameter optimization are shown in
Table 5.
In this paper, we denote the model structure of the autoencoder by unordered multi-categorical variables’ original dimension − intermediate compression dimension − 1.
The results of the evaluation metrics for the five datasets in seven experiments are shown in
Table 6.
This paper plots the results of the target prediction experiments for each dataset, including the fitted regression plots between the predicted and actual values in the test set, as shown in
Figure 4,
Figure 5,
Figure 6,
Figure 7 and
Figure 8, and the line charts between the predicted and actual values in the test set, as shown in
Figure 9,
Figure 10,
Figure 11,
Figure 12 and
Figure 13.
6.3. Analysis of Results
In this paper, MAE, RMSE and are chosen as the evaluation metrics of target prediction results, and the smaller MAE and RMSE, and the closer is to 1 means the target prediction quality is better.
(1) Comparing the metrics results of target prediction.
In the Piping dataset, the MAE results obtained by O-AE are the best, the RMSE and results obtained by O-AE-b are the best, and the MAE results of O-AE-b are the best among the seven experiments except for O-AE. The RMSE and results of O-AE are also the best among the seven experiments except for O-AE-b. The results of all three metrics for TE are worse in the other experiments.
In the Hull structure dataset, the MAE, RMSE, and results obtained by O-AE-b are the best, and the RMSE and results obtained by O-AE are also the best among the seven experiments except for O-AE-b. The results of all three metrics for TE are worse in the other experiments.
In the Gait dataset, the MAE results obtained by 5-EE are the best, the RMSE and results obtained by O-AE-b are the best, and the MAE results of O-AE-b are the best among the seven experiments except for 5-EE. The RMSE and results of O-AE are also the best among the seven experiments except for O-AE-b. The results of all three metrics for TE are worse in the other experiments.
In the Fish dataset, the MAE results obtained by OHE are the best, the RMSE and results obtained by O-AE-b are the best, and the MAE results of O-AE-b are the best among the seven experiments except for OHE. The RMSE and results of O-AE are also the best among the seven experiments except for O-AE-b. The results of all three metrics for TE are worse in the other experiments.
In particular, the prediction results of the seven experiments on the Restaurant dataset are not very satisfactory, with the highest of only 0.7624, which is analyzed in this paper as a possible reason for the fact that the chosen BP neural network model is not applicable to the Restaurant dataset. However, in the Restaurant dataset, the MAE results obtained by O-AE are the best, the RMSE and results obtained by O-AE-b are the best, and the MAE results of O-AE-b are the best among the seven experiments except for O-AE. The RMSE and results of O-AE are also the best among the seven experiments except for O-AE-b. The results of all three metrics for 1-EE are worse in the other experiments.
Overall, the Bayesian optimization of the hyperparameters of the autoencoder for O-AE as well as the basic O-AE have consistently excellent target prediction results when experiments are carried out on different datasets. Analyzing the metric results, the basic O-AE can then meet the encoding needs of unordered multi-categorical variables, while the MAE results of O-AE are better than the MAE results of O-AE-b in some datasets.
(2) Comparing the experimental performance of different methods.
In other experiments, 1-EE and 5-EE are embedding methods with one and five embedding dimensions, respectively, and the metric results of 1-EE and 5-EE are in the middle of the range on the five datasets, with little difference in experimental performance. The metric results of OHE on the five datasets are also more stable, and the experimental performance is a little bit poorer than that of O-AE and O-AE-b, but OHE has the problems of unordered multi-categorical variables with larger dimensions and sparse data after encoding. The experimental performance of LE and TE on the five datasets is general mainly because the use of LE introduces additional order misclassification and distance bias in addition to the originally unordered features, and TE affects the fitting ability of the neural network model.
Overall, the experimental results of O-AE-b and O-AE are superior compared to other classical encoding methods. The unordered multi-categorical variables processed by O-AE-b and O-AE were able to satisfy the data input requirements of the subsequent neural network model and facilitated the ability of neural network data learning to improve the neural network target prediction results.
7. Conclusions
The objective of this paper is to find an encoding method for unordered multi-categorical variables that results in the lower dimensionality of the encoded data and better target prediction results when fed into a neural network.
After analyzing the characteristics of unordered multi-categorical variables and comparing them with other encoding methods, this paper proposes a method for the encoding and dimensionality reduction of unordered multi-categorical variables using an orthogonal matrix-autoencoder. Seven experiments are designed for validation using the basic O-AE, the Bayesian optimization of the hyperparameters of the autoencoder for O-AE, and several other classical encoding methods. The experimental results show that O-AE and O-AE-b have more stable and excellent evaluate metrics, indicating that the method proposed in this paper is highly feasible and applicable and can be an optional method for data processing of unordered multi-categorical variables.
Through the experimental analysis, the basic O-AE can meet the encoding requirements of unordered multi-categorical variables, but O-AE manually adjusts the number of layers and nodes in the hidden layer of the autoencoder and needs to adjust the parameters several times to achieve the optimal results of the metrics. O-AE-b uses Bayesian optimization to find the optimal number of layers and nodes in the hidden layer, but the Bayesian optimization of hyperparameters consumes more time than that of the basic O-AE. Therefore, the encoding method can be selected according to the characteristics of the problem and the demand of experimental resources in the specific use.
Although the research in this paper has achieved preliminary results, it still contains vast room for deepening. Future work will focus on optimizing the model performance and try to introduce activation functions such as PReLU or other regularization strategies such as L1-L2 with a view to further improve the model performance. Meanwhile, we will also work on improving the efficiency of Bayesian optimization in the O-AE-b model and exploring more new ways to efficiently optimize the hyperparameters of the autoencoder in order to promote the continuous progress of research in this area.