###### Abstract  
In view of the current problems of complex models and insufficient data processing in ultra-short-term prediction of photovoltaic power generation, this paper proposes a photovoltaic power ultra-short-term prediction model named HPO-KNN-SRU, based on a Simple Recurrent Unit (SRU), K-Nearest Neighbors (KNN), and Hunter-Prey Optimization (HPO). Firstly, the sliding time window is determined by using the autocorrelation function (ACF), partial correlation function (PACF), and model training. The Pearson correlation coefficient method is used to filter the principal meteorological factors that affect photovoltaic power. Then, the K-Nearest Neighbors (KNN) algorithm is utilized for effective outlier detection and processing to ensure the quality of input data for the prediction model, and the Hunter-Prey Optimization (HPO) algorithm is applied to optimize the parameters of the KNN algorithm. Finally, the efficient Simple Recurrent Unit (SRU) model is used for training and prediction, with the Hunter-Prey Optimization (HPO) algorithm applied to optimize the parameters of the SRU model. Simulation experiments and extensive ablation studies using photovoltaic data from the Desert Knowledge Australia Solar Centre (DKASC) in Alice Springs, Australia, validate the effectiveness of the integrated model, the KNN outlier handling, and the HPO algorithm. Compared to the Support Vector Regression (SVR), Long Short-Term Memory (LSTM), Temporal Convolutional Network (TCN), and Simple Recurrent Unit (SRU) models, this model exhibits an average reduction of 19.63% in Mean Square Error (RMSE), 27.54% in Mean Absolute Error (MAE), and an average increase of 1.96% in coefficient of determination (\(R^{2}\)) values. p _Applied_  
_sciences_  
**Citation:** [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] Ultra-Short-Term Photovoltaic Power Generation Prediction Based on Hunter-Prey Optimized K-Nearest Neighbors and  
**Citation:** [PERSON]; [PERSON]; [PERSON]. to the intermittency, volatility, and randomness of meteorological factors [10; 11; 12]. Simultaneously, with the rapid development of smart grids, the use of accurate photovoltaic power prediction methods is further promoted [13]. With the development of computer hardware and software, prediction models use high-performance computing to achieve greater effectiveness, so that prediction plays a vital role in ensuring the operation of power stations and the safe operation of the smart grid [14]. In this context, researchers have been dedicated to developing effective prediction technologies to cope with various application scenarios [15]. Photovoltaic power forecasting belongs to the category of time series forecasting due to its continuous and real-time data [16]. At present, according to the time scale of time series prediction, research in photovoltaic power prediction mainly includes ultra-short-term, short-term, and medium-to-long-term forecasts. The former primarily provides data support for grid dispatch to ensure the safety of power transmission, while the latter two mainly offer data support for the planned operation and production of power stations [17; 18; 19]. In the early stages, [PERSON] et al. [20] proposed using the REST model to predict direct solar irradiance. [PERSON] et al. [21] presents an approach to predict regional PV power output based on irradiance forecasts provided by the European Centre for Medium-Range Weather Forecasts (ECMWF). While these methods achieved certain predictive success, it was found that similar models are difficult to obtain, the computational cost is high, and the adaptability to complex and variable meteorological conditions is poor. Therefore, time series models and regression analysis methods are applied in this field to obtain more accurate photovoltaic power data. [PERSON] et al. [22] proposed the ARMAX model to predict photovoltaic power based on historical data, which significantly improved the prediction accuracy of power output. [PERSON] et al. [23] proposed the use of gradient-boosted regression for prediction.