AUTHOR=Wang Shuo , Yang Ke , Peng Hui TITLE=Using a seasonal and trend decomposition algorithm to improve machine learning prediction of inflow from the Yellow River, China, into the sea JOURNAL=Frontiers in Marine Science VOLUME=Volume 12 - 2025 YEAR=2025 URL=https://www.frontiersin.org/journals/marine-science/articles/10.3389/fmars.2025.1540912 DOI=10.3389/fmars.2025.1540912 ISSN=2296-7745 ABSTRACT=The Yellow River is the largest inflow into the Bohai Sea, and its inflow changes directly affect the ecological environment and marine health of the Bohai Sea. Therefore, accurate prediction of the inflow of the Yellow River is crucial for maintaining the ecological balance of the Bohai Sea and protecting marine resources. Time decomposition algorithms, combined with machine learning, are effective tools to enhance the capabilities of inflow prediction models. However future data leakage from decomposition items was ignored in many studies. It is necessary to develop the right method to operate time decomposition to avoid future data leakage. In this study, the inflow from the Yellow River into the sea was predicted based on a machine learning model (light gradient boosting machine, LightGBM) and a time decomposition algorithm (seasonal and trend decomposition using loess, STL), and the future data leakage in different ways of using STL were evaluated. The results showed that the overall performance of the STL–LightGBM model was better than that of the LightGBM model. The STL–LightGBM took the historical inflow for 8 days as the input, and predicted that the average NSE of the next 1–7 days would reach 0.720. Even when the forecast period was 7 days, the STL–LightGBM (NSE: 0.549 for 7-day lead time) was 0.105 higher than the LightGBM (NSE: 0.444 for 7-day lead time). We found that STL pretreatment of the entire test set overestimated the true performance of STL–LightGBM. It is recommended that the STL preprocesses each sample of the test set to avoid future data leakage. The study can provide help for water resources management and offshore environmental management.