Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Enterprise retail price prediction method based on improved HPO-LSTM algorithm

Abstract

In modern market economy, accurate price prediction plays a pivotal role in inventory management, marketing strategy formulation, and profit maximization for enterprises. To optimize resource allocation and improve economic efficiency, this research proposes an optimization algorithm that combines Hunter-Prey optimization algorithm and long short-term memory network, while introducing attention mechanism and Q-learning algorithm to optimize the model. In the research results, the improved Hunter-Prey optimization-long short-term memory algorithm showed significantly better prediction accuracy than the control model, with a root mean square error of 0.48 and a mean absolute error of 0.20. At the same time, after the algorithm converged, the accuracy tended to 0.972 and the recall tended to 0.921. In practical business applications, this algorithm could significantly reduce inventory costs (15.2%) and promotion costs (20.3%), while increasing sales revenue (15.4%) and profits (20.4%). The results indicate that the improved Hunter-Prey optimization-long short-term memory algorithm can effectively reduce prediction errors and strengthen the robustness and adaptability of the model. Research can provide enterprises with an efficient and accurate retail price prediction tool, which can help optimize inventory management, reduce resource waste, and enhance market competitiveness.

1 Introduction

In the rapidly developing market economy, the changes in retail prices of enterprises are influenced by massive complex factors, including product costs, consumer demand, economic environment, and promotional strategies. Accurately predicting retail prices not only helps companies optimize inventory management and develop reasonable pricing strategies, but also enhances market competitiveness and economic benefits [1,2]. As the big data and artificial intelligence technology develop, more and more research is focusing on using advanced computer algorithms and models to raise the accuracy and efficiency of price forecasting. However, traditional prediction methods often struggle to cope with complex market environments and dynamic price fluctuations, especially in situations where multiple factors interact [3,4]. The so-called complex market environment is mainly reflected in the following aspects. Firstly, the acceleration of globalization has made market competition increasingly fierce. Enterprises not only have to contend with competition from domestic peers but also face competitive pressure from the international market, which has led to a significant increase in market demand uncertainty. Secondly, fluctuations in the economic situation, such as changes in economic cycles, inflation or deflation, etc., can have a significant impact on consumers’ purchasing power and willingness, and thereby affect the retail prices of goods. Dynamic price fluctuations mainly come from two aspects. Firstly, fluctuations in raw material prices will directly affect the cost of goods, thereby leading to changes in retail prices. For instance, the increase in oil prices will lead to a rise in the cost of chemical products related to oil, which in turn will drive up their retail prices. Secondly, seasonal changes in consumer demand can also cause price fluctuations. Take the clothing industry as an example, spring and autumn are peak sales seasons, with strong demand and relatively high prices. Winter and summer, on the other hand, are the off-seasons for sales, with reduced demand and corresponding price drops. In addition, sudden events, such as natural disasters and public health incidents, can also cause short-term and sharp fluctuations in prices.

Against the backdrop of the current complex market environment and dynamic price fluctuations, traditional prediction methods often struggle to cope. For instance, classic statistical methods, such as the ARIMA model in time series analysis, perform well when dealing with stationary time series data, but their prediction accuracy drops significantly when dealing with nonlinear and non-stationary time series data. While traditional machine learning methods, such as linear regression and decision trees, can handle a certain degree of nonlinear relationships, their performance is also poor when dealing with complex multi-factor interactions and long-term dependencies of time series data. Therefore, to enhance the accuracy and efficiency of price prediction and provide enterprises with a more scientific and precise decision-making basis, it is particularly necessary to research and develop better prediction algorithms. Long Short-Term Memory (LSTM) networks, as an effective recursive neural network structure, are widely used in price prediction. This model can capture long-term dependencies in time series data through its unique gating mechanism, but the selection of hyperparameters and optimization problems during model training are still the focus of research. In addition, although LSTM performs well in processing time series data, it may still suffer from insufficient prediction accuracy due to data noise and model complexity issues when facing complex market environments [5,6].

