The COVID-19 pandemic novel coronavirus disease, a supernova in human history, caused considerable suffering and death worldwide. Thailand has experienced five surges of infection, each with unique and complex nonlinear dynamics. Therefore, the epidemic size and emerging trends cannot be estimated accurately, resulting in ineffective outbreak control. This study is to implement an adaptive prediction model using deep neural networks (DNN) and recurrent neural networks (RNN) machine-learning technologies. The challenge of this study relates to the use of previously short-term predicted values to attain the convergence of future trends. Moreover, mathematical demography is utilized to estimate the time-varying effective reproduction number (Rt), a metric that assesses the efficacy of control measure, based on the projected values. To avoid loss of robustness and generalization caused by the overfitted model, the optimal hyperparameters are derived using particle swarm optimization (PSO). To reduce the complexity, the dropout regularization technique is modified and applied to the DNN. Due to a lack of training data resulting in an under-fitted model problem, the outbreak data affected by COVID-19 virus mutations in countries that have surpassed the maximum point of infection before Thailand are encompassed in the training dataset, with their basic reproduction number ranges covering that of Thailand. After implementing the proposed models to Thailand's COVID-19 time series for the first through fifth surges, the simulation results show that the RNN-PSO model outperforms the others in terms of a considerably accurate estimation of the final epidemic size and lower RMSE, higher reliability, and higher R² for a developing epidemic trend. In addition, the estimated Rt from the RNN-PSO are consistent with the measures, reflecting the performance of the lockdown and vaccination measures under the viral mutants of each surge. This model can be applied to the upcoming surges and future epidemics and used in other areas. [ABSTRACT FROM AUTHOR]