A Patch and Attention Mechanism-Based Model for Multi-Parameter Prediction of Rabbit House Environmental Parameters
Ronghua Ji, Guoxin Wu, Hongrui Chang, Zhongying Liu, Zhonghong Wu

TL;DR
A new model using patching and attention mechanisms accurately predicts rabbit house environmental conditions, improving farming efficiency and rabbit health.
Contribution
A novel multi-parameter prediction model, PatchCrossFormer-RHP, is introduced with patching and cross-attention mechanisms for improved accuracy and generalization.
Findings
PatchCrossFormer-RHP outperforms RNN, GRU, and LSTM in predicting temperature, humidity, and CO2 concentration in rabbit houses.
The model achieves strong cross-regional generalization with limited target-domain data through transfer learning.
High R2 values (up to 0.963) demonstrate the model's effectiveness in capturing environmental dynamics.
Abstract
Accurate prediction of temperature, humidity, and carbon dioxide concentration inside rabbit houses makes it possible to regulate the environment more precisely, which improves housing conditions and ultimately enhances the health and productivity of rabbits. To improve prediction accuracy and cross-regional generalization, a multi-parameter prediction model for rabbit houses is proposed, integrating patching and attention mechanisms. The model employs differentiated encoding strategies for environmental and auxiliary parameters, substantially enhancing its multi-parameter modeling capabilities. Experimental results indicate that the model achieves superior predictive accuracy and strong cross-regional generalization, supporting intelligent environmental regulation in intensive rabbit farming. The health and productivity of rabbits are highly sensitive to the environmental conditions…
Genes, proteins, chemicals, diseases, species, mutations and cell lines named across the full text — each resolved to its canonical identifier and authoritative record.
Click any figure to enlarge with its caption.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12- —earmarked fund for CARS
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsRabbits: Nutrition, Reproduction, Health · Effects of Environmental Stressors on Livestock · Greenhouse Technology and Climate Control
1. Introduction
In recent years, large-scale rabbit farming in China has experienced rapid development. From 2021 to 2023, the rabbit industry index continued to rise, and rabbit meat production reached 458,000 tons in 2023 [1]. Intensive farming systems contribute to the sustainable development of the rabbit industry. However, under enclosed and high-density conditions, improper regulation of environmental factors—such as temperature, humidity, and harmful gases—can easily induce stress responses and diseases, thereby impairing rabbit growth and development [2,3,4]. The core of intelligent environmental regulation systems in rabbit houses lies in the control algorithm, which dynamically adjusts the operating states of fans, cooling pads, and heaters according to real-time environmental parameters to maintain optimal housing conditions. Existing algorithms typically rely only on current parameter values and lack the ability to anticipate future trends, often resulting in insufficient regulation accuracy [5,6,7]. However, environmental regulation in rabbit houses often exhibits time-lag effects caused by thermal inertia and residual evaporation, which delay the system’s response to control actions. These lag characteristics make real-time control insufficient, highlighting the necessity of predictive modeling to anticipate and compensate for environmental fluctuations. In addition, integrating prediction results with control algorithms enables proactive adjustment of ventilation, cooling, heating, and other components of the environmental regulation system, thereby improving overall stability and efficiency. Therefore, accurate prediction of indoor environmental parameters is essential for designing and implementing effective regulation strategies, improving control precision, and ultimately enhancing rabbit comfort and animal welfare [8,9].
Prediction models for livestock and poultry housing environments can be broadly categorized into physics-based statistical models, machine learning models, and deep learning models. Physics-based statistical models rely heavily on precise experimental data and extensive domain expertise, making them challenging to construct and limiting their transferability [10,11,12]. Machine learning models, such as those based on support vector regression (SVR) [13] and extreme learning machines (ELM) [14], adopt data-driven approaches to capture the coupling relationships among environmental variables, thereby enhancing model applicability and flexibility. However, these models remain highly dependent on data quality, while livestock housing data are often susceptible to noise interference. Both physics-based and machine learning models show limited capability in feature extraction and nonlinear modeling. By contrast, deep learning models, with their powerful capabilities for automatic feature learning and nonlinear modeling, have emerged as a key research direction for predicting environmental parameters in livestock housing [15,16,17,18,19,20,21,22]. For instance, Lee [22] employed recurrent neural networks (RNNs) to predict temperature and humidity in duck houses under different ventilation modes. Li [21] compared RNN, LSTM, and GRU for predicting dissolved oxygen in fish ponds, demonstrating that LSTM and GRU achieved superior performance, with GRU requiring fewer parameters. Liu [23] further demonstrated that Transformer-based models achieved higher accuracy and stability than mainstream architectures, such as BERT and Seq2Seq, in rabbit house environmental prediction tasks.
However, the strong interdependence among environmental factors in livestock and poultry houses makes it challenging to ensure prediction accuracy. Feng [24] applied principal component analysis (PCA) to reduce the number of environmental parameters in sheep houses, which effectively improved prediction accuracy. Yang [25] proposed an empirical mode decomposition (EMD)-based model for predicting ammonia concentration in pig houses, enhancing both accuracy and efficiency. Ji [26] employed the seasonal-trend decomposition procedure (STL) to decompose rabbit house environmental sequences into trend, seasonal, and residual components, thereby partially addressing the problem of variable coupling. These studies primarily focused on data preprocessing and feature extraction, showing that sequence decomposition can improve predictive accuracy. Nevertheless, when applied to different regions or different types of livestock housing, the generalization ability of existing models remains limited. In particular, there is a lack of discussion on cross-regional deployment and insufficient analysis of model adaptability for heterogeneous housing environments.
In summary, rabbit house environment prediction faces challenges, such as limited accuracy and generalization in multi-parameter and multi-step forecasting, and a lack of research on cross-regional model deployment. To address these challenges, this study aims to develop a unified prediction framework, termed PatchCrossFormer-RHP (Patch and Cross-Attention Enhanced Transformer for Rabbit House Prediction), by enhancing Transformer-based architectures through the integration of patch-based temporal encoding and a cross-attention mechanism. This framework is designed to achieve high-precision and generalizable forecasting of key indoor environmental parameters—temperature, relative humidity, and CO_2_ concentration—in rabbit houses across different regions.
2. Materials and Methods
2.1. Data Collection
Environmental parameters were collected from three enclosed rabbit houses located in Qingyang (Gansu, China), Jiyuan (Henan, China), and Nanping (Fujian, China). These farms are situated in distinct climatic zones, representing the northwest arid, central temperate, and southeastern humid regions of China’s rabbit-farming areas. Each site was an intensive rabbit house with clear environmental regulation needs, selected to ensure data representativeness and reliability. This inter-regional design emphasizes climatic diversity to validate the model’s cross-regional transferability.
Table 1 summarizes the characteristics of the rabbit houses, and Figure 1 illustrates the housing conditions.
In addition to indoor sensors, outdoor sensors were mounted on shaded exterior walls to record air temperature and humidity. These parameters serve as external drivers influencing indoor thermal and moisture dynamics. The same type and number of sensors were installed in all three rabbit houses. The sensor specifications are listed in Table 2.
To ensure that the collected data accurately reflected the actual environment of the rabbit houses, the sensors inside the houses were arranged as shown in Figure 2.
The data collection periods were as follows: Nanping, Fujian (1 August–30 September 2023); Qingyang, Gansu (25 July–30 September 2023); and Jiyuan, Henan (12 August–30 September 2023). Summer was chosen as the sampling period because it represents the most heat-stress-prone season, when environmental regulation faces the highest demand for intelligent control. The sampling frequency was set to once per minute.
2.2. Data Preprocessing
During data collection, occasional sensor errors resulted in localized anomalies, manifested as abnormally high or low values at specific time points. To address this, outlier detection was first performed using a sliding-window method to identify abnormal points, which were then marked and set as null values. Additionally, data loss occurred due to external factors, including network failures or temporary power outages. For these outliers and missing values (with missing durations not exceeding 60 min), linear interpolation was uniformly applied for imputation. The calculation method of linear interpolation is given in Equation (1):
, represent the nearest valid values before and after the missing interval, respectively. denotes the total number of missing values, and represents the interpolated value for the -th missing data point.
The sampling frequency was set to once per minute, while the environmental parameters in rabbit houses generally exhibited slow variation. To improve model performance, a sliding-average method was applied for down-sampling, adjusting the data interval to 10 min. This process effectively smoothed local fluctuations in the sequences and aligned better with practical requirements for control and decision-making.
To eliminate the effects of dimensional differences among environmental parameters and to accelerate model convergence, the data were normalized using the min–max method, as defined in Equation (2):
denotes the normalized value of the environmental parameter , while and represent the minimum and maximum values of the -th parameter, respectively.
2.3. Data Analysis
The environmental parameters in rabbit houses exhibit nonlinear, non-stationary, periodic, and strongly coupled characteristics [27]. Based on a detailed comparative analysis of the environmental features and differences across the three regions during the sampling period, data from one representative week (20–26 August 2023) were selected for illustrative presentation. This period corresponds to the late summer season, one of the most complex transitional phases of the year, during which climatic differences among the three regions are most pronounced. For each region, the outdoor temperature and humidity data collected during this week were aligned by time points. The mean values of the observations at the same time points across seven days were calculated, and their maximum, minimum, and diurnal ranges were further derived. The results are presented in Table 3.
It can be observed that notable differences exist in the outdoor temperature and humidity among the three regions. In Nanping, Fujian, both daytime temperature and humidity were higher than those in Qingyang, Gansu, and Jiyuan, Henan, with smaller diurnal variations. Qingyang, Gansu, recorded the lowest temperature and humidity, accompanied by pronounced diurnal fluctuations. The conditions in Jiyuan, Henan, were intermediate between those of Fujian and Gansu, showing relatively strong variability.
Similarly, the seven-day mean variation curves of indoor temperature, humidity, and CO_2_ concentration for the three regions were computed, and the results are illustrated in Figure 3.
As shown in Figure 3, the temperature and humidity in the Fujian rabbit house were significantly above the optimal ranges (the recommended environmental temperature for rabbits is typically 15–25 °C, and the optimal relative humidity is 60–65% [28]), indicating a potential risk of heat stress. In contrast, the Gansu rabbit house maintained temperatures close to the suitable range but exhibited large diurnal fluctuations, while CO_2_ concentrations remained persistently high, suggesting insufficient nighttime ventilation. The Henan rabbit house exhibited intermediate temperature and humidity levels compared to the other two sites, with relatively high variability. Overall, the three rabbit houses displayed marked differences in their environmental parameters.
To evaluate the coupling strength and structural differences among different parameters, Pearson correlation coefficients were calculated for all environmental variables. The correlation heatmaps of rabbit house parameters in the three regions are presented in Figure 4.
It can be observed that indoor temperature, indoor humidity, and indoor CO_2_ concentration were strongly coupled with each other, while indoor wind speed, outdoor temperature, and outdoor humidity exerted significant influences on these three indoor parameters. Moreover, the correlations among environmental variables varied across the three regions. The coupling was strongest in Fujian, whereas the parameters in Gansu appeared relatively independent of each other. These differences can be attributed to regional variations in climate conditions, housing structures, stocking densities, management practices, and environmental control systems.
2.4. Predictive Model Construction
Based on the analysis of environmental parameters in rabbit houses and considering the coupling relationships among variables, we propose PatchCrossFormer-RHP (Patch and Cross-Attention Enhanced Transformer for Rabbit House Prediction) to improve prediction accuracy, stability, and model generalization.
PatchCrossFormer-RHP adopts a modeling strategy that integrates both temporal and channel dimensions. The model input is divided into two parts: the environmental parameter sequence and the auxiliary parameter sequence. The environmental parameter sequence includes indoor temperature, indoor humidity, and indoor CO_2_ concentration, while the auxiliary parameter sequence consists of indoor wind speed, outdoor temperature, and outdoor humidity. The model outputs are the predicted sequences of indoor temperature, humidity, and CO_2_ concentration.
PatchCrossFormer-RHP consists of an embedding layer, an encoder layer, and a prediction layer. The overall architecture is illustrated in Figure 5.
2.4.1. Embedding Layer
The embedding layer encodes the input environmental and auxiliary parameter sequences, projecting them into continuous vector representations that serve as inputs to subsequent modules.
In time-series forecasting models, two primary encoding strategies are commonly used: time dimension encoding and channel dimension encoding. These approaches enhance the model’s ability to capture temporal dynamics from different perspectives. Time dimension encoding improves the model’s sensitivity to local trends (e.g., short-term fluctuations) and global patterns (e.g., long-term cycles) within sequences. In contrast, channel dimension encoding captures the coupling relationships among different input variables. PatchCrossFormer-RHP adopts a modeling strategy that integrates both encoding types.
The model receives three environmental parameter sequences X and four auxiliary parameter sequences S, as defined in Equations (3) and (4):
, , and represent indoor temperature, indoor humidity, and indoor CO_2_ concentration, respectively, while , and correspond to indoor wind speed, outdoor temperature, and outdoor humidity. N denotes the sequence length.
The environmental parameter sequence X is encoded using a patching strategy. Each sequence is divided into k non-overlapping patches of equal length. The value of k is determined according to Equation (5):
N denotes the sequence length and L represents the patch length. Both the k patches of and the original sequence are encoded separately to capture local and global temporal features, respectively. The encoding process is illustrated in Figure 6.
This patch-based encoding strategy facilitates the extraction of sufficient intra-sequence information while preserving global sequence characteristics. It helps the model capture both local trends (e.g., short-term fluctuations) and global patterns (e.g., periodic variations) within the sequence.
The embedded and encoded environmental parameter sequence is denoted as , as shown in Equation (6):
, and represent the embedded and encoded sequence vectors of indoor temperature, indoor humidity, and indoor CO_2_ concentration, respectively.
The vector contains k + 1 encoded vectors, corresponding to the encoded subsequences and the full sequence, as shown in Equation (7):
vector contains both local and global information of the original sequence.
Each sequence in the auxiliary parameter sequence is encoded along the channel dimension (Equation (4)).
In this study, sinusoidal positional encoding is adopted. As an effective encoding strategy for Transformer-based long-sequence prediction models, sinusoidal positional encoding enables the model to capture both local trends and global patterns in time series data without introducing additional trainable parameters. The computation of the sinusoidal positional encoding is given in Equations (8) and (9):
pos denotes the time step, i denotes the dimension index, and d represents the embedding dimension.
2.4.2. Encoder
The encoder is responsible for extracting temporal features from the sequences of environmental parameters. It is composed of three key components: the Patch-Global Aggregator, Gated Recurrent Unit (GRU), and the Cross-Attention mechanism. The Patch-Global Aggregator integrates local information across individual patches, the GRU further captures temporal dependencies within the sequence, and the cross-attention mechanism enables deep interaction between target variables and auxiliary variables.
First, considering that the contributions of local and global information at each time step t may vary, the Patch-Global Aggregator applies dynamic weighting to the k + 1 vectors in (where j = 1, 2, …, k and G denotes the global vector). The detailed computation is defined in Equations (10)–(12):
denotes a vector in (where j = 1, 2,…, k and G represents the global vector), and is the weighted vector at time t. is a learnable weight matrix, and is the hidden state at time t − 1 from the Gated Recurrent Unit (GRU) following the Patch-Global Aggregator.
The GRU, an improved variant of the Recurrent Neural Network (RNN), is well-suited for temporal feature extraction due to its recurrent architecture. GRU is a computationally efficient type of RNN [29], whose core idea is to use gating mechanisms to selectively retain or update historical information, thereby capturing dynamic patterns in time series data. It consists primarily of two gates: the update gate , which determines the extent to which historical and new information are integrated into the current hidden state, and the reset gate , which controls how much of the past hidden state is retained when computing the candidate hidden state. The GRU structure is illustrated in Figure 7.
In the Figure 7, represents the vector at time t after weighting by the Patch-Global Aggregator. denotes the update gate, denotes the reset gate, is the hidden state at time t − 1, is the hidden state at time t, and is the candidate hidden state. The definitions of the update and reset gates, as well as the hidden state update rules in GRU, are given in Equations (13)–(16):
σ and tanh are activation functions, and , , and are learnable parameter matrices.
The combination of the Patch-Global Aggregator and GRU preserves local temporal features within each patch while enhancing the model’s ability to capture global temporal dependencies across patches. This significantly enhances the model’s ability to temporally model rabbit house environmental parameters.
To achieve feature decoupling between environmental and auxiliary parameters, a cross-attention mechanism is introduced. Specifically, the temporally encoded environmental parameter sequence serves as the query, while the channel-encoded auxiliary parameter sequence functions as the key and value in the attention computation. This mechanism enables the model to extract predictive and relevant information from the auxiliary sequence. The cross-attention process is illustrated in Figure 8.
The features fused through the cross-attention module are subsequently normalized to unify feature scales and accelerate training convergence. These normalized features are then passed through a feedforward neural network for nonlinear transformation.
2.4.3. Prediction Layer
The prediction layer employs a target-specific modeling strategy, comprising three parallel single-layer fully connected neural networks. Each network is independently responsible for predicting one of the following target variables: temperature, humidity, or CO_2_ concentration. The number of neurons in each network equals the prediction horizon. The input to each network is formed by concatenating multiple encoded feature patches corresponding to the respective environmental parameter, which are then used to generate multi-step forecasts for that parameter.
2.5. Model Performance Evaluation Metrics
The model performance was evaluated using three widely adopted metrics: Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and the Coefficient of Determination (R^2^). MAE provides an absolute measure of prediction error, while RMSE emphasizes larger deviations by penalizing squared errors more heavily. R^2^ quantifies the goodness of fit between predicted and observed values, with values closer to 1 indicating better predictive accuracy. The specific calculation formulas are given in Equations (17)–(19):
n denotes the number of predicted values, and represent the predicted and actual values, respectively, and ȳ denotes the mean of the actual values.
2.6. Model Test Platform
The hardware and software environments used for model training and testing are summarized in Table 4.
The hardware and software environments employed for model training and testing are presented in Table 5.
3. Results
To systematically and comprehensively evaluate the performance of PatchCrossFormer-RHP in multi-parameter and multi-step prediction tasks for rabbit house environments, this study conducted analyses on the impact of input and output sequence lengths, performance evaluation experiments, and ablation studies.
The experiments were conducted using a rabbit house environmental dataset collected in Fujian Province, which contained a total of 7548 samples. The dataset was chronologically divided into training, validation, and test sets in a ratio of 6:1:3, corresponding to 4529, 755, and 2264 samples, respectively. The training set was used for model parameter learning, the validation set for hyperparameter tuning and overfitting prevention, and the test set for final performance evaluation. Each sample included both indoor environmental parameters (air temperature, relative humidity, CO_2_ concentration, and wind speed) and outdoor parameters (air temperature and relative humidity). Within a multivariate prediction framework, the model was designed to forecast three key indicators: indoor air temperature, relative humidity, and CO_2_ concentration. Wind speed and outdoor environmental variables were incorporated as auxiliary inputs, while the prediction targets were restricted to the indoor parameters of temperature, humidity, and CO_2_ concentration.
3.1. Analysis of the Impact of Input and Output Sequence Lengths on Prediction Performance
The lengths of input and output sequences are critical parameters of the model. The input sequence represents the historical environmental data of the rabbit houses received by the model, and its length determines the range of historical information that the model can perceive. The output sequence length corresponds to the forecasting horizon, with different horizons serving different application scenarios and response requirements.
To evaluate the effects of varying input and output sequence lengths on model performance, a total of 21 experiments were conducted. Specifically, the input sequence length was set to seven values: 6, 12, 24, 48, 72, 96, and 144. For each input length, the output sequence length was configured to three values: 6, 12, and 24.
Figure 9 presents the prediction results under different combinations of input and output sequence lengths, where curves of different colors represent different output lengths.
Figure 9 demonstrates that, with a constant input sequence length, increasing the output sequence length results in higher RMSE and MAE values and lower R^2^ values. This trend indicates that model performance declines as the forecasting horizon extends, reflecting increased complexity and uncertainty. When the output sequence length is fixed, increasing the input sequence length generally causes RMSE and MAE to decrease initially, then stabilize or slightly increase. Extending the input sequence length within an optimal range enables the model to capture essential historical information. However, excessively long input sequences may introduce redundant data and noise, which can negatively affect model performance.
Experimental results indicate that, in multi-parameter joint prediction for rabbit houses, prediction targets differ in their reliance on historical data. Selecting a unified input length based solely on average optimal performance may not meet practical production needs. In this context, the relative importance of each indicator was considered. Temperature and humidity are directly involved in environmental regulation, making their prediction accuracy essential for maintaining stable conditions. While CO_2_ concentration remains important, it is not the primary parameter for direct control. Consequently, input length selection prioritized temperature and humidity prediction performance. An input length of 48 is recommended for an output sequence length of 6, and 72 for output sequence lengths of 12 or 24.
3.2. Performance Evaluation Experiments
To assess the predictive performance of the proposed model in practical applications, comparative experiments were conducted in accordance with the actual requirements of the rabbit house environmental regulation. Considering that a forecasting horizon of 2 h (i.e., output sequence length of 12) is sufficient for daily control needs, all subsequent experiments were performed with the output length fixed at 12.
RNN, GRU, and LSTM were selected as baseline models for comparison. These recurrent architectures have demonstrated strong nonlinear modeling and temporal memory capabilities, and are widely applied in environmental monitoring and intelligent agricultural control [30,31]. Specifically, RNN, GRU, and LSTM were implemented with a three-layer recurrent structure, 256 hidden units, and the tanh activation function.
The experiments were conducted using the Fujian dataset for both training and testing. To ensure fairness, PatchCrossFormer-RHP and the comparative models were configured with identical input and output sequence lengths, as well as the same optimizer (Adam), loss function (mean squared error, MSE), learning rate (0.001), batch size (128), and training epochs (100). The experimental results are reported in Table 6.
Table 6 reports the comparative performance of different models in multivariate forecasting tasks for temperature, humidity, and CO_2_ concentration. Overall, PatchCrossFormer-RHP consistently achieved the best performance across all three environmental parameters. Compared with the “best baseline” (the strongest among the comparative models), the temperature prediction RMSE decreased by 39.1% (0.476 → 0.290), MAE decreased by 40.5% (0.370 → 0.220), and R^2^ improved from 0.905 to 0.963. For humidity prediction, RMSE decreased by 15.4% (1.836 → 1.554), MAE decreased by 17.4% (1.273 → 1.052), and R^2^ improved from 0.923 to 0.956. For CO_2_ concentration prediction, RMSE decreased by 1.7% (39.506 → 38.837), MAE decreased by 14.9% (29.706 → 25.269), and R^2^ reached 0.838, matching GRU. These results verify the effectiveness of the proposed model in multivariate time-series modeling and cross-variable feature extraction.
Both GRU and LSTM consistently outperformed RNN, highlighting the importance of gated structures in modeling both long- and short-term dependencies, as well as in handling non-stationary disturbances. LSTM exhibited better performance than GRU in humidity prediction, while GRU surpassed LSTM in CO_2_ concentration prediction. This indicates that LSTM is more effective at capturing long-term memory in stable, gradually varying processes, whereas GRU, with fewer parameters, offers stronger robustness to noise.
3.3. Ablation Study
To quantify the contributions of key modules in PatchCrossFormer-RHP to prediction performance, a series of ablation experiments were conducted. Under the condition that all other structures remained unchanged, each core module of PatchCrossFormer-RHP was removed in turn, and the model was trained and tested on the Fujian dataset. The experimental results are summarized in Table 7.
As shown in Table 7, removing any key module led to a degradation in prediction performance, confirming that patch encoding, the Patch-Global Aggregator, and the cross-attention module all play essential roles in PatchCrossFormer-RHP. When the patch encoding module was removed, the RMSE of temperature, humidity, and CO_2_ concentration increased by approximately 122%, 63%, and 29%, respectively. Meanwhile, the MAE rose by more than 60%, and the R^2^ decreased by over 10%. This suggests that capturing local patterns makes a significant contribution to all variables and forms a critical foundation for enhancing predictive capability.
When the Patch-Global Aggregator was removed, the RMSE and MAE for temperature and humidity approximately doubled, whereas the decline in R^2^ was less than 2%. This suggests that the module makes a minimal contribution to trend capturing but plays a significant role in reducing absolute prediction errors. By aggregating local and global temporal information, it effectively suppresses numerical bias and enhances prediction accuracy.
In comparison, removing the cross-attention module caused relatively smaller performance degradation: the RMSE of temperature increased by 26%, while that of humidity and CO_2_ concentration rose by 15% and 5%, respectively. Although its effect on individual metrics was limited, the cross-attention mechanism plays a crucial role in facilitating feature interaction and information alignment between environmental and auxiliary parameters, thereby enabling the explicit modeling of temporal dependencies among different variables.
In summary, the three key modules each emphasize different aspects of performance and, when combined, jointly ensure the optimal predictive capability of PatchCrossFormer-RHP.
4. Discussion
As shown in Section 2.3, significant differences were observed in the environmental parameters of rabbit houses in Gansu, Henan, and Fujian. These differences mainly arose from regional variations in climate conditions, housing structures, stocking densities, management practices, and environmental control systems. To evaluate the generalization ability of PatchCrossFormer-RHP, particularly its adaptability to rabbit houses in different regions, cross-region cross-validation experiments were conducted. The model parameters were first randomly initialized, denoted as PatchCrossFormer-RHP (Init). Under the configurations described in Table 4 and Table 5, PatchCrossFormer-RHP (Init) was then trained separately on the Gansu dataset, the Henan dataset, and a combined dataset of both regions, yielding three pretrained models: PatchCrossFormer-RHP (GS), PatchCrossFormer-RHP (HN), and PatchCrossFormer-RHP (GS + HN). These four models served as the comparative baselines for subsequent analysis.
The Fujian dataset was divided into training, validation, and test sets with a ratio of 6:1:3. Based on this, the training set was further partitioned into six incremental subsets, as illustrated in Figure 10.
The four models were first evaluated directly on the Fujian test set to establish baseline performance without training. Subsequently, each model was trained on the six training subsets, with the validation set used for hyperparameter tuning and overfitting prevention during training. After training, the models were evaluated on the unified test set to quantify the impact of training data volume on predictive performance under cross-regional deployment. The experimental results are presented in Figure 11 and Table 7.
When trained on subset 1, all four models demonstrated a significant improvement in predictive performance compared to direct testing on the target dataset without training. Among them, the single-region pretrained models, PatchCrossFormer-RHP (GS) and PatchCrossFormer-RHP (HN), achieved larger and comparable gains, rapidly approaching their respective optimal performance levels. As the training subset size increased, the performance of all four models continued to improve, though at a slower pace. Notably, PatchCrossFormer-RHP (GS + HN) reached near-optimal performance after training with subset 4, requiring less data than the non-pretrained baseline PatchCrossFormer-RHP (Init). These findings suggest that pre-trained models can achieve satisfactory performance in cross-regional deployment with a relatively small amount of training data, and that single-region pre-trained models generally perform better.
The results obtained after training with subset 6 are reported in Table 8.
As shown in Table 8, all three pretrained models outperformed the randomly initialized PatchCrossFormer-RHP (Init) across all evaluation metrics, demonstrating that pretraining improves model performance in the target domain and validating the effectiveness of transfer learning. A comparison of PatchCrossFormer-RHP (GS), PatchCrossFormer-RHP (HN), and PatchCrossFormer-RHP (GS + HN) further reveals that the joint pretraining model (GS + HN) performed worse on all metrics than the single-source pretrained models. This indicates that single-source pretraining is generally superior to joint pretraining in cross-regional tasks. A possible explanation is that the data distributions of Gansu and Henan differ substantially; joint pretraining may cause the model to learn contradictory or overly specific features, thereby weakening its generalization ability.
In summary, pretraining enhances the cross-regional performance of PatchCrossFormer-RHP. In particular, single-source pretrained models achieve the best results, requiring only a small amount of target-domain data during fine-tuning to reach satisfactory performance. This demonstrates the strong adaptability of PatchCrossFormer-RHP across regions, highlighting that an appropriate pre-training strategy can effectively improve both predictive accuracy and transferability in cross-regional scenarios.
5. Conclusions
This study proposed a novel PatchCrossFormer-RHP model for predicting temperature, relative humidity, and CO_2_ concentration in rabbit houses, and conducted extensive experiments on Fujian datasets, with pretraining on data from Henan and Gansu to verify cross-regional transferability. Based on systematic analysis, the following conclusions were drawn:
- PatchCrossFormer-RHP achieved the highest overall accuracy across all environmental parameters, outperforming RNN, GRU, and LSTM. Relative to the strongest baseline, the temperature prediction RMSE and MAE decreased by 39.1% and 40.5%, respectively, while humidity and CO_2_ concentration predictions also exhibited accuracy improvements, with RMSE and MAE reduced by 15.4% and 17.4% for humidity and by 1.7% and 14.9% for CO_2_ concentration. Taken together, these improvements confirm the model’s superior multivariate forecasting capability. The higher accuracy in temperature prediction is of particular practical importance, as temperature is the primary variable governing ventilation control and thermal comfort regulation in rabbit houses.
- The patch-encoding module contributes most to the model’s ability to capture temporal regularities, as reflected by the largest drop in R^2^ when it was removed. This suggests that patch-based feature decomposition is a key factor in ensuring the model’s high explanatory power and predictive reliability.
- PatchCrossFormer-RHP demonstrates excellent transferability. When pretrained on datasets from Gansu and Henan, its performance rapidly reached optimal levels after fine-tuning with only 10% of the target region’s data, underscoring its strong potential for practical applications. This performance arises from its patch-based representation and cross-attention design, which together enhance feature alignment and domain adaptability, enabling reliable prediction under varying climatic conditions.
The PatchCrossFormer-RHP model offers both theoretical guidance and practical solutions for intelligent environmental regulation in rabbit houses. In future work, the proposed framework will be integrated into environmental control systems and validated through on-farm experiments. Technical personnel will be able to design control strategies that jointly consider current conditions and predicted trends. The forecasting results can serve as the core component of Model Predictive Control (MPC) for optimization over the prediction horizon, or as auxiliary information for refining threshold-based or fuzzy control rules. This integration enhances the precision and adaptability of environmental regulation, ultimately improving housing stability, animal welfare, and production efficiency. However, the current study is limited by the geographic range of its data sources. Additional validation in more diverse regions and climatic conditions is necessary to comprehensively evaluate generalization and transferability. Future research will expand multi-scenario datasets and pursue lightweight model deployment to improve practicality and application value.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Wu L. Qin Y. An Analysis of the Development of China’s Rabbit Industry in 2023 and Its Outlook for 2024 Chin. J. Anim. Sci.20246034735110.19556/j.0258-7033.20240130-10 · doi ↗
- 2Ma X. Li J. Lin J. Geng S. Ma J. Liu Z. Wu Z. Thermal Environment of Two Enclosure Structures in Angora Rabbit Breeding Houses in Shengzhou and Analysis of Suitable Temperature for Angora Rabbits Chin. J. Anim. Sci.20246025526310.19556/j.0258-7033.20231115-06 · doi ↗
- 3Sun Y. Wang Y. Sa R. Zhang H. Effects of Carbon Dioxide on Poultry and Control Measures Chin. J. Anim. Nutr.2018302918292410.3969/j.issn.1006-267x.2018.08.006 · doi ↗
- 4Dong W. Zhang J. Bian S. Zhou Y. Du J. Yu H. Zhong W. Song H. Wang X. Comparative Analysis of Environmental Factors in Fattening Houses under Two Ventilation Modes in a Large-Scale Pig Farm in Hangzhou China Anim. Husb. Vet. Med.20235042142810.16431/j.cnki.1671-7236.2023.01.042 · doi ↗
- 5Li B. Research on Environmental Regulation Technologies in Modernized Poultry Houses Bei Fang Mu Ye 20162323
- 6Hu X. Shen P. Li X. Cui W. Li B. Feng X. Pang C. Ventilation Parameters and Application Effects of Pregnant Pig Houses in Subtropical Regions during Winter Acta Ecol. Anim. Domest.202445657210.3969/j.issn.1673-1182.2024.05.010 · doi ↗
- 7Lian J. Li H. Sun K. Yin R. Chen W. Research Progress on Automated Environmental Control Technologies in Poultry Houses China Poult.2013354144
- 8Yang Y. Zeng Y. Feng Z. Liu Z. Li B. Research Status on Environmental Control Technologies and Intelligent Equipment for Livestock and Poultry Production Bull. Chin. Acad. Sci.20193416317310.16418/j.issn.1000-3045.2019.02.005 · doi ↗