Currently, scholars have conducted research on price prediction. Kożuch A et al. proposed a comprehensive prediction model combining artificial neural networks and time series for existing wood price prediction methods, which consists of two artificial neural network structures: multilayer perceptron and radial basis function. Compared with classical time series models, the results showed that this model had stronger adaptability in different types of wood and price fluctuations, and performed well in predicting price extremes [7]. Wang K et al. proposed a quantitative model for electricity price prediction grounded on random forest and improved Mahalanobis distance to address the difficulty of electricity price prediction due to the widespread application of renewable energy networks. The model used variational mode decomposition (VMD) technology to divide electricity price sequence data into intrinsic mode functions and residuals of different frequencies, to minimize data noise and volatility. The outcomes denoted that the hybrid model could significantly improve the predictive ability of electricity prices while reducing prediction errors, and its performance was significantly better than other control models [8]. Xu X et al. raised a neural network model for predicting office property price indices in response to the quick advancement of the Chinese housing market over the past decade. This model explored the setting of different algorithms, delays, hidden neurons, and data segmentation ratios to achieve pure technical prediction of the Chinese office real estate market. The results indicated that the mean relative RMSE of the model for predicting housing prices was only 1.45% [9]. Lahaghi S A M et al. proposed a distributed node marginal price evaluation model based on the risk-sensitive cheetah hunter optimization algorithm in view of the current situation of distributed generation pricing optimization in smart distribution networks. This model combined the scenario analysis method of the information gap decision-making theory, simulated the uncertainty of the electricity market price through two scenarios of risk aversion and risk tolerance, and utilized the global and local search capabilities of the Cheetah Hunter algorithm to optimize the marginal price of distributed nodes. The results showed that this method could effectively reduce network losses under different market conditions and provide higher profits for distributed generation units at the same time [10]. Finally, a simple model based on four delays and two hidden neurons was constructed. The results showed that the relative root mean square error of the model in the training, verification and testing stages was all lower than 1.80%, and the average absolute percentage error was lower than 1.30%. Furthermore, this model passed the modified Diebold-Mariano test at the 1% significance level, demonstrating better predictive performance than the linear autoregressive model [11]. Yue W et al. proposed a Transformer-based hybrid model in response to the current situation of carbon price prediction. This model first used VMD to decompose the original carbon price sequence into multiple sub-sequences, then used the Transformer model to predict each sub-sequence, and finally reconstructed the prediction results to obtain the final predicted carbon price value. The results showed that the multi-step prediction and interval prediction performance of this model on two real carbon market datasets were superior to those of traditional models such as ARIMA, SVR, and LSTM, which proves the effectiveness and superiority of the Transformer model in the field of carbon price prediction [12]. Sefer et al. proposed a temporal deep learning model integrating Graph Neural Networks (GNNS) in response to the current situation of financial asset price prediction. The results showed that this model was significantly superior to the traditional sequence model in capturing the complex correlations and dynamic evolution among assets, and improved the prediction accuracy of prices and their directions of rise and fall [13].

Although existing research has realized certain results in price prediction, there are still limitations in complex market environments, multi-factor interactions, and model optimization. At the same time, due to the complexity of multi-source data such as product prices, promotional activities, and economic indicators, coupled with the dynamic and nonlinear characteristics of time series data, traditional linear models are difficult to accurately capture price fluctuations. Based on this, a Hunter-Prey Optimization Long Short-Term Memory (HPO-LSTM) network is proposed for predicting retail prices in enterprises. The innovation of the research lies in the combination of the HPO algorithm, the attention mechanism, and Q-learning, forming a new retail price prediction model. The HPO algorithm is used to optimize the hyperparameters of LSTM, improving the prediction accuracy of the model. The attention mechanism enhances the model’s ability to capture key information in time series. The Q-learning algorithm optimizes the training process of the model by dynamically adjusting the learning rate and hyperparameters. In the task of time series prediction, the application value of the attention mechanism lies in its ability to capture the key time steps in the time series, thereby enhancing the model’s modeling ability for long-term dependencies. Meanwhile, the Q-learning algorithm can be used to dynamically adjust the hyperparameters of the model, such as the learning rate, to optimize the training process of the model. The research targets to improve the accuracy and robustness of retail price prediction for enterprises through an improved HPO-LSTM algorithm, to provide scientific basis for relevant decision-making for enterprises.

2 Methods and materials

2.1 Factors affecting sales in the retail market of enterprises and data processing

Before predicting the retail prices of enterprises, it need to have a deep understanding of the influencing factors of the enterprise retail market. The accuracy of these factors and data will directly affect the effectiveness and results of the prediction model. In the retail process of enterprises, the current approach mainly adopts a combination of online and offline methods. The current sales factors affecting the retail market of enterprises mainly include product prices, product evaluations, store locations, promotional activities, and economic indicators [14,15]. The relevant diagram is shown in Fig 1.

thumbnail
Fig 1. Factors affecting the sales volume of enterprise retail market.

https://doi.org/10.1371/journal.pone.0339155.g001

Fig 1 shows the key factors influencing a company’s retail sales volume and their interrelationships. In this framework, the price of goods directly affects consumers’ purchasing intentions, among which the pricing range is one of the key factors. The location of a store influences consumers’ purchasing intentions by affecting their purchasing convenience, while economic indicators such as the Consumer Price Index (CPI), Producer Price Index (PPI), and Gross Domestic Product (GDP) affect consumers’ purchasing power and willingness at the macroeconomic level. In addition, product reviews reflect consumers’ satisfaction with the products, which not only affects real demand but may also grant the products higher pricing power. Promotional activities can boost sales in the short term by stimulating purchasing enthusiasm, and at the same time may enhance brand loyalty and market competitiveness. These factors interact with each other and jointly determine the sales volume and prices in the retail market. In enterprise retail, regression analysis is used to establish a relationship model between price and sales volume [16,17]. The relevant mathematical expression is shown in formula (1).

(1)

In formula (1), represents sales volume, represents price, and represent regression coefficients, and represents price elasticity. Product evaluation is a reflection of consumer satisfaction with a product, usually presented in the form of ratings or reviews. Its mathematical expression is shown in formula (2).

(2)

In formula (2), represents the average rating of the product. The location of a store has a significant impact on retail sales, which can usually be quantified based on the location information of a company’s store, combined with factors such as population density and transportation convenience. Promotional activities can significantly increase sales, which can be quantified by the intensity and frequency of promotions. In addition, macroeconomic indicators also have an impact on retail market sales, reflecting the overall economic environment and thus affecting consumers’ purchasing power and willingness. The macroeconomic indicators involved in the study mainly include the CPI, which is an important index for measuring changes in consumer price levels, PPI, which measures changes in prices of goods and services in the production sector, and GDP, which measures a country’s economic situation. The mathematical expression of the sales model is shown in formula (3).

(3)

In formula (3), , , and represent regression coefficients. After clarifying the factors influencing the sales volume of enterprises, the actual operation data of a large chain retail enterprise in Sichuan Province, China, were studied and collected. The data covers the time span from January 2022 to December 2024, totaling 36 months of data. These data mainly include product codes, sales dates, store information, sales revenue, and activity intensity. After obtaining all the data, further data cleaning is carried out, including missing value processing, duplicate value processing, and outlier processing, as shown in Fig 2.

In Fig 2, common missing values in enterprise retail data may appear in fields such as product price, sales volume, promotional activities, etc [18]. Common missing values in the data may occur in fields such as commodity prices, sales volumes, and promotional activities. The research conducts corresponding processing based on the nature of the data and business requirements. If the percentage of missing values is less than 5%, and deletion will not significantly affect the analysis results, then records containing missing values can be deleted. Time series data such as promotional activity dates can be filled forward. For certain fields, such as promotional activity logos and product status fields, fixed value filling can be used [19]. Duplicate values may appear in retail data, especially during data merging or import processes. The handling of duplicate values can usually be identified by checking the uniqueness of the data to identify duplicate records. Alternatively, based on business requirements, it will choose to delete completely duplicate records and retain only one. The handling of outliers may be caused by data entry errors, measurement errors, or extreme situations. Outliers may be caused by data entry errors, measurement errors or extreme circumstances. The research adopts the Z-score method to identify outliers in the data. That is, after calculating the Z-score, a threshold is set to correct or delete the outliers, and its mathematical expression is shown in formula (4).

(4)

In formula (4), means the value of the data point, represents the mean, and represents the standard deviation of the dataset. After setting a threshold, the size of is determined. If it is greater than the threshold, the data point may be an outlier. After preprocessing the data, based on the continuous characteristics of enterprise data, the study first adopts a minimum maximum standardization method to scale the data to the range of [0,1]. Its mathematical expression is shown in formula (5).

(5)

In formula (5), and respectively represent the mini and max values in the dataset. Finally, the Spearman correlation coefficient is introduced to analyze the monotonic relationship between variables, and its mathematical expression is shown in formula (6).

(6)

In formula (6), represents the correlation coefficient. Through correlation analysis, potential correlations between variables (such as price, sales volume, etc.) in enterprise retail data can be analyzed to further understand and obtain consistency in ranking.

2.2 Retail price prediction based on improved HPO-LSTM algorithm

After obtaining and processing enterprise retail data, the study introduces the Hunter-Prey Optimization (HPO) algorithm. It seeks the optimal solution by simulating the chase process between hunters and prey in nature, with the core idea of optimizing the search process based on the behavioral patterns of hunters and prey [2022]. The process of HPO algorithm is shown in Fig 3.

In Fig 3, the initial positions of individuals are randomly generated first, and the relevant mathematical expression is shown in formula (7).

(7)

In formula (7), and mean the lower and upper bounds of the search space, respectively, and indicates the generated random number. After initializing the population, parameters such as population size, maximum iteration times, and adaptive parameter range are input, and the fitness of all individuals is calculated to find the initial optimal position. Subsequently, iterative optimization is carried out to update parameters and . The mathematical expression of parameter is shown in formula (8).

(8)

In formula (8), represents the iterative process, and represents the max amount of iterations. The mathematical expression of parameter is shown in formula (9).

(9)

After the parameter update is completed, for individual , the role of their hunter or prey is determined by comparing random numbers and thresholds, as expressed mathematically in formula (10).

(10)

In formula (10), represents a random number within the range of [0,1], represents a preset threshold, represents the current position of the prey, represents the global optimal position, and represents a randomly generated new position. After determining the individual’s role, their position in the search space is updated based on the role information. The mathematical expression of the hunter’s position information is shown in formula (11).

(11)

The mathematical expression of the location information of the prey is shown in formula (12).

(12)

Finally, it will calculate the fitness of each individual and update the global optimal position. At the same time, it needs to check whether the termination condition is satisfied or the maximum number of iterations is reached, and output the optimal solution after the termination condition is satisfied. On the basis of HPO, the hyperparameters of LSTM recursive network are optimized grounded on this algorithm to raise the accuracy and efficiency of model prediction. After introducing the HPO algorithm, the LSTM model is initialized through the hyperparameter combination optimized by this algorithm. Meanwhile, the LSTM model is trained and its fitness is calculated on the validation set. Furthermore, after the optimization of the HPO algorithm, the global optimal position of the network model can be updated accordingly, and it can be checked whether the termination condition is met or the maximum number of iterations is reached. The specific process based on the HPO-LSTM algorithm is shown in Fig 4.

In Fig 4, in the improved HPO-LSTM, the HPO parameters are initialized first, setting the population size, the maximum number of iterations, and the threshold for hunters and prey; Initialize the LSTM parameters, that is, set the number of layers of the LSTM model, the number of neurons in each layer and the initial learning rate; Initialize the population, that is, randomly generate the hyperparameters of LSTM, and each group of hyperparameters represents an individual; Evaluate the fitness, that is, train the LSTM model using the current hyperparameter combination and calculate the fitness on the validation set; Update the HPO parameters, that is, update the positions of the hunter and the prey according to the fitness, and update the global optimal position; Check the termination condition, that is, if the maximum number of iterations is reached or the convergence condition is met, proceed to the next step; Otherwise, return to the “Evaluate Fitness” step. Optimize the LSTM model, that is, retrain the LSTM model using the best hyperparameters found by HPO; Finally, the prediction results are output, that is, the retail price prediction is carried out using the optimized LSTM model. Considering the existence of time series data in the retail price prediction process, this study further introduces attention mechanisms to optimize the HPO-LSTM model, to focus more on key information in the time series and enhance the accuracy and robustness of the prediction. The core of the attention mechanism lies in calculating the weight values for each time step, as expressed mathematically in formula (13).

(13)

In formula (13), represents the attention weight for time steps, represents the score for the th time step, and denotes the total length of the sequence. The score of the time step is usually calculated by the fully connected layer, and the relevant mathematical expression is shown in formula (14).

(14)

In formula (14), stands for the hidden state of the th time step, means the context vector of the previous time step, , , and represent the weight matrices and vector, and represents the bias term. After obtaining the attention weights, the model weights and sums the outputs of the LSTM based on the weight values to obtain the final output. The relevant mathematical expression is shown in formula (15).

(15)

In formula (15), represents the weighted hidden state, and the model’s ability to capture key time steps is effectively improved after weighted summation. Specifically, in terms of input features, the input features are weighted through the attention mechanism. That is, after calculating the attention weights, the weighted features are input into the LSTM model, so that the model can pay more attention to the input features. In terms of the weighting of the hidden state, based on the attention weight as well, the weighted hidden state is taken as the output of the current time step. In terms of output weighting, through the attention weight, the weighted output is taken as the final prediction result to improve the accuracy of the model prediction. Finally, considering the unique gating mechanism of the LSTM model, the complexity of the model requires more time and computational resources during the training process. Therefore, the Q-learning algorithm is introduced to continuously iterate and update the value function to learn the optimal strategy. Firstly, a Q-Table is initialized and created to store all possible states, and based on the current Q-value, the action to be taken is decided. After selecting actions through a greedy strategy, the agent moves to a new state and receives rewards based on the results [2325]. Finally, the Q-value of the state action pair is updated based on formula (16).

(16)

In formula (16), represents the Q value corresponding to the current state and action, represents the current learning rate, represents the reward for the action, represents the discount factor, and represents the max expected future reward for the next state. The Q-learning algorithm is introduced, and the optimal action can be selected by learning the optimal action value function (Q-function). Specifically, first initialize the Q-table, that is, create a Q-table to store the Q value of each state-action pair. Define the state and action Spaces, that is, the state is defined as the current parameter Settings and the current training error of the LSTM model during the training process, and the action is defined as the adjustment of the LSTM model parameters, that is, the adjustment of hyperparameters, etc. Secondly, during the training process, in each training step, select an action based on the current state. Finally, the learning rate of the LSTM model is dynamically adjusted through the Q-learning algorithm. If the optimal action in the current state is to increase the learning rate, then increase the learning rate in the next training step; Conversely, if the optimal action is to reduce the learning rate, then reduce the learning rate. Finally, the process of predicting retail prices for enterprises is shown in Fig 5.

In Fig 5, the prediction of enterprise retail prices mainly includes data collection and processing, the construction of an improved HPO-LSTM model, and the prediction of enterprise retail prices. In data collection, after collecting information such as product codes and sales figures, the data is cleaned and standardized to conduct correlation analysis on various indicators. In the improved HPO-LSTM model, hyperparameters are optimized using the HPO algorithm, and attention mechanism and Q-learning algorithm are introduced to optimize the model and training process. In the final retail price prediction stage, the processed data will be input into the optimized HPO-LSTM model.

Overall, the HPO algorithm, attention mechanism, and Q-learning algorithm were integrated into LSTM in the research, forming a novel prediction model. The HPO algorithm efficiently optimizes the hyperparameters of LSTM by simulating the chase process in nature, thereby enhancing the prediction accuracy of the model. The attention mechanism enables the model to focus on the key information in the time series, thereby enhancing the ability to capture long-term dependencies. The Q-learning algorithm optimizes the training process of the model by dynamically adjusting the learning rate and hyperparameters, and further improves the prediction performance. These three components complement each other and jointly solve the limitations of the standalone HPO-LSTM when dealing with complex time series data, improving the adaptability and generalization ability of the model. Compared with the standalone HPO-LSTM, the improved model performs better in terms of prediction accuracy and robustness, especially in the face of complex market environments and dynamic price fluctuations, providing a more efficient and accurate tool for enterprise retail price prediction.

3 Results

3.1 Correlation analysis of factors affecting market sales volume

Before model training, data preprocessing is a key step to ensure the performance of the model. The preprocessing process includes data cleaning (handling of missing values, duplicate values and outliers), data standardization (the minimal-maximum standardization method) and the method of feature selection. Among them, in terms of feature selection, based on the correlation analysis, the study selected the features that have a greater impact on retail prices. Before the experiment, multiple variable data including product prices, product evaluations, store locations, promotional activities, CPI, PPI, and GDP were collected. At the same time, correlation analysis was conducted on factors affecting sales in various markets based on the Spearman coefficient. The results are shown in Table 1.

thumbnail
Table 1. Correlation analysis of factors affecting market sales.

https://doi.org/10.1371/journal.pone.0339155.t001

3.2 Performance evaluation based on improved HPO-LSTM algorithm

After determining the correlation of various influencing factors, further research was carried out to prove the effect of the improved HPO-LSTM algorithm. The experimental environment and algorithm parameter settings for the study are denoted in Table 2.

thumbnail
Table 2. Experimental environment and algorithm parameter setting.

https://doi.org/10.1371/journal.pone.0339155.t002

In Table 2, an initial learning rate of 0.01 for the LSTM model is a commonly used option, which can enable the model to converge stably during the training process. A batch size of 32 can strike a balance between training efficiency and model performance. In the HPO algorithm, setting the population size to 40 could increase the diversity of the search space and improve the probability of finding the global optimal solution. Setting the hunter-prey threshold at 0.5 could enable the HPO algorithm to strike a balance between the behaviors of hunters and prey. Setting the discount factor of the Q-learning algorithm to 0.9 could strike a balance between short-term and long-term rewards. The number of layers and the number of neurons of the following control model BiLSTM are consistent with those of the LSTM model. The setting of 50 neurons per layer enabled the BiLSTM model to avoid overfitting when capturing forward and reverse time series information, while maintaining a high prediction accuracy. In addition, the learning rate and batch size are also consistent with the LSTM model. The Big Mart sales prediction dataset was selected, which includes sales data from large supermarkets, covering product features and sales volume for each product [26,27]. The ratio of the training set to the test set was set to 6:4. The relevant description of the dataset is shown in Table 3.

During the preprocessing of the model, missing value handling was carried out first. That is, numerical features and categorical features were filled with means and mode, respectively, and features with a missing rate lower than 5% were directly deleted. Secondly, the Z-score method was adopted to detect outliers, and they were corrected or deleted according to the business logic. Immediately after, normalize the data. Finally, based on the correlation analysis and feature importance assessment methods, the most influential features were selected, while the features with low correlation to the target variable were removed, thereby reducing the complexity of the model and the risk of overfitting. The training process of the model mainly included the training of the LSTM model optimized by the HPO algorithm. In the optimization of the HPO algorithm, the algorithm parameters and population were initialized first; Secondly, evaluate the combination of hyperparameters; Immediately afterwards, the positions of the hunter and the prey were updated according to the rules of the HPO algorithm, and the global optimal position was also updated. Finally, repeat the above steps until the maximum number of iterations is reached or the convergence condition is met. During the training process of the LSTM model, the LSTM model was initialized first using the optimal hyperparameters found by the HPO algorithm. Secondly, the LSTM model was trained on the training set and verified on the validation set to prevent overfitting. Immediately after that, the attention mechanism was introduced to enable the model to pay more attention to the key information in the time series; Finally, the Q-learning algorithm was used to dynamically adjust the learning rate and hyperparameters to optimize the training process. The study simultaneously selected traditional HPO-LSTM, LSTM, and BiLSTM algorithms for comparative experiments. Among them, the BiLSTM had 2 layers, the number of neurons was 100 and 50 respectively, the learning rate was 0.01, the batch size was 32, and the Adam optimizer was also adopted. Firstly, the accuracy and recall curves of the four algorithms are denoted in Fig 6.

thumbnail
Fig 6. Comparison of accuracy and recall rate curves of four algorithms.

https://doi.org/10.1371/journal.pone.0339155.g006

Fig 6 (a) compares the accuracy curves of four algorithms. The outcomes showed that the improved HPO-LSTM algorithm used in the study had the highest accuracy after convergence, approaching 0.972, followed by the traditional HPO-LSTM model, BiLSTM model, and traditional LSTM model. Fig 6 (b) shows a comparison of recall curves for four algorithms. The findings showed that the improved HPO-LSTM algorithm used in the study had the highest recall rate, approaching 0.921. Meanwhile, the initial recall rate of this algorithm was 0.301, which was significantly higher than other algorithms. The study further compared the three error values of the four algorithms, and the findings are denoted in Fig 7.

thumbnail
Fig 7. Comparison of error values of the four algorithms.

https://doi.org/10.1371/journal.pone.0339155.g007

Fig 7 compares the error values of four algorithms. The findings denoted that the three error values of the improved HPO-LSTM algorithm proposed in the study were the smallest, with RMSE, MAE, and MAPE of 0.48, 0.20, and 0.105, respectively. This indicated that the algorithm had high accuracy and small error in predicting enterprise retail prices. The traditional HPO-LSTM algorithm and BiLSTM algorithm had the second highest error values, while the traditional LSTM algorithm had the highest error value. The study further compared the computational efficiency and complexity of the four algorithms, and the results are shown in Table 4.

thumbnail
Table 4. Comparison of computational efficiency and computational complexity.

https://doi.org/10.1371/journal.pone.0339155.t004

In Table 4, although the improved HPO-LSTM algorithm had a slightly higher running time than the traditional LSTM and BiLSTM, its running time was significantly shorter compared with the traditional HPO-LSTM. For example, under the training set of 50,000 samples, the running time of the improved HPO-LSTM was 561.5 seconds, while that of the traditional HPO-LSTM was 625.3 seconds. The running time of the improved algorithm decreased by approximately 10.2%, indicating that the improved algorithm is more efficient in the optimization process and can find the appropriate hyperparameters more quickly, thereby reducing the overall training time. In terms of memory usage, although the improved HPO-LSTM algorithm had higher memory usage than the traditional LSTM and BiLSTM, compared with the traditional HPO-LSTM, the memory usage was significantly reduced. For example, under a training set of 50,000 samples, the memory usage of the improved HPO-LSTM was 5,614 MB, while that of the traditional HPO-LSTM was 6,235 MB. The memory usage of the improved algorithm was reduced by approximately 9.9%. It indicates that the improved algorithm effectively controls the memory occupation during the optimization process and reduces unnecessary memory consumption. At the end of the study, the autoregressive integral moving average model (ARIMA), XGBoost, and DeepAR model were introduced for control experiments. Among them, DeepAR had 2 layers, with 50 neurons in each layer, a learning rate of 0.01, a batch size of 32, and also used the Adam optimizer. The comparison of the prediction accuracy and robustness of the four models is shown in Fig 8.

thumbnail
Fig 8. Comparison of the prediction accuracy and robustness of the four models.

https://doi.org/10.1371/journal.pone.0339155.g008

In Fig 8, the prediction accuracy of the improved HPO-LSTM was 97.20%, which performs the best among all models. This indicates that the improved HPO-LSTM model can be very close to the actual value when predicting retail prices and has high prediction accuracy. Meanwhile, the robustness index was 92.10%, which also performs the best among all models. This indicates that the stability of this model is very high under different datasets and different conditions, and it can adapt to various complex situations. The prediction accuracy and robustness indicators of the DeepAR model were second only to those of the improved HPO-LSTM model, with values of 93.40% and 89.70% respectively. The ARIMA model performed the worst among all models. Its prediction accuracy and robustness were 85.40% and 78.90% respectively, indicating that its prediction accuracy is relatively low in the case of a complex market environment and the interaction of multiple factors. Meanwhile, it had poor stability and was easily affected by data noise and complex situations. The study further introduced three relatively advanced time series models for comparative experiments, namely Vanilla Transformer, Informer and TimesNet. The performance results comparison is shown in Fig 9.

In Fig 9, the improved HPO-LSTM model outperformed the three variants of the Transformer model in the three key performance metrics of accuracy, recall and F1-score. Its accuracy was 0.905, the recall was 0.910 and the F1-score was0.907. In contrast, although the Vanilla Transformer model performed well in time series prediction, its performance was slightly lower than that of the improved HPO-LSTM model. This might be because when the Vanilla Transformer deals with time series data with complex dependencies. Its self-attention mechanism may not be able to fully capture all the key information. Although the Informer and TimesNet models have been optimized for long sequence prediction, they are still slightly inferior to the improved HPO-LSTM model in terms of accuracy and recall. This might be because they may have certain limitations when dealing with specific types of data. At the end of the study, the influence of each component on the model performance was analyzed through ablation experiments. The results of the ablation experiment are shown in Table 5.

In Table 5, as each component in the model was gradually added, the prediction performance indicators all showed a gradually improving trend. The performance of the specific basic LSTM model in terms of accuracy, recall rate and F1-score was 0.845, 0.830 and 0.837 respectively. After the introduction of HPO optimization, the performance indicators were respectively improved to 0.870, 0.860 and 0.865, indicating that HPO optimization has played a significant role in enhancing the model’s performance. After further introducing the attention mechanism, the performance indicators improved again, indicating that the attention mechanism helps the model better capture key information, thereby enhancing the accuracy of predictions. Finally, after incorporating the Q-learning algorithm, the performance of the model was further enhanced. When all components were fully integrated, the predictive performance of the model reached its optimum, with accuracy, recall rate and F1-score as high as 0.905, 0.910 and 0.907, respectively.

3.3 Verification of prediction capability and analysis of practical business application effect of improved HPO-LSTM algorithm

After verifying the performance of the four algorithms, the study further focused on the price fluctuations of a certain product from January to December 2024. By comparing the differences between the four algorithms and the actual prices, the retail price prediction ability of the algorithms was validated. The results are shown in Fig 10.

thumbnail
Fig 10. The difference between the four algorithms and the actual price.

https://doi.org/10.1371/journal.pone.0339155.g010

Fig 10 shows the comparison between four algorithms and the actual price of a certain product. The results indicated that the price of the product was generally between 15–18 yuan. The improved HPO-LSTM algorithm had the closest prediction results to the actual price with the smallest error. For example, in January, the actual price was 15.2 yuan, and the improved HPO-LSTM predicted a value of 15.1 yuan. The traditional HPO-LSTM prediction results were slightly higher than the actual price, but the overall error was still smaller than BiLSTM and traditional LSTM. The predicted values of BiLSTM were generally higher than the actual prices, with slightly larger errors than the improved HPO-LSTM. The difference between the latest LSTM prediction value and the actual price was significant, with the highest error. Overall, the improved HPO-LSTM algorithm performs the best in retail price prediction, indicating significant advantages in hyperparameter optimization and time series feature capture. The study further compared a certain seasonal product of the enterprise in the four seasons of spring, summer, autumn, and winter, and the price prediction effect based on the four products is shown in Fig 11.

thumbnail
Fig 11. Comparison of price forecast results of four kinds of seasonal products.

https://doi.org/10.1371/journal.pone.0339155.g011

Figs 11 (a), 11 (b), 11 (c), and 11 (d) respectively show the comparison of retail price prediction algorithms for four seasons: spring, summer, autumn, and winter. The findings denoted that the improved HPO-LSTM algorithm exhibited the highest accuracy in predicting all seasons, with the smallest error between predicted prices and actual prices. On spring coat 1, the actual price was 200.5 yuan, and the improved HPO-LSTM algorithm predicted 201.2 yuan, with an error of only 0.7 yuan. Meanwhile, the improved HPO-LSTM algorithm had a smaller error range. For example, on summer clothing 1, the error was only 0.47 yuan, while the error of the LSTM algorithm reached7.4 yuan; On the winter coat 3, the error of the improved HPO-LSTM algorithm was only 1.8 yuan. Finally, the improved HPO-LSTM showed high stability in different seasons, price ranges, and product types, with errors of less than 1 yuan in low-priced products in spring and autumn. In the high priced winter products, such as the improved HPO-LSTM on Winter Coat 3, the error was only 1.8 yuan, significantly lower than other algorithms. Finally, the actual business data of four algorithms were compared and the results are shown in Fig 12.

thumbnail
Fig 12. Comparison of actual service data based on four algorithms.

https://doi.org/10.1371/journal.pone.0339155.g012

Fig 12 (a) shows a comparison of inventory cost reduction, promotion cost reduction, and sales revenue increase. The findings denoted that the improved HPO-LSTM significantly reduced inventory backlog and inventory costs by 15.2% by accurately predicting demand. At the same time, by reducing unnecessary promotional frequency, promotional costs were reduced by 20.3%; In addition, the improvement of HPO-LSTM significantly increased sales (15.4%) by optimizing product pricing and promotion strategies, while also increasing average order value and sales volume. Fig 12 (b) shows a comparison of profit growth, inventory turnover improvement, and shortage rate reduction. The results showed that improved HPO-LSTM directly promoted enterprise profit growth (20.4%), while the profit growth of LSTM was only 10.1%. Simultaneously, accurately predicting demand using improved HPO-LSTM reduced inventory backlog and increased inventory turnover by 50.3%, significantly outperforming other algorithms; Finally, by making more accurate price predictions, the shortage phenomenon was reduced, and the shortage rate decreased by 7.2%.

4 Discussion and conclusion

To improve the accuracy and efficiency of enterprise retail price prediction, the HPO algorithm combined with LSTM algorithm was studied, and attention mechanism and Q-learning algorithm were introduced to optimize the HPO-LSTM algorithm. The optimized algorithm was applied to the prediction of enterprise retail prices. In the research results, there was a significant negative correlation (−0.854) between product prices and market sales, indicating that price is a key factor affecting sales. In addition, product evaluation was positively correlated with market sales (0.721), indicating that consumer satisfaction with the product directly affects purchasing decisions. In terms of performance evaluation of the algorithm, the improved HPO-LSTM had the highest accuracy and recall, with converged values of 0.972 and 0.921, respectively. This is similar to the research results in reference [28], which optimized the prediction model of the nonlinear autoregressive neural network to make the model more accurate in predicting products such as crude oil. Unlike the research, this study not only optimized the parameters but also optimized the network structure of the model. In terms of predicting retail prices for enterprises, the improved HPO-LSTM algorithm had the best predictive ability, with an error of only 0.7 yuan in spring coat 1. In winter coat 3, the error was 1.8 yuan. Finally, in practical business applications, the improved HPO-LSTM algorithm could significantly reduce inventory costs (15.2%) and promotion costs (20.3%), while increasing sales revenue (15.4%). This is basically consistent with the results of Harshith N et al., who predicted the annual price of a certain product in 2022 through a stacked LSTM model. The results show that after using this prediction model, the cost has been reduced to a certain extent. Unlike research, reference [29] focused on the agricultural field in terms of research background and objectives, especially the price prediction of cumin. At the same time, this study used time-series data from 2002 to 2021, with a larger time span and data volume; However, reference [26] did not show significant growth in sales, which may be due to the failure of the company’s business strategy to optimize and adjust according to the predicted results, resulting in a less significant effect on the increase in sales.

The above research results indicate that the improved HPO-LSTM algorithm performs well in prediction accuracy and robustness, and can maintain high prediction accuracy in different seasons, price ranges, and product types. At the same time, it can bring significant economic benefits to enterprises, such as reducing inventory costs, promotion costs, and increasing sales and profits. However, despite achieving good results in the research, there are still certain shortcomings. There is still room for improvement in terms of data volume and time span, and the generalization ability of the model has not been fully validated in a wider market environment. Future research will expand the dataset size, further optimize the model structure to raise its adaptability and generalization ability in different market environments, and explore more dynamic relationships between influencing factors and retail prices, providing more comprehensive support for accurate pricing and market strategies of enterprises.

References

  1. 1. İnce MN, Taşdemir Ç. Forecasting retail sales for furniture and furnishing items through the employment of multiple linear regression and holt–winters models. Systems. 2024;12(6):219.
  2. 2. Cao H, Wu Y, Bao Y, Feng X, Wan S, Qian C. UTrans-Net: A model for short-term precipitation prediction. AIA. 2022;1(2):90–7.
  3. 3. Chi M, Zeng X, Gao Y, Li W, Jiang H, Sun R. The erosion rate prediction for the elbow in shale gas gathering and transportation system: RSM and GA-BP-ANN modeling. Powder Technol. 2024;435:119429.
  4. 4. Nair AJ, Manohar S. Green service consumption: Unlocking customer expectations on technological transformations enhancing purchase experience in retail store. Int. J. Inf. Manag. Data Insights. 2024;4(2):100277.
  5. 5. Liu Q, Jia M, Guo X, Liu Y, Gao Z, Xu L. Two-dimensional LSTM soft sensor using noisy process data. Meas Sci Technol. 2024;35(8):085001.
  6. 6. Shi J, Wang S, Qu P, Shao J. Time series prediction model using LSTM-Transformer neural network for mine water inflow. Sci Rep. 2024;14(1):18284. pmid:39112684
  7. 7. Kożuch A, Cywicka D, Adamowicz K. A Comparison of artificial neural network and time series models for timber price forecasting. Forests. 2023;14(2):177.
  8. 8. Wang K, Yu M, Niu D, Liang Y, Peng S, Xu X. Short-term electricity price forecasting based on similarity day screening, two-layer decomposition technique and Bi-LSTM neural network. Appl. Soft Comput. 2023;136:110018.
  9. 9. Xu X, Zhang Y. Office property price index forecasting using neural networks. JFMPC. 2023;29(1):52–82.
  10. 10. Lahaghi SAM, Azad-Farsani E. Intelligent price optimization in smart distribution networks: a risk-sensitive cheetah hunter optimization algorithm for distribution locational marginal price assessment. AUT J. Electr. Eng. 2025;57(1):203–20.
  11. 11. Xu X, Zhang Y. China mainland new energy index price forecasting with the neural network. Energy Nexus. 2023;10:100210.
  12. 12. Yue W, Zhong W, Xiaoyi W, Xinyu K. Multi-step-ahead and interval carbon price forecasting using transformer-based hybrid model. Environ Sci Pollut Res Int. 2023;30(42):95692–719. pmid:37558913
  13. 13. Uygun Y, Sefer E. Financial asset price prediction with graph neural network-based temporal deep learning models. Neural Comput & Applic. 2025;37(30):25445–71.
  14. 14. Abang SO, Arasomwan KO, Ayodele O, Omang NS. Price stickiness-income inequality nexus, impact on monetary policy in Nigeria. MJDE. 2024;1(3):164–83.
  15. 15. Wu L, Xu C, Zhu Q, Zhou D. Multiple energy price distortions and improvement of potential energy consumption structure in the energy transition. Appl. Energy. 2024;362:122992.
  16. 16. Kurani A, Doshi P, Vakharia A, Shah M. A comprehensive comparative study of artificial neural network (ANN) and support vector machines (SVM) on stock forecasting. Ann Data Sci. 2021;10(1):183–208.
  17. 17. Xu X, Zhang Y. Regional steel price index forecasts with neural networks: evidence from east, south, north, central south, northeast, southwest, and northwest China. J Supercomput. 2023;79(12):13601–19.
  18. 18. Xu X, Zhang Y. Steel price index forecasting through neural networks: the composite index, long products, flat products, and rolled products. Miner Econ. 2022;36(4):563–82.
  19. 19. Fadlan A, Lubis RP, Tarigan MH. Effect of production and capital on The Farmers’ Welfare in Klambir V Kebun Village, North Sumatra. JMM. 2025;8(1):54–63.
  20. 20. Hassan MH, Daqaq F, Kamel S, Hussien AG, Zawbaa HM. An enhanced hunter‐prey optimization for optimal power flow with FACTS devices and wind power integration. IET Generation Trans. Dist. 2023;17(14):3115–39.
  21. 21. Xu Y, Cao H, Shi J, Pei S, Zhang B, She K. A comprehensive multi-parameter optimization method of squeeze film damper-rotor system using hunter-prey optimization algorithm. Tribol. Int. 2024;194:109538.
  22. 22. Hou W, Wang J, Lin Q, Wang X, Huang L. Improving clinical foundation models with multi-modal learning and domain adaptation for chronic disease prediction. IEEE J Biomed Health Inform. 2025;PP:10.1109/JBHI.2025.3595140. pmid:40758490
  23. 23. Xing Y. Work scheduling in cloud network based on deep Q-LSTM models for efficient resource utilization. J Grid Comput. 2024;22(1).
  24. 24. Sharma A, Balasubramanian V, Kamruzzaman J. A temporal deep Q learning for optimal load balancing in software-defined networks. Sensors (Basel). 2024;24(4):1216. pmid:38400374
  25. 25. Chen Z, Xiao F, Wang X, Deng M, Wang J, Li J. Stochastic configuration network based on improved whale optimization algorithm for nonstationary time series prediction. J. Forecasting. 2022;41(7):1458–82.
  26. 26. Arista A, Theresiawati T, Seta HB. Big mart sales data visualization and correlation. JOIV : Int J Inform Visualization. 2024;8(2):576.
  27. 27. Xiao F, Chen S, Chen Z, Wang Y, Wang J. An interpretable data-driven approach for customer purchase prediction using cost-sensitive learning. Eng. Appl. Artif. Intell. 2024;138:109344.
  28. 28. Jin B, Xu X. Price forecasting through neural networks for crude oil, heating oil, and natural gas. Measurement: Energy. 2024;1:100001.
  29. 29. Harshith N, Kumari P. Memory based neural network for cumin price forecasting in Gujarat, India. J. Agric. Food Res. 2024;15:101020.