Hive Neural Network Forecasting: Code and Preprocessed Dataset
Description
This repository contains a simulate dataset derived from the oiginal data and the R code illustrating the implementation described in the associated article: Robustillo, M.C., Senger, D., Parra, M.I., Pérez, C.J. (2026). A Multivariate Autoregressive Multilayer Perceptron Model for Predicting Internal Beehive Conditions from Sensor Data. Computers and Electronics in Agriculture, Volume 246, pages 111593. DOI: https://doi.org/10.1016/j.compag.2026.111593 The dataset (ExampleHive.txt) contains internal and external measurements simulated from a single hive (Hive 0) from the BeeObserver project (https://doi.org/10.5281/zenodo.10407693). It is based on the original hive data recorded at an hourly sampling frequency, complemented with meteorological information from the German Weather Service (DWD). A small amount of Gaussian noise was added to the measurements to prevent exact replication of the original data and to allow dataset sharing. All data were preprocessed following the procedures described in Robustillo et al. (2026) and are provided in a format ready for direct use with the R script included in this repository. Variable Description Unit _____________________________________________________________________________________ time2 Timestamp of the measurement - t_i_1…t_i_5 Internal hive temperature sensors (DS18B20, 5 positions) °C weight_kg Hive weight (Bosche H30/H40 load cell under hive) kg h Relative humidity inside hive (BME280 sensor) % t Internal temperature inside hive (BME280 sensor) °C p Internal air pressure inside hive (BME280 sensor) hPa to_imp External temperature (DS18B20 sensor) °C ho_ms External relative humidity from DWD % precip_ms Precipitation from DWD station mm wind_ms Wind speed from DWD station m/s pressure_ms Atmospheric pressure from DWD station hPa hour Hour of the measurement day Day of the measurement month Month of the measurement year Year of the measurement ext External variable capturing large hive weight variations kg ______________________________________________________________________________________ This research was funded by Ministry of Science, Innovation and Universities - Spain, and State Research Agency - Spain (Projects PID2021-122209OB-C32 and PID2024-155179NB-C21), funded by MICIU/AEI/10.13039/501100011033 and European Union (European Regional Development Fund).
Files
Steps to reproduce
To reproduce the workflow, run the script hive_nn_models.R, which trains and evaluates neural network models (MLP and AMLP) to forecast internal hive variables using the dataset ExampleHive.txt. The script computes the mean internal temperature (t_m), generates lagged variables for autoregressive modeling, applies a rolling-window data split, and produces forecasts for 1- and 3-day horizons. Model performance is evaluated using MAE and corrected MAPE, and the script generates tables with error metrics and observed vs. predicted plots. The computational environment is documented using sessionInfo(). Additional details on script execution and configuration are provided in Readme.txt. Because the shared dataset includes added Gaussian noise, results are reproducible in methodology and structure, but numerical values (e.g., error metrics) may differ slightly from those reported in the article. To reproduce the exact results, users should download the original hive datasets from Zenodo at hourly resolution, obtain the corresponding meteorological variables from the associated weather stations, and preprocess the data following the steps detailed in the reference article. The resulting dataset can then be used in place of ExampleHive.txt for model training and evaluation. This paper should be cited in any scientific publication using this dataset or code: Robustillo, M.C., Senger, D., Parra, M.I., Pérez, C.J. (2026). A Multivariate Autoregressive Multilayer Perceptron Model for Predicting Internal Beehive Conditions from Sensor Data. Computers and Electronics in Agriculture, Volume 246, pages 111593. DOI: https://doi.org/10.1016/j.compag.2026.111593
Institutions
- Universidad de MálagaAndalusia, Málaga
- Universidad de ExtremaduraExtremadura, Badajoz
Categories
Funders
- Agencia Estatal de InvestigaciónMinisterio de Ciencia, Innovación y UniversidadesMadridGrant ID: PID2021-122209OB-C32
- Agencia Estatal de InvestigaciónMinisterio de Ciencia, Innovación y UniversidadesMadridGrant ID: PID2024-155179NB-C21
- European Union (ERDF)Grant ID: PID2021-122209OB-C32
- European Union (ERDF)Grant ID: PID2024-155179NB-C21