Precise time series prediction serves as an important role in constructing a digital twin (DT). The various internal and external interferences result in highly nonlinear and stochastic time series. Although artificial neural networks (ANNs) are often used to forecast time series because of their strong self-learning and nonlinear fitting capabilities, it is a challenging and time-consuming task to obtain the optimal ANN architecture. This paper proposes a hybrid time series prediction model based on an ensemble empirical mode decomposition (EEMD), long short-term memory (LSTM) neural networks, and Bayesian optimization (BO). To improve the predictability of stochastic and nonstationary time series, the EEMD method is implemented to decompose the original time series into several components (each component is a single-frequency and stationary signal) and a residual signal. The decomposed signals are used to train the neural networks, in which the hyperparameters are fine-tuned by the BO algorithm. The following time series data are predicted by summating all the predictions of the decomposed signals based on the trained neural networks. To evaluate the performance of the proposed EEMD-BO-LSTM neural networks, this paper conducts two case studies (the wind speed prediction and the wave height prediction) and implements a comprehensive comparison between the proposed method and other approaches including the persistence model, autoregressive integrated moving average (ARIMA) model, LSTM neural networks, BO-LSTM neural networks, and EEMD-LSTM neural networks. The results show an improved prediction accuracy using the proposed method by multiple accuracy metrics.