Next Article in Journal
Estimation of Hub Center Loads for Individual Pitch Control for Wind Turbines Based on Tower Loads and Machine Learning
Previous Article in Journal
An Improved Retinex-Based Approach Based on Attention Mechanisms for Low-Light Image Enhancement
Previous Article in Special Issue
Utilizing TGAN and ConSinGAN for Improved Tool Wear Prediction: A Comparative Study with ED-LSTM, GRU, and CNN Models
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Forecasting Flower Prices by Long Short-Term Memory Model with Optuna

1
PhD Program in Strategy and Development of Emerging Industries, National Chi Nan University, Nantou 54561, Taiwan
2
Department of Information Management, National Chi Nan University, Nantou 54561, Taiwan
*
Author to whom correspondence should be addressed.
Electronics 2024, 13(18), 3646; https://doi.org/10.3390/electronics13183646
Submission received: 25 July 2024 / Revised: 7 September 2024 / Accepted: 11 September 2024 / Published: 13 September 2024
(This article belongs to the Special Issue New Advances in Machine Learning and Its Applications)

Abstract

:
The oriental lily ‘Casa Blanca’ is one of the most popular and high-value flowers. The period for keeping these flowers refrigerated is limited. Therefore, forecasting the prices of oriental lilies is crucial for determining the optimal planting time and, consequently, the profits earned by flower growers. Traditionally, the prediction of oriental lily prices has primarily relied on the experience and domain knowledge of farmers, lacking systematic analysis. This study aims to predict daily oriental lily prices at wholesale markets in Taiwan using many-to-many Long Short-Term Memory (MMLSTM) models. The determination of hyperparameters in MMLSTM models significantly influences their forecasting performance. This study employs Optuna, a hyperparameter optimization technique specifically designed for machine learning models, to select the hyperparameters of MMLSTM models. Various modeling datasets and forecasting time windows are used to evaluate the performance of the designed many-to-many Long Short-Term Memory with Optuna (MMLSTMOPT) models in predicting daily oriental lily prices. Numerical results indicate that the developed MMLSTMOPT model achieves highly satisfactory forecasting accuracy with an average mean absolute percentage error value of 12.7%. Thus, the MMLSTMOPT model is a feasible and promising alternative for forecasting the daily oriental lily prices.

1. Introduction

In Taiwan, oriental lilies are highly popular and represent a significant portion of the fresh flowers traded in auction markets. Oriental lilies hold considerable value as agricultural products due to their ornamental and symbolic significance, making them suitable for a variety of occasions, including weddings, funerals, birthday parties, and festive celebrations. As high-value crops, flowers are among the most important agricultural products in Taiwan.
Currently, the production and marketing of flowers in Taiwan involve cultivating and harvesting crops, followed by distribution through five major flower auction markets located in Taipei, Taichung, Changhua, Tainan, and Kaohsiung. Farmers typically decide which wholesale market to transport their flowers based on recent trading prices. Alternatively, farmers may store flowers in cold storage and wait for better prices. However, marketing strategies are usually based on farmers’ experiences, and misjudgments can result in profit losses. Therefore, a reliable price forecasting method is essential to help farmers accurately capture flower auction prices and develop effective sales strategies to increase their profits.
Sun et al. [1] and Wang et al. [2] have conducted comprehensive reviews of price forecasting for various agricultural products, including soybean [3,4,5,6,7,8], cabbage or vegetable [9,10,11,12,13], potato [10,14], pork [10,15,16], egg [17,18], fish [10], garlic [19], corn [3,8,20], carrot [21], apple [22], orange [23], cassava [24], and cotton and coffee [3]. However, studies on forecasting flower prices, particularly for oriental lilies, are limited. Factors affecting flower prices encompass both supply and demand aspects, such as climate change, pests and diseases, seedling sources, planting area, holidays [25], policy factors [26], and population sizes [27]. Therefore, predicting prices for flowers and other agricultural products is inherently challenging.
Methods for predicting agricultural product prices can be categorized into three main types: traditional forecasting methods, intelligent forecasting methods, and hybrid forecasting methods [1,2]. Traditional methods are statistically based, such as the Autoregressive Integrated Moving Average (ARIMA) model. For instance, Kathayat and Dixit [28] used the ARIMA model to predict wholesale rice prices for the following year, demonstrating that the model was suitable for regions with distinct seasonal price variations. Agbo [29] utilized ARIMA models to forecast the price fluctuations of various crops, including green beans, tomatoes, onions, oranges, grapes, and strawberries. The study demonstrated that ARIMA models are generally effective for most of these crops. In contrast, Zhao [30] found that support vector machines (SVMs) outperformed ARIMA in univariate models for agricultural price forecasting. Recently, the long short-term memory (LSTM) model has gained popularity in this field. Yuan and Ling [31] showed that LSTM models provide superior accuracy compared to ARIMA, support vector regression, Prophet, and extreme gradient boosting when forecasting multi-factor data. In another study, Purohit et al. [32] developed a hybrid model that combined ARIMA, LSTM, and SVM to forecast vegetable prices in India, achieving better forecasting accuracy than any single model. Similarly, Guo et al. [20] designed a hybrid model integrating LSTM, ARIMA, and backpropagation neural networks to predict corn prices, with results indicating satisfactory forecasting performance. However, Nassar et al. [33] argued that a simple LSTM model could outperform more complex hybrid networks in certain scenarios. Harshith and Kumari [34] proposed a stacked LSTM model using daily data to predict cumin prices, finding it superior to other models for long-term predictions. Zhang and Tang [35] developed a hybrid model with quadratic decomposition technology to forecast agricultural products like wheat, corn, and sugar, achieving higher predictive accuracy than other models. Zhang et al. [36] utilized an LSTM model to predict the prices of six different types of vegetables in Beijing. Their findings demonstrated that the LSTM model outperformed other time-series machine learning models, including Convolutional Neural Network (CNN), Support Vector Regression (SVR), and eXtreme Gradient Boosting (XGBoost), in terms of prediction accuracy. Similarly, Kang et al. [37] developed an LSTM model for predicting banana prices, incorporating a chaotic particle swarm algorithm to optimize the hyperparameters. The experimental results indicated that the hyperparameter-optimized LSTM model achieved superior accuracy and stability in predicting banana prices. Rana et al. [38] employed the LSTM model to forecast spinach prices, reporting that it provided more accurate results than the ARIMA and random forest models. Furthermore, this study pointed out that properly selecting hyperparameters for LSTM models can improve forecasting performance. The investigation revealed that the LSTM model is a very promising method for forecasting prices of agricultural products [38,39,40].
The aim of this study is to employ MMLSTM (many-to-many Long Short-Term Memory) models using daily transaction prices of oriental lilies collected at the Taipei flower wholesale market. Various modeling datasets and forecasting time windows are performed to evaluate forecasting performance. Additionally, the Optuna framework [41] is utilized to optimize the hyperparameters of MMLSTM, namely, MMLSTMOPT, models for predicting daily oriental lily prices. The hyperparameters optimized for the MMLSTMOPT models include the optimizer, the number of neurons in MMLSTM layers, the number of neurons in the fully connected layer, the loss function, the number of epochs, the batch size, and the learning rate. A brief summary of results obtained by MMLSTMOPT, MMLSTM, ARIMA, and Prophet [42] is illustrated in Table 1.
The structure of this study is as follows: Section 2 describes the long short-term memory method and the Optuna framework. Section 3 presents the proposed MMLSTMOPT models for predicting oriental lily prices. Section 4 discusses the numerical results and findings. Finally, conclusions are presented in Section 5.

2. Long Short-Term Memory and the Optuna Framework

2.1. Long Short-Term Memory

The long short-term memory model [43] is a variant of recurrent neural networks commonly used for handling sequential data. Compared to recurrent neural networks, LSTM models can capture long-term dependencies [44], and are suitable for processing time-series data. The LSTM model consists of one or more LSTM units, as illustrated in Figure 1. Each unit contains three key gates, namely, the forget gate, the input gate, and the output gate [45,46]. Gates help control the flow of information and effectively capture long-term dependencies within the sequence. In an LSTM unit, the forget gate and the input gate receive the current and previous hidden states then turn out to be the unit’s current state. Subsequently, the unit’s state is propagated sequentially and transmits information with minimal decay. Therefore, the unit can retain information over extended time periods. The mathematical representation of LSTM models is given by Equations (1)–(6).
f t = σ w f x x t + w f h h t 1 + b f
i t = σ w i x x t + w i h h t 1 + b i
g t = t a n h ( w g x x t + w g h h t 1 + b g )
o t = σ ( w o x x t + w o h h t 1 + b o )
C t = g t i t + C t 1 f t
h t = t a n h ( C t ) o t
where W is the weight, b denoted the bias, σ represents the sigmoid function, C t 1 is the cell state at time t 1 , h t 1 is the hidden state at time t 1 , x t expresses the input of the LSTM unit at the moment, f t is the output of the forget gate, i t is the output of the input gate, o t is the output of the output gate, C t is the current cell state, and h t is the current hidden state.

2.2. The Optuna Framework

The Optuna framework is a Python package designed for hyperparameter optimization [41], offering a simple and flexible interface for tuning machine learning models. The stages of the Optuna framework are depicted as follows. First, determine the hyperparameters, types of hyperparameters (such as integers, floats, and categorical values), and the searching boundaries for Optuna. Next, define an objective function that receives a trial as input and returns a value to be minimized or maximized. Optuna attempts to determine hyperparameters that optimize the objective function. The framework also allows users to query and record the values of hyperparameters during the optimization process. Finally, specify the number of Optuna trials to run. Additionally, some techniques, such as the timeout setting, sampling approaches, and pruning methods, can be used for adjusting the hyperparameters searching process. The sampling approaches include the random sampler, Tree-structured Parzen Estimator (TPE), Covariance Matrix Adaptation Evolution Strategy (CMA-ES), and grid sampler [41,47,48]. The pruning methods, which can terminate unsatisfactory trials early to save computational resources and time, include the base pruner, median pruner, successive halving pruner, hyperband pruner, threshold pruner, percentile pruner, and patient pruner [48,49].

3. The Proposed MMLSTMOPT Model for Forecasting Daily Oriental Lily Prices

In this study, the many-to-many long short-term memory (MMLSTM) model is employed to forecast the daily prices of oriental lilies. The Optuna framework is utilized to select the hyperparameters for the MMLSTM models. Figure 2 illustrates the developed MMLSTMOPT model for predicting daily prices of oriental lilies. The developed MMLSTMOPT model contains three parts, namely, data collection and preprocessing, determining, and training model, and performance evaluation. Historical price data from the past 7, 14, 21, and 28 days are used to predict prices for the following 1 to 7 days, resulting in a total of 28 different MMLSTMOPT models. In other words, four training datasets are employed to forecast seven time periods, respectively. The MMLSTMOPT model is performed by using Optuna to determine hyperparameters. Finally, the performance of MMLSTMOPT models is evaluated in forecasting daily prices of oriental lilies.

3.1. Data Collection and Preprocessing

The data collection period spanned from 1 January 2016, to 31 December 2020, during which a total of 1827 records of oriental lily auction average prices were gathered. The data were sourced from the “Agricultural Products Wholesale Market Transaction Information Network” (https://amis.afa.gov.tw accessed on 11 August 2023). A web scraping program was used to automatically extract daily auction daily average price data for various subcategories of oriental lilies. The data were gathered using a web scraping program built with the Selenium toolkit (https://www.selenium.dev/ accessed on 11 August 2023). The process involved first identifying the structure and locations of the target data on the webpage. The Selenium toolkit then simulated browser operations to automatically navigate to the relevant webpages and extract the necessary data. Due to the dynamic and complex nature of agricultural product transaction information, the automated program included error-handling mechanisms to address issues such as webpage loading delays or changes in data formats. The extracted data were then organized, and the daily prices of oriental lilies were compiled into structured datasets for the subsequent stage.
According to Chen et al. [50], data preprocessing, including handling missing values and data normalization, plays a crucial role in improving the accuracy and efficiency of forecasting models. The daily price data for oriental lilies contain missing values due to holidays when auctions do not occur, resulting in gaps in the transaction records. These missing values affect the accuracy of forecasting models [51,52]. One popular technique for addressing missing values of time-series data is the K-nearest neighbor (KNN) algorithm [53,54,55]. The KNN algorithm classifies data based on the Euclidean distance between data, and the average of K nearest samples serves as the missing value. In this study, the KNN approach was employed to address missing values. Missing values are calculated by the weighted imputation represented as Equation (7) [56].
y m i s s t * = j = 1 k w j u j j = 1 k w j
where y m i s s t * represents the estimated missing value at time t by a weighted mean, k indicates the number of closest observations employed, j is the observation of k , a n d   w j is the weight of the k -th closest neighbor observation with Equation (8).
w j   = 1 d ( y a j ,   y b j ) 2
where d y a j ,   y b j represents the distance between the missing data point and the j -th neighbor, and u j specifies the value corresponding to the j th nearest neighbor. Another essential data preprocessing procedure used in this investigation is normalization, which standardizes data to mitigate the influence of varying data distributions. Min–max normalization [57,58,59] was employed in this study to ensure that data from different ranges were standardized appropriately. The KNN algorithm and normalization were used in the data preprocessing stage. Then, the preprocessed data were input into MMLSTM models and MMLSTMOPT models. The values of preprocessed data were fixed after the KNN algorithm and normalization were conducted.
The data were separated into three parts, namely, the training dataset, the validation dataset, and the testing dataset. The training data were used to determine MMLSTM hyperparameters and to train the MMLSTM models. The wholesale price data from 2016 to 2018 were designated as the training dataset. The validation dataset was used to avoid overfitting during the training process, with the wholesale price data from 2019 serving this purpose. The model with the smallest loss on the validation data was selected for forecasting. To evaluate the forecasting performance, the wholesale price data in 2020 were designated as the testing dataset. The testing datasets are used to evaluate the finalized MMLSTMOPT models.

3.2. The Many-to-Many LSTM Model

LSTM models perform various time-series prediction tasks, including one-to-one, one-to-many, many-to-many, and many-to-one modes. Rao and Reimher [60] employed neural networks to develop a non-linear function-on-function regression model. The study pointed out that the proposed model is able to cope with many-to-many time-series data. Forecasting the next value based on the current data point, the one-to-one LSTM is the simplest model and is applicable to single-step prediction in time series [61]. The one-to-many LSTM model generates a series of future values from a single time point [62]. The many-to-many LSTM model includes two different types: the equal-length sequences model and the different-length sequences model. For the equal-length sequences model, the input and output sequences are of the same length, commonly used for synchronous transformations in time series. The different length sequences model is typically used in tasks like machine translation, where a sentence in one language is translated into another language with a potentially different number of words [63]. The many-to-one LSTM model has multiple inputs corresponding to a single output and is useful in tasks where predictions are based on a series of historical data points [64].
In this study, the many-to-many LSTM (MMLSTM) models were employed to forecast daily oriental lily prices. Figure 3 illustrates 28 MMLSTM models with various input and output data lengths used for predicting the daily prices of oriental lilies. The many-to-many model features an encoder–decoder structure, which consists of an encoder, an intermediate vector, and a decoder. Both the encoder and the decoder consist of one or more layers of LSTM structures [65]. The specific MMLSTM model used in this study has six layers. Figure 4 presents the six-layer MMLSTM model to forecast daily oriental lily prices. The MMLSTM model uses 7 days of daily oriental lily prices for modeling and forecasting the prices for the following 7 days. The Optuna was employed to determine the hyperparameters of the second layer, the fourth layer, and the fifth layer. The first layer is an input layer. The second layer acts as the initial layer of the sequence-to-sequence model and functions as the encoder in the prediction model. In this study, the model receives input data of historical prices with ranges of 7 days, 14 days, 21 days, and 28 days, resulting in four different modeling datasets. This layer processes these historical price sequences and only returns the output of the last time step. This setup allows the model to integrate the entire historical data sequence to predict the next time point. The third layer expands the single output from the previous LSTM layer into a repeated sequence of the same length as the target output sequence. The third layer provides the following LSTM layer with an input of equal length to the expected target sequence. By converting a single-point output into a multi-point sequence, the third layer ensures a valid correspondence between input and output during the sequence-to-sequence learning process. The fourth layer serves as the decoder with the ability to generate sequences step by step. This layer not only produces output at each time step but also uses the current output as the input for the next time step. This process continues until the complete sequence is generated. The fifth layer is a time-distributed layer. In this layer, a time-distributed wrapper is employed, allowing a fully connected layer to operate independently at each time step of the sequence. This configuration enables the independent processing of each part of the sequence while maintaining overall time-series learning. This mechanism enhances the model’s ability to capture overall trends and perform the forecasting task accurately. The final layer is a time-distributed dense layer. The time-distributed wrapper is used in this layer to apply a fully connected layer with one output neuron at each time step. This configuration enables the model to predict a value independently and continuously at each time step. The example of Figure 4 depicts the MMLSTM architecture used in this study. In the first layer, each sequence has seven time steps and each time step has one feature. The second layer processes the input data and outputs a feature vector with 440 units. The third layer receives the output from the second layer and repeats the function to match the length of the sequence with seven time steps with 440 units for each time step. The third layer prepares data for the decoder of the model. The fourth layer takes the repeated sequence data and outputs a feature vector with 440 units for each time step. The fifth layer applies a dense layer to each time step in the sequence and reduces the feature vector dimension to 220. The final layer further reduces the feature vector at each time step to a single output with seven time steps. Notably, the MMLSTM architecture in this study did not use forecasted values for predictions. Figure 5 presents an example of using 7 days of daily oriental lily prices for modeling and forecasting prices for the next 7 days.

3.3. The Determination of Hyperparameters by Optuna for MMLSTMOPT Models

The Optuna framework was employed in this study to select hyperparameters for the MMLSTMOPT models, as depicted in the flowchart shown in Figure 6. The arrows in this diagram are data flows. The optimizer, the number of neurons in the MMLSTM layers, the number of neurons in the fully connected layer, the loss function, the number of epochs, the batch size, and the learning rate are included for the hyperparameters optimized of the MMLSTMOPT models. The optimizers including Adam (Adaptive Moment Estimation), Adagrad (Adaptive Gradient Algorithm), RMSprop, and (Root Mean Square Propagation) are used to adjust the weights of models to minimize the loss function. This process involves continuously updating the model weights to approximate the optimal solution. Various optimizers employ distinct strategies to adjust weights, thereby influencing the model’s training speed, stability, and overall performance. The number of neurons in the MMLSTM layer significantly influences the model’s learning capacity. Increasing the number of neurons can enhance this capacity but also raises the risk of overfitting and increases computational costs. Conversely, reducing the number of neurons can help prevent overfitting and improve the model’s generalization ability, though it may introduce the risk of underfitting. In the fully connected layer, each neuron connects to all neurons in the previous layer, integrating learned features for prediction. Selecting the appropriate number of neurons is crucial for effective forecasting tasks. The loss function measures the difference between predicted and actual values. A smaller set of loss function values indicates a closer match between predicted and actual values, reflecting better model performance. The minimization of loss function values is performed using learning algorithms. Mean Squared Error (MSE) and Mean Absolute Error (MAE) were employed as loss functions, expressed in categorical terms. The number of epochs indicates a complete pass through the entire training dataset, with the model learning from the training samples during each epoch. Training the model over multiple epochs enables it to gradually learn the data patterns. However, excessive training can lead to overfitting. The batch size refers to the number of data samples processed during each training iteration. The selection of batch size affects learning efficiency, memory usage, and overall performance. The learning rate controls the step size while moving toward the minimum of the loss function. A high learning rate may cause the model to diverge and oscillate around the minimum loss. Conversely, a low learning rate can slow the learning process, increasing the time required to reach the minimum loss. Table 2a lists the hyperparameter types and their search ranges for the MMLSTMOPT model, while Table 2b illustrates the hyperparameter settings for the MMLSTM model.

4. Numerical Results and Discussion

4.1. Numerical Results

The forecasting performance in this study is evaluated using several measurements, including mean squared error (MSE), mean absolute error (MAE), root mean squared error (RMSE), mean absolute percentage error (MAPE), and the coefficient of determination (R2) [66,67,68]. Equations (9) to (13) depict these measurements.
M S E = 1 n n i = 1 y i y ~ i 2
M A E = 1 n n i = 1 | y i y ~ i |
R M S E = 1 n n i = 1 y i y ~ i 2
M A P E = 1 n   n i = 1   y i y ~ i y i × 100 %
R 2 = 1 i = 1 n ( y i y ~ i ) 2 i = 1 n ( y i y ¯ ) 2
where y i represents the actual daily oriental lily price, y ~ i is the predicted daily oriental lily price, n represents the number of samples, and y ¯ is the average of the actual daily oriental lily prices.
Table 3 presents the selected hyperparameters for the MMLSTMOPT models. These hyperparameters include the optimizer, the number of neurons in the first and second MMLSTMOPT layers, the number of neurons in the fully connected layer, the loss function, the number of epochs, the batch size, and the learning rate. Generally, each model utilized different combinations of these hyperparameters for the forecasting tasks. Table 4 shows the importance of each hyperparameter for the MMLSTMOPT models, highlighting that the learning rate is crucial for most models. Figure 7 visualizes the average importance of each hyperparameter and illustrates that the learning rate and the optimizer are two critical hyperparameters in this study.
Appendix A includes Table A1, Table A2, Table A3 and Table A4, which present the MSE, MAE, RMSE, and R2 of MMLSTMOPT models using various modeling datasets and forecasting time windows. For these datasets, the MMLSTMOPT models consistently outperform the MMLSTM models in terms of the average values for five measurements. Additionally, using 21 days of modeling data yields more accurate results on average for both MMLSTM and MMLSTMOPT models compared to the other three modeling datasets. MAPE values, calculated using actual values as a denominator, are not influenced by the magnitude of the actual values, making them more objective for comparing forecasting performance. Table 5 shows that MMLSTMOPT models achieve superior performance over MMLSTM models according to MAPE values across corresponding datasets and forecasting time windows. This suggests that using Optuna to determine hyperparameters improves the forecasting accuracy of MMLSTM models. Figure 8 visualizes the data from Table 5. Figure 9 and Figure 10 illustrate the point-to-point comparisons of actual and predicted values for MMLSTM and MMLSTMOPT models across different forecasting time windows, using 21 days of modeling data.
The findings of this study are as follows. First, the determination of hyperparameters is an NP-Hard problem [69]. Therefore, using Optuna is an effective and efficient method for optimizing hyperparameters in MMLSTM models. Secondly, the Adagrad optimizer was consistently selected by Optuna for all forecasting models in this study, aligning with conclusions drawn by Anh et al. [70] and Kothona et al. [71]. Finally, using data of 21 days for modeling both MMLSTM and MMLSTMOPT models resulted in better average forecasting performance compared to other datasets across various forecasting time windows. It is noteworthy that the bulbs of oriental lilies typically take about 20 to 30 days to grow, with most fresh lilies sold in the market being harvested at the bud stage around 20 days.
The ARIMA (Autoregressive Integrated Moving Average) method [72] and the Prophet model [42] were employed to compare results obtained by MMLSTM models and MMLSTMOPT models. The data from 2016, 2017, 2018, and 2019 were used as the modeling dataset. The data from 2020 were employed to evaluate the performance of the ARIMA and Prophet models. Three parameters, p, d, and q, of the ARIMA model were selected to perform the forecast of daily oriental lily prices. The p, d, and q represent the number of autoregressive terms, the number of nonseasonal differences needed for stationarity, and the number of lagged forecast errors in the prediction equation, respectively. In this study, the first-order difference was applied to make the time series stationary. Then, the parameters (p, q) were evaluated based on the Bayesian Information Criterion (BIC). Finally, parameters, p, d, and q are 3, 1, and 1, correspondingly. The generation of the Prophet model does not require prior analysis of the stationarity of the time series [73,74]. Table 6 displays the performance of the ARIMA model and the Prophet model in predicting daily oriental lily prices.

4.2. A Hypothetical Example

The growth period of oriental lilies lasts about 3–4 months, and they can be planted in Taiwan from mid-September to mid-March of the following year. Presume a lily florist who harvests 1000 lilies every morning, sends them directly to the wholesale market before noon, and settles the income based on that day’s actual market price. In order to increase the sales amounts, the florist evaluated the potential profitability of introducing NTD 200,000 worth of refrigerating equipment for storing 7000 lilies, and given the growth period of the lilies, Table 7 shows the two dummy strategies evaluated. Strategy A uses a risk-free approach in the absence of an accurate prediction method. This strategy involves harvesting 1000 lilies every morning as usual and sending them directly to the wholesale market before noon, with the income calculated based on that day’s market price. Over the course of 100 days, from 22 January 2020, to 30 April 2020, a total of 100,000 lilies were sold, generating a total income of NTD 12,566,000. Strategy B employs the MMLSTMOPT model provided by this study. The model utilizes the 21-day modeling prices to forecast the average prices from 1 day to 7 days. Lily flowers can be refrigerated for about 7 to 10 days, but considering the appearance of the flowers, the florist plans to refrigerate the flowers for no longer than 7 days. At most, oriental lilies are sent to the wholesale market on the 7th day and sold at the market price of that day. If the average 1–7 days forecasted price is the best within 7 days, the florist will sell the lilies. Over a span of 100 days, strategy B results in the sale of 100,000 lilies, generating a total income of NTD 12,926,000. Thus, strategy B leads to more income than strategy A. Strategy B can increase sales by NTD 360,000 compared to strategy A. After deducting the NTD 200,000 cost of the refrigerating equipment, the profit is NTD 160,000. Therefore, the presented MMLSTMOPT model is effective in improving the profits of oriental lily florists.

5. Conclusions

The fluctuation of wholesale prices for oriental lilies has significant implications for agricultural producers, distributors, and consumers. The ability to predict wholesale prices of oriental lilies can provide farmers with strategic insights for cultivation and sales planning. This study presents a feasible and promising MMLSTMOPT model for forecasting the daily prices of oriental lilies across various forecasting time windows, achieving satisfactory forecasting accuracy. The flexibility in forecasting time windows is beneficial for decision-makers in managing planting schedules, shipping times, and sales strategies to optimize profits. A hypothetical example was employed to demonstrate the merit of using the developed MMLSTMOPT model in increasing profit for florists. Furthermore, this study demonstrated that using Optuna to select hyperparameters for MMLSTM models can enhance forecasting accuracy. Actually, the MMLSTM can outperform the ARIMA model and the Prophet model in terms of all measurements.
The complexity of factors influencing oriental lilies’ wholesale prices encompasses major holidays, cultural festivals, economic conditions, flower quality, and climate. Instead of solely relying on time-series data, these factors can serve as independent variables to forecast the daily prices of oriental lilies. Utilizing other hyperparameter selection frameworks, such as SigOpt, Google Vizier, Keras Tuner, HyperOpt, and Scikit-Optimize, may present a viable direction for future research.

Author Contributions

Conceptualization, C.-H.C. and P.-F.P.; data curation, C.-H.C.; formal analysis, C.-H.C., Y.-L.L. and P.-F.P.; methodology, C.-H.C. and P.-F.P.; visualization, C.-H.C., Y.-L.L. and P.-F.P.; writing—original draft, C.-H.C., Y.-L.L. and P.-F.P.; writing—review and editing, C.-H.C., Y.-L.L. and P.-F.P. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Data is contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

Table A1. The performance of MMLSTMOPT models in terms of MSE.
Table A1. The performance of MMLSTMOPT models in terms of MSE.
DaysMMLSTMOPT Models
Forecasting1 Day2 Days3 Days4 Days5 Days6 Days7 DaysAverage
Modeling
7 days265.22386.76603.58666.99834.12930.541119.13686.62
14 days271.65482.66569.20822.44759.93825.221110.45691.65
21 days273.87374.01534.72721.81747.38731.371056.37634.22
28 days268.82464.83558.35601.81958.67851.451176.40697.19
Table A2. The performance of MMLSTMOPT models in terms of MAE.
Table A2. The performance of MMLSTMOPT models in terms of MAE.
DaysMMLSTMOPT Models
Forecasting1 Day2 Days3 Days4 Days5 Days6 Days7 DaysAverage
Modeling
7 days11.8714.3317.7218.7820.9623.4924.3218.78
14 days11.9716.2017.6521.1020.3122.8924.3119.21
21 days12.0313.9116.9119.5419.6919.7223.4017.89
28 days12.0016.0817.2818.3322.8620.9924.1018.81
Table A3. The performance of MMLSTMOPT models in terms of RMSE.
Table A3. The performance of MMLSTMOPT models in terms of RMSE.
DaysMMLSTMOPT Models
Forecasting1 Day2 Days3 Days4 Days5 Days6 Days7 DaysAverage
Modeling
7 days16.2919.6724.5725.8328.8830.5033.4525.60
14 days16.4821.9723.8628.6827.5728.7333.3225.80
21 days16.5519.3423.1226.8727.3427.0432.5024.68
28 days16.4021.5623.6324.5330.9629.1834.3025.79
Table A4. The performance of MMLSTMOPT models in terms of R2.
Table A4. The performance of MMLSTMOPT models in terms of R2.
DaysMMLSTMOPT Models
Forecasting1 Day2 Days3 Days4 Days5 Days6 Days7 DaysAverage
Modeling
7 days0.840.770.650.610.510.450.350.60
14 days0.840.720.670.520.560.520.360.60
21 days0.840.780.690.580.560.580.390.63
28 days0.840.720.670.640.440.500.310.59

References

  1. Sun, F.; Meng, X.; Zhang, Y.; Wang, Y.; Jiang, H.; Liu, P. Agricultural product price forecasting methods: A review. Agriculture 2023, 13, 1671. [Google Scholar] [CrossRef]
  2. Wang, L.; Feng, J.; Sui, X.; Chu, X.; Mu, W. Agricultural product price forecasting methods: Research advances and trend. Br. Food J. 2020, 122, 2121–2138. [Google Scholar] [CrossRef]
  3. Pinheiro, C.A.O.; Senna, V.d. Multivariate analysis and neural networks application to price forecasting in the Brazilian agricultural market. Ciência Rural 2017, 47, e20160077. [Google Scholar] [CrossRef]
  4. Zhang, D.; Zang, G.; Li, J.; Ma, K.; Liu, H. Prediction of soybean price in China using qr-rbf neural network model. Comput. Electron. Agric. 2018, 154, 10–17. [Google Scholar] [CrossRef]
  5. Fan, J.; Liu, H.; Hu, Y. Soybean future prices forecasting based on lstm deep learning. Prices Mon 2021, 2. [Google Scholar] [CrossRef]
  6. Li, J.; Li, G.; Liu, M.; Zhu, X.; Wei, L. A novel text-based framework for forecasting agricultural futures using massive online news headlines. Int. J. Forecast. 2022, 38, 35–50. [Google Scholar] [CrossRef]
  7. An, W.; Wang, L.; Zeng, Y.R. Text-based soybean futures price forecasting: A two-stage deep learning approach. J. Forecast. 2023, 42, 312–330. [Google Scholar] [CrossRef]
  8. Cheung, L.; Wang, Y.; Lau, A.S.; Chan, R.M. Using a novel clustered 3d-cnn model for improving crop future price prediction. Knowl.-Based Syst. 2023, 260, 110133. [Google Scholar] [CrossRef]
  9. Cao, S.; He, Y. Wavelet decomposition-based svm-arima price forecasting model for agricultural products. Stat. Decis. 2015, 92–95. [Google Scholar] [CrossRef]
  10. Xu, K. Short-Term Price Forecast Model for Fresh Agricultrual Products Based on Price Decomposition. Ph.D. Thesis, Chinese Academy of Agricultural Sciences, Beijing, China, 2016. [Google Scholar]
  11. Ye, L.; Qin, X.; Li, Y.; Liu, Y.; Liang, W. Vegetables price forecasting in hainan province based on linear and nonlinear combination model. In Proceedings of the 13th International Conference on Service Systems and Service Management (ICSSSM), Kunming, China, 24–26 June 2016; IEEE: Piscatawa, NJ, USA, 2016; pp. 1–5. [Google Scholar]
  12. Xiong, T.; Li, C.; Bao, Y. Seasonal forecasting of agricultural commodity price using a hybrid stl and elm method: Evidence from the vegetable market in China. Neurocomputing 2018, 275, 2831–2844. [Google Scholar] [CrossRef]
  13. Yin, H.; Jin, D.; Gu, Y.H.; Park, C.J.; Han, S.K.; Yoo, S.J. Stl-attlstm: Vegetable price forecasting using stl and attention mechanism-based lstm. Agriculture 2020, 10, 612. [Google Scholar] [CrossRef]
  14. Li, Z.; Xu, S.; Cui, L.; Zhang, J. Prediction study based on dynamic chaotic neural network—Taking potato time-series prices as an example. Syst. Eng.-Theory Pract. 2015, 35, 2083–2091. [Google Scholar]
  15. Li, Z.M.; Xu, S.W.; Cui, L.G.; Li, G.Q.; Dong, X.X.; Wu, J.Z. The short-term forecast model of pork price based on cnn-ga. Adv. Mater. Res. 2013, 628, 350–358. [Google Scholar] [CrossRef]
  16. Niu, C. Integration Prediction Method Research of Agricultural Products Market Price. Master’s Thesis, Central China Normal University, Wuhan, China, 2016. [Google Scholar]
  17. Li, Z.-M.; Cui, L.-G.; Xu, S.-W.; Weng, L.-y.; Dong, X.-x.; Li, G.-Q.; Yu, H.-P. Prediction model of weekly retail price for eggs based on chaotic neural network. J. Integr. Agric. 2013, 12, 2292–2299. [Google Scholar] [CrossRef]
  18. Gao, Y.; An, S. Comparative study on the predictive effect of the price of eggs in China—Comparative analysis based on bp neural network model and egg futures predictive model. Price Theory Pr. 2021, 4, 441. [Google Scholar]
  19. Wang, B.; Liu, P.; Chao, Z.; Junmei, W.; Chen, W.; Cao, N.; O’Hare, G.M.; Wen, F. Research on hybrid model of garlic short-term price forecasting based on big data. Comput. Mater. Contin. 2018, 57, 283–296. [Google Scholar] [CrossRef]
  20. Guo, Y.; Tang, D.; Tang, W.; Yang, S.; Tang, Q.; Feng, Y.; Zhang, F. Agricultural price prediction based on combined forecasting model under spatial-temporal influencing factors. Sustainability 2022, 14, 10483. [Google Scholar] [CrossRef]
  21. Xu, Y.; Wei, Y.; Li, X. Establishment of agricultural products, price prediction. Stat. Decis. 2017, 12, 75–77. [Google Scholar]
  22. Yu, X.H. Acquisition Price Forecast of Yantai Apple Based on bp Neural Network. Master’s Thesis, Beijing Jiaotong University, Beijing, China, 2012. [Google Scholar]
  23. Xie, J.Q. Research on Price Forecasting of Gannan Navel Based on bp Neural Network. Master’s Thesis, Huazhong Agricultural University, Wuhan, China, 2017. [Google Scholar]
  24. Polyiam, K.; Boonrawd, P. A hybrid forecasting model of cassava price based on artificial neural network with support vector machine technique. In Proceedings of the 3rd International Conference on Information Management (ICIM), Chengdu, China, 21–23 April 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 123–127. [Google Scholar]
  25. Zhang, M.; Huang, X.; Yang, C. A sales forecasting model for the consumer goods with holiday effects. J. Risk Anal. Crisis Response 2020, 10, 69–76. [Google Scholar] [CrossRef]
  26. Laibuni, N.; Waiyaki, N.; Ndirangu, L.; Omiti, J. Kenyan cut-flower and foliage exports: A cross country analysis. J. Dev. Agric. Econ. 2012, 4, 37–44. [Google Scholar]
  27. Zhao, S.; Yue, C.; Meyer, M.H.; Hall, C.R. Factors affecting us consumer expenditures of fresh flowers and potted plants. HortTechnology 2016, 26, 484–492. [Google Scholar] [CrossRef]
  28. Kathayat, B.; Dixit, A.K. Paddy price forecasting in india using arima model. J. Crop Weed 2021, 17, 48–55. [Google Scholar] [CrossRef]
  29. Mahmoud Sayed Agbo, H. Forecasting agricultural price volatility of some export crops in egypt using arima/garch model. Rev. Econ. Political Sci. 2023, 8, 123–133. [Google Scholar] [CrossRef]
  30. Zhao, H. Futures price prediction of agricultural products based on machine learning. Neural Comput. Appl. 2021, 33, 837–850. [Google Scholar] [CrossRef]
  31. Yuan, C.Z.; Ling, S.K. Long short-Term Memory Model Based Agriculture Commodity Price Prediction Application. In Proceedings of the 2nd International Conference on Information Technology and Computer Communications, Online, 12–14 August 2020; pp. 43–49. [Google Scholar]
  32. Purohit, S.K.; Panigrahi, S.; Sethy, P.K.; Behera, S.K. Time series forecasting of price of agricultural products using hybrid methods. Appl. Artif. Intell. 2021, 35, 1388–1406. [Google Scholar] [CrossRef]
  33. Nassar, L.; Okwuchi, I.E.; Saad, M.; Karray, F.; Ponnambalam, K. Deep Learning Based Approach for Fresh Produce Market Price Prediction. In Proceedings of the International Joint Conference on Neural Networks (IJCNN), Glasgow, UK, 19–24 July 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 1–7. [Google Scholar]
  34. Harshith, N.; Kumari, P. Memory based neural network for cumin price forecasting in Gujarat, India. J. Agric. Food Res. 2024, 15, 101020. [Google Scholar] [CrossRef]
  35. Zhang, T.; Tang, Z. Agricultural commodity futures prices prediction based on a new hybrid forecasting model combining quadratic decomposition technology and lstm model. Front. Sustain. Food Syst. 2024, 8, 1334098. [Google Scholar] [CrossRef]
  36. Zhang, Q.; Yang, W.; Zhao, A.; Wang, X.; Wang, Z.; Zhang, L. Short-term forecasting of vegetable prices based on lstm model—Evidence from Beijing’s vegetable data. PLoS ONE 2024, 19, e0304881. [Google Scholar] [CrossRef]
  37. Kang, J.; Xu, N.; Li, X. Banana price prediction based on chaotic particle swarm lstm. In Proceedings of the 2024 International Conference on Computer and Multimedia Technology, Sanming, China, 24–26 May 2024; pp. 540–546. [Google Scholar]
  38. Rana, H.; Farooq, M.U.; Kazi, A.K.; Baig, M.A.; Akhtar, M.A. Prediction of agricultural commodity prices using big data framework. Eng. Technol. Appl. Sci. Res. 2024, 14, 12652–12658. [Google Scholar] [CrossRef]
  39. Jaiswal, R.; Jha, G.K.; Kumar, R.R.; Choudhary, K. Deep long short-term memory based model for agricultural price forecasting. Neural Comput. Appl. 2022, 34, 4661–4676. [Google Scholar] [CrossRef]
  40. Chen, C.-H. Using lstm Model with Optuna for Predicting Flower Wholesale Prices. Ph.D. Thesis, National Chi Nan University, Puli Township, Taiwan, 2024, (unpublished doctoral dissertation). [Google Scholar]
  41. Akiba, T.; Sano, S.; Yanase, T.; Ohta, T.; Koyama, M. Optuna: A next-generation hyperparameter optimization framework. In Proceedings of the 25th ACM SIGKDD International Conference On Knowledge Discovery & Data Mining, Anchorage, AK, USA, 4–8 August 2019; pp. 2623–2631. [Google Scholar]
  42. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [PubMed]
  43. Fang, W.; Chen, Y.; Xue, Q. Survey on research of rnn-based spatio-temporal sequence prediction algorithms. J. Big Data 2021, 3, 97. [Google Scholar] [CrossRef]
  44. Alom, M.Z.; Taha, T.M.; Yakopcic, C.; Westberg, S.; Sidike, P.; Nasrin, M.S.; Hasan, M.; Van Essen, B.C.; Awwal, A.A.; Asari, V.K. A state-of-the-art survey on deep learning theory and architectures. Electronics 2019, 8, 292. [Google Scholar] [CrossRef]
  45. Lindemann, B.; Müller, T.; Vietz, H.; Jazdi, N.; Weyrich, M. A survey on long short-term memory networks for time series prediction. Procedia CIRP 2021, 99, 650–655. [Google Scholar] [CrossRef]
  46. Bergstra, J.; Bardenet, R.; Bengio, Y.; Kégl, B. Algorithms for hyper-parameter optimization. In Proceedings of the Advances in Neural Information Processing Systems 24 (NIPS 2011), Granada, Spain, 12–14 December 2011. [Google Scholar]
  47. Niu, Q.; Wang, Z.; Li, H.; Zhao, J. A parameters optimization framework for pose estimation algorithm based on point cloud. J. Phys. Conf. Ser. 2024, 2746, 012039. [Google Scholar] [CrossRef]
  48. Jeba, J.A. Case Study of Hyperparameter Optimization Framework Optuna on a Multi-Column Convolutional Neural Network. Master’s Thesis, University of Saskatchewan, Saskatoon, SK, Canada, 2021. [Google Scholar]
  49. Chen, C.-H.; Lai, J.-P.; Chang, Y.-M.; Lai, C.-J.; Pai, P.-F. A study of optimization in deep neural networks for regression. Electronics 2023, 12, 3071. [Google Scholar] [CrossRef]
  50. Shin, D.-H.; Chung, K.; Park, R.C. Prediction of traffic congestion based on lstm through correction of missing temporal and spatial data. IEEE Access 2020, 8, 150784–150796. [Google Scholar] [CrossRef]
  51. Lu, X.; Yuan, L.; Li, R.; Xing, Z.; Yao, N.; Yu, Y. An improved bi-lstm-based missing value imputation approach for pregnancy examination data. Algorithms 2022, 16, 12. [Google Scholar] [CrossRef]
  52. Yan, J.; Gao, Y.; Yu, Y.; Xu, H.; Xu, Z. A prediction model based on deep belief network and least squares svr applied to cross-section water quality. Water 2020, 12, 1929. [Google Scholar] [CrossRef]
  53. Shao, B.; Song, D.; Bian, G.; Zhao, Y. Wind speed forecast based on the lstm neural network optimized by the firework algorithm. Adv. Mater. Sci. Eng. 2021, 2021, 4874757. [Google Scholar] [CrossRef]
  54. Shao, B.; Song, D.; Bian, G.; Zhao, Y. A hybrid approach by ceemdan-improved pso-lstm model for network traffic prediction. Secur. Commun. Netw. 2022, 2022, 4975288. [Google Scholar] [CrossRef]
  55. Liguori, A.; Markovic, R.; Ferrando, M.; Frisch, J.; Causone, F.; van Treeck, C. Augmenting energy time-series for data-efficient imputation of missing values. Appl. Energy 2023, 334, 120701. [Google Scholar] [CrossRef]
  56. Yin, X.; Liu, Q.; Huang, X.; Pan, Y. Real-time prediction of rockburst intensity using an integrated cnn-adam-bo algorithm based on microseismic data and its engineering application. Tunn. Undergr. Space Technol. 2021, 117, 104133. [Google Scholar] [CrossRef]
  57. Zhang, Y. Short-term power load forecasting based on sapso-cnn-lstm model considering autocorrelated errors. Math. Probl. Eng. 2022, 2022, 2871889. [Google Scholar] [CrossRef]
  58. Zhao, A.; Mi, L.; Xue, X.; Xi, J.; Jiao, Y. Heating load prediction of residential district using hybrid model based on cnn. Energy Build. 2022, 266, 112122. [Google Scholar] [CrossRef]
  59. Rao, A.R.; Reimherr, M. Modern non-linear function-on-function regression. Stat. Comput. 2023, 33, 130. [Google Scholar] [CrossRef]
  60. Karijadi, I.; Chou, S.-Y.; Dewabharata, A. Wind power forecasting based on hybrid ceemdan-ewt deep learning method. Renew. Energy 2023, 218, 119357. [Google Scholar] [CrossRef]
  61. He, Q.-Q.; Wu, C.; Si, Y.-W. Lstm with particle swam optimization for sales forecasting. Electron. Commer. Res. Appl. 2022, 51, 101118. [Google Scholar] [CrossRef]
  62. Gupta, M.; Kumar, P. Robust neural language translation model formulation using seq2seq approach. Fusion Pract. Appl. 2021, 5, 61–67. [Google Scholar] [CrossRef]
  63. Bhandari, H.N.; Rimal, B.; Pokhrel, N.R.; Rimal, R.; Dahal, K.R.; Khatri, R.K. Predicting stock market index using lstm. Mach. Learn. Appl. 2022, 9, 100320. [Google Scholar] [CrossRef]
  64. Gong, G.; An, X.; Mahato, N.K.; Sun, S.; Chen, S.; Wen, Y. Research on short-term load prediction based on seq2seq model. Energies 2019, 12, 3199. [Google Scholar] [CrossRef]
  65. Chicco, D.; Warrens, M.J.; Jurman, G. The coefficient of determination r-squared is more informative than smape, mae, mape, mse and rmse in regression analysis evaluation. Peerj Comput. Sci. 2021, 7, e623. [Google Scholar] [CrossRef] [PubMed]
  66. Namoun, A.; Hussein, B.R.; Tufail, A.; Alrehaili, A.; Syed, T.A.; BenRhouma, O. An ensemble learning based classification approach for the prediction of household solid waste generation. Sensors 2022, 22, 3506. [Google Scholar] [CrossRef] [PubMed]
  67. Govindarajan, P.; Venkatanathan, N. Towards real-time earthquake forecasting in Chile: Integrating intelligent technologies and machine learning. Comput. Electr. Eng. 2024, 117, 109285. [Google Scholar]
  68. Dong, S.; Wang, P.; Abbas, K. A survey on deep learning and its applications. Comput. Sci. Rev. 2021, 40, 100379. [Google Scholar] [CrossRef]
  69. Anh, D.T.; Thanh, D.V.; Le, H.M.; Sy, B.T.; Tanim, A.H.; Pham, Q.B.; Dang, T.D.; Mai, S.T.; Dang, N.M. Effect of gradient descent optimizers and dropout technique on deep learning lstm performance in rainfall-runoff modeling. Water Resour. Manag. 2023, 37, 639–657. [Google Scholar] [CrossRef]
  70. Kothona, D.; Panapakidis, I.P.; Christoforidis, G.C. A novel hybrid ensemble lstm-ffnn forecasting model for very short-term and short-term pv generation forecasting. IET Renew. Power Gener. 2022, 16, 3–18. [Google Scholar] [CrossRef]
  71. Box, G.E.; Jenkins, G.M.; Reinsel, G.C.; Ljung, G.M. Time Series Analysis: Forecasting and Control; John Wiley & Sons: New York, NY, USA, 2015. [Google Scholar]
  72. Taylor, S.J.; Letham, B. Forecasting at scale. Am. Stat. 2018, 72, 37–45. [Google Scholar] [CrossRef]
  73. Cheng, J.; Tiwari, S.; Khaled, D.; Mahendru, M.; Shahzad, U. Forecasting bitcoin prices using artificial intelligence: Combination of ml, sarima, and facebook prophet models. Technol. Forecast. Soc. Chang. 2024, 198, 122938. [Google Scholar] [CrossRef]
  74. Sunki, A.; SatyaKumar, C.; Narayana, G.S.; Koppera, V.; Hakeem, M. Time series forecasting of stock market using arima, lstm and fb prophet. In Proceedings of the MATEC Web of Conferences, Kuala Lumpur, Malaysia, 6–8 November 2024; EDP Sciences: Les Ulis, France, 2024; p. 01163. [Google Scholar]
Figure 1. The LSTM unit.
Figure 1. The LSTM unit.
Electronics 13 03646 g001
Figure 2. The proposed MMLSTMOPT model for predicting daily prices of oriental lilies.
Figure 2. The proposed MMLSTMOPT model for predicting daily prices of oriental lilies.
Electronics 13 03646 g002
Figure 3. MMLSTM models with various input and output data lengths used for predicting prices of oriental lilies.
Figure 3. MMLSTM models with various input and output data lengths used for predicting prices of oriental lilies.
Electronics 13 03646 g003
Figure 4. The MMLSTM model using 7 days of daily oriental lily prices for modeling and forecasting prices of the next 7 days.
Figure 4. The MMLSTM model using 7 days of daily oriental lily prices for modeling and forecasting prices of the next 7 days.
Electronics 13 03646 g004
Figure 5. An example of using 7 days of daily oriental lily prices for modeling and forecasting prices of the next 7 days.
Figure 5. An example of using 7 days of daily oriental lily prices for modeling and forecasting prices of the next 7 days.
Electronics 13 03646 g005
Figure 6. Using Optuna to select hyperparameters for MMLSTMOPT models.
Figure 6. Using Optuna to select hyperparameters for MMLSTMOPT models.
Electronics 13 03646 g006
Figure 7. The average importance of hyperparameters of MMLSTMOPT models.
Figure 7. The average importance of hyperparameters of MMLSTMOPT models.
Electronics 13 03646 g007
Figure 8. MAPE values of MMLSTM models and MMLSTMOPT models using various modeling data and forecasting time windows.
Figure 8. MAPE values of MMLSTM models and MMLSTMOPT models using various modeling data and forecasting time windows.
Electronics 13 03646 g008
Figure 9. The actual and predicted daily oriental lily prices for different forecasting time windows by MMLSTM models with modeling data of 21 days.
Figure 9. The actual and predicted daily oriental lily prices for different forecasting time windows by MMLSTM models with modeling data of 21 days.
Electronics 13 03646 g009
Figure 10. The actual and predicted daily oriental lily prices for different forecasting time windows by MMLSTMOPT models with modeling data of 21 days.
Figure 10. The actual and predicted daily oriental lily prices for different forecasting time windows by MMLSTMOPT models with modeling data of 21 days.
Electronics 13 03646 g010
Table 1. A brief summary of results.
Table 1. A brief summary of results.
ModelsMSEMAERMSEMAPER2
MMLSTMOPT_21 days_AVG634.2217.8924.6812.70%0.63
MMLSTM_21 days_AVG700.0718.5625.9413.21%0.59
ARIMA (3, 1, 1)1742.6134.2441.7426.97%−0.02
Prophet2618.2742.4151.1735.99%−0.54
Table 2. (a). Hyperparameter types and searching ranges of the MMLSTMOPT model. (b). The hyperparameter setting of the MMLSTM model.
Table 2. (a). Hyperparameter types and searching ranges of the MMLSTMOPT model. (b). The hyperparameter setting of the MMLSTM model.
(a)
HyperparametersTypesHyperparameters Ranges of the MMLSTM Model
OptimizerCategorical data[Adam, Adagrad, RMSprop]
The number of the first-layer MMLSTM neuronsInteger[20, 40, …, 1180, 1200]
The number of the second-layer MMLSTM neuronsInteger[20, 40, …, 1180, 1200]
The number of the fully connected-layer neuronsInteger[20, 40, …, 1180, 1200]
The loss functionCategorical data[MSE, MAE]
The number of epochsInteger[100, 150, …, 950, 1000]
The batch sizeInteger[16, 32, 64, 128, 256, 512]
The learning rateReal number[1 × 10−5, 8 × 10−1]
(b)
HyperparametersHyperparameters Set for the MMLSTM Model
OptimizerAdam
The number of the first-layer MMLSTM neurons100
The number of the second-layer MMLSTM neurons100
The number of the fully connected-layer neurons60
The loss functionMAE
The number of epochs300
The batch size64
The learning rate0.001
Table 3. The optimal hyperparameters of MMLSTMOPT forecasting models.
Table 3. The optimal hyperparameters of MMLSTMOPT forecasting models.
ModelsHyperparameters
Modeling DaysForecasting DaysOptimizer* 1st-Layer Neurons* 2nd-Layer Neurons* F-Layer NeuronsLoss FunctionEpochBatch SizeLearning Rate
71Adagrad3407201120MAE5001280.5093
72Adagrad920260160MAE9005120.4453
73Adagrad201140360MAE950320.4616
74Adagrad20140520MAE1000640.4910
75Adagrad202040MAE10005120.1977
76Adagrad84076020MAE9505120.2097
77Adagrad440440220MAE650320.3802
141Adagrad20860140MSE7005120.0997
142Adagrad960440920MAE700640.2849
143Adagrad82020180MAE8001280.4768
144Adagrad1040920640MAE950320.3546
145Adagrad2020100MAE1000640.4707
146Adagrad20078020MSE9001280.2532
147Adagrad20620680MSE900640.1168
211Adagrad2054060MSE10001280.4091
212Adagrad2066020MAE8505120.2345
213Adagrad201801200MAE850320.4991
214Adagrad52088020MAE10002560.2879
215Adagrad28012060MAE10005120.4004
216Adagrad8020300MAE950320.4886
217Adagrad4022080MAE8501280.2753
281Adagrad6034080MAE10001280.5358
282Adagrad420720160MAE10001280.1456
283Adagrad640380120MAE950320.4887
284Adagrad66012040MAE9002560.3457
285Adagrad20340840MAE600160.3480
286Adagrad20960320MAE10002560.4906
287Adagrad62060240MAE4005120.3801
* 1st-layer neurons = the number of neurons in the first LSTM layers, 2nd-layer neurons = the number of neurons in the second LSTM layers, F-layer neurons = the number of neurons in the fully connected layer.
Table 4. The importance of hyperparameters for MMLSTMOPT models.
Table 4. The importance of hyperparameters for MMLSTMOPT models.
ModelsThe Importance of Hyperparameters
Modeling DaysForecasting DaysLearning RateOptimizerEpochF-Layer Neurons1st-Layer Neurons2nd-Layer NeuronsBatch SizeLoss Function
710.21790.71260.00500.00710.00410.01330.00650.0334
720.32820.25190.00730.00480.01670.19060.02330.1772
730.14530.16870.04780.22520.01810.07270.07210.2500
740.12990.02730.00390.06790.00740.00980.23950.5143
750.64430.27560.00750.02620.01920.00700.00370.0165
760.37180.04720.03900.06020.43400.00550.00740.0350
770.35820.10820.00830.02720.01840.02600.05770.3960
1410.57350.34080.03340.00670.00250.01790.00720.0178
1420.61580.33680.01400.01630.00270.00740.00300.0041
1430.80390.08170.00050.04120.00190.01670.00040.0538
1440.10110.03070.04050.01270.07530.41580.07520.2486
1450.42140.07250.06070.03080.14310.01810.02450.2289
1460.88750.05560.00290.00060.00340.00130.00130.0475
1470.62730.09970.09480.05210.02190.00830.01780.0782
2110.08540.55580.02240.02420.16440.07880.06890.0001
2120.58260.21420.01290.07650.05120.04690.00530.0104
2130.13890.04170.02510.07150.34000.09690.06200.2240
2140.46840.21450.12870.00500.01570.10790.01170.0479
2150.16120.25340.32620.16360.03280.01240.01710.0333
2160.19360.03810.11780.03230.01200.49740.00970.0990
2170.49470.04960.03090.00280.00870.36200.03930.0119
2810.21470.38890.04940.13360.03920.02930.14430.0006
2820.51980.23720.06220.00600.10130.00590.00540.0622
2830.54900.04440.08920.11370.02890.05860.06560.0507
2840.25480.25170.01850.02330.24510.00780.01860.1801
2850.44040.11630.16870.04920.08050.10980.00550.0296
2860.34120.10940.08830.02100.15420.08520.08360.1172
2870.43030.23200.05460.03190.11700.00610.01270.1155
Table 5. The performance of MMLSTMOPT models in terms of MAPE (%).
Table 5. The performance of MMLSTMOPT models in terms of MAPE (%).
DaysMMLSTMOPT Models
Forecasting1 Day2 Days3 Days4 Days5 Days6 Days7 DaysAverage
Modeling
7 days8.5510.3812.7013.2914.8316.5616.5813.27
14 days8.5611.3912.8214.7414.5116.6816.7713.64
21 days8.6410.1311.8313.8813.5714.7116.1112.70
28 days8.6911.5312.4913.6916.1914.9416.7513.47
Table 6. The performance of the ARIMA model and the Prophet model.
Table 6. The performance of the ARIMA model and the Prophet model.
ModelMSEMAERMSEMAPER2
ARIMA (3, 1, 1)1742.6134.2441.7426.97%−0.02
Prophet2618.2742.4151.1735.99%−0.54
Table 7. Strategy A and strategy B for selling oriental lilies.
Table 7. Strategy A and strategy B for selling oriental lilies.
NoDateActual
Market
Prices
(NTD)
Strategy AStrategy B
Harvests
(Pieces)
Sales A
(NTD)
Average Predicted Prices of 1–7 Days
(NTD)
Cumulative
Quantity
(Pieces)
Selling
Quantity
(Pieces)
Sales B
(NTD)
12020/1/221641000164,000181100000
22020/1/232181000218,000182200000
32020/1/242231000223,000185300000
42020/1/252071000207,00018940004000828,000
52020/1/261901000190,00018810001000190,000
62020/1/271741000174,00018510001000174,000
72020/1/281571000157,00017010001000157,000
82020/1/291411000141,00016910001000141,000
92020/1/301241000124,00015310001000124,000
932020/4/231161000116,00015410001000116,000
942020/4/241081000108,00014310001000108,000
952020/4/2576100076,0001361000100076,000
962020/4/2676100076,0001271000100076,000
972020/4/2776100076,0001001000100076,000
982020/4/2883100083,000981000100083,000
992020/4/2981100081,00093100000
1002020/4/3083100083,0009420002000166,000
Total 100 days NTD 12,566,000 NTD 12,926,000
Note: The sales A = Actual market price × harvests; The sales B = Actual market price × sell quantity.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Chen, C.-H.; Lin, Y.-L.; Pai, P.-F. Forecasting Flower Prices by Long Short-Term Memory Model with Optuna. Electronics 2024, 13, 3646. https://doi.org/10.3390/electronics13183646

AMA Style

Chen C-H, Lin Y-L, Pai P-F. Forecasting Flower Prices by Long Short-Term Memory Model with Optuna. Electronics. 2024; 13(18):3646. https://doi.org/10.3390/electronics13183646

Chicago/Turabian Style

Chen, Chieh-Huang, Ying-Lei Lin, and Ping-Feng Pai. 2024. "Forecasting Flower Prices by Long Short-Term Memory Model with Optuna" Electronics 13, no. 18: 3646. https://doi.org/10.3390/electronics13183646

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop