Multi-layer Perceptron Neural Network to Assess the Thermal
Behaviour of a Moroccan Agriculture Greenhouse
Noureddine Choab
1
, Hamza Ali-Ou-Salah
2
, Abdeljalil Jikal
1
, Said Saadeddine
1
and Ataa Abouatallah
3
1
Laboratory of Atmosphere's Physics, Materials and Modeling, Hassan II Casablanca University, BP 146, Mohammedia,
Morocco
2
Laboratory of Physic of Condensed Matter & Renewable Energy, Hassan II Casablanca University, BP 146,
Mohammedia, Morocco
3
Laboratory of Applied Chemistry and Environment, National School of Applied Science , IbnZohr University, PO Box
1136, 80000 Agadir, Morocco
Keywords: Machine learning, Neural networks, greenhouse thermal behaviour, prediction.
Abstract: The aim of this research is to demonstrate how machine learning algorithms can estimate the temperature
and relative humidity of a Moroccan greenhouse's inside air. The prediction model was created using a
Multi-Layer Perceptron neural network (MLPNN) trained using the Levenberg-Marquardt backpropagation
technique. The weather data and indoor air temperature and relative humidity of a greenhouse located in
Agadir, Morocco were used. The results reveal that the MLPNN's Root Mean Square Error (RMSE) values
are very low, and the Karl Pearson's coefficient of correlation (R) values are very close to 1, indicating that
the MLPNN has a high predicting accuracy. In addition the result of the comparison between the results
obtained by the MLPNN model and the data from the experiment shows that the predicted and measured
indoor thermal behaviour are similar, which mean that the MLPNN have a high ability to predict the
greenhouse thermal behaviour.
1 INTRODUCTION
With the growing global demand for food, farming
in a controlled environment is an effective way to
produce plants year-round. The greenhouse system
is one of the main types of controlled agricultural
environments (Iddio et al., 2020). The greenhouse is
a translucent building that produces a microclimate
ideal for plants and shields them from the outside
environment by reflecting incident solar energy
(Choab et al., 2020). This helps to increase the
production and quality of these plants (Choab et al.,
2019).
The greenhouse is not entirely insulated from the
outside environment. Therefore, the thermal
behavior of indoor greenhouse air is strongly
affected by the outdoor climate. As a result, it's
difficult to control and predict the temperature and
humidity inside the greenhouse (Moon et al., 2018).
Accurate prediction of the greenhouse indoor air
temperature and humidity has been studied in
various studies (Yu et al., 2016).
Artificial neural network (ANN) is used for
greenhouse thermal modeling since as it is suitable
for nonlinear system models (Castañeda-Miranda
and Castaño-Meneses, 2020; Dariouchy et al., 2009;
Giuseppina Nicolosi et al., 2017; Wang et al., 2009).
Taki et al. (2016) compared the ANN technique to a
mathematical model to see which method was best
for forecasting the temperature of the inside air, the
temperature of the roof, and the energy loss in a
semi-solar greenhouse. This comparison revealed
that the ANN technique is a viable way for solving
the non-linear relationship between greenhouse
internal environment factors and forecasting interior
air temperature, cover temperature, and greenhouse
energy loss with high precision. The ANN was used
by Francik and Kurpaska (2020) to develop a model
that predicted temperature change within a heated
foil tunnel. Trejo-Perea et al. (2009) used an
MLPNN to predict greenhouse energy usage. The
temperature and relative humidity outputs are used
as inputs in the model's cascade architecture. When
compared to the regression model, Duncan's
10
Choab, N., Ali-Ou-Salah, H., Jikal, A., Saadeddine, S. and Abouatallah, A.
Multi-layer Perceptron Neural Network to Assess the Thermal Behaviour of a Moroccan Agriculture Greenhouse.
DOI: 10.5220/0010727400003101
In Proceedings of the 2nd International Conference on Big Data, Modelling and Machine Learning (BML 2021), pages 10-14
ISBN: 978-989-758-559-3
Copyright
c
2022 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
Multiple Range Test demonstrates that ANN has a
high confidence level of 95%. Yue et al. (2018) used
an upgraded Levenberg-Marquardt Radial Basis
Function Neural Network (LM-RBF) to construct a
model to predict the inside air temperature and
humidity of a greenhouse, and this model achieves
the goal with a maximum relative error of less than
0.5 percent.
From the previous literature review, it appears
that machine learning techniques show great
potential in predicting thermal behavior in
greenhouse applications. Also, the majority of
applications employed ANN as a prediction
technique. The aim of this research is to forecast the
internal air temperature and relative humidity of a
realistic greenhouse used for tomato cultivation in
Agadir, Morocco's semi-arid region.
2 MATERIALS AND METHODS
2.1 Greenhouse Description
The experiments were carried out in a Canarian
greenhouse in the Khmiss Ait Amira Souss Massa
region by APEF&V (Association of producers and
exporters of fruits and vegetables) (Figure 1). The
surface of the greenhouse’s ground is 8200
(88.23 m length, 95 m width, a height of 5 m at
gutter level and 6 m at span level). Tomatoes are the
crop grown in greenhouses.
Figure 1: Schematic view of the Canarian-type greenhouse
Inside air temperature, outside solar radiation,
wind speed, ambient temperature, and relative
humidity are all needed in the greenhouse's air
temperature and relative humidity forecast model.
These data were collected using a weather station
located inside (middle) and outside of the
greenhouse. A number of 4000 values were obtained
as the main dataset. To measure the air temperature
and relative humidity inside and outside the
greenhouse, ADCON TR1 was used. The ADCON
Silicium-Pyranometer SP-Lite was used to measure
the outside solar irradiance. The wind velocity
measurement was provided by ADCON Wind
Sensor Set Pro 10/2. Table 1 shows the details of the
sensors used for the measurement.
Table 1: sensors details
Sensor
Parameter
measure
d
Accuracy
pt1000
(ADCON
TR1
)
air
temperature
±0.1% at 20 °C
HC101
(ADCON
TR1)
air relative
humidity
± 1% from 0 to
90% and ± 2%
from 90 to 100%
at 20 °C
ADCON
Silicium-
Pyranometer
SP-Lite
solar
irradiance
sensitivity
(nominal)
between 60 and
100 µV/W/m²
ADCON
Wind Sensor
Set Pro 10/2
wind
velocity
± 0.3 m/s
2.2 Artificial Neural Network
The artificial neural network (ANN) appeared as a
modeling and prediction technology due to its
flexible mathematical structure able to describe
complex non-linear relationships between inputs and
outputs (Castañeda-Miranda and Castaño, 2017).
The multilayer perceptron neural network (MLPNN)
is one of the ANN variants used (Ali-Ou-Salah et al.,
2021). In this research, MLPNN was developed to
accurately forecast the indoor air temperature and
relative humidity in a greenhouse. The MLPNN is
able to obtain an efficient approximation of
nonlinear functions by using three interconnected
layers. The first one is the input layer, the second
one consists of one or more hidden layers, while the
third one is the output layer (Ali-Ou-Salah et al.,
2021; Bahani et al., 2020) (Figure 2). Each layer is
made up of neurons, which are processing units. In
addition, each hidden and output layer neuron has an
activation function that determines its output.
Weights and biases are synaptic connections that
carry information from one layer to the next (Ali-
Ou-Salah et al., 2021). A backpropagation (BP)
training algorithm is used to modify weights and
biases in order to learn the network. The Levenberg
Marquardt (LM) algorithm was employed as a
training algorithm in this work.
Multi-layer Perceptron Neural Network to Assess the Thermal Behaviour of a Moroccan Agriculture Greenhouse
11
Figure 2: Structure of a multilayer perceptron feedforward
neural network.
The output of the artificial neuron is described by
Equation (1):
𝑦
𝑓
𝜔

𝑥

𝑏
(1)
where 𝑦
is the neuron output of the 𝑗-th hidden
layer, 𝜔

is the synaptic weight between the 𝑗-th
layer and the 𝑖-th layer, 𝑥
is the input of the 𝑗-th
layer, 𝑏
is the bias weight of neuron j and 𝑓𝑥 is
the activation function.
In the current study, the linear and hyperbolic
tangent functions were employed (Table 2). The
output layer typically uses linear functions, but the
hidden and output layers can apply non-linear
activation functions. The most used non-linear
activation functions is hyperbolic tangent, because it
is compatible with the back-propagation algorithm
(Escamilla-García et al., 2020).
Table 2: The used Activation functions in this study.
Name Graphic Function
Hyperbolic
tangent
𝑓
𝜉

∙
1,
interval [-1,1]
Linear
𝑓
𝜉
𝑎∙𝜉𝑏
The predictors are the available external weather
data that are recorded in the experimental setup of
the greenhouse. These data cover the ambient air
temperature, solar radiation, relative humidity and
wind speed. These variables are physically
influencing the thermal behavior of the indoor
environment of the greenhouse as highlighted by
many physical models as shown in (Choab et al.,
2019). These variables can be considered as
significant for predicting the internal air temperature
of the greenhouse.
2.2.1 The Architecture of MLPNN Model
In order to find the optimal architecture of the ANN
model, the grid search technique is applied using 5
folds cross validation method.
The grid search method involves investigating a
large number of hidden neurons in order to discover
the best design. 5 folds cross validation is used to
evaluate the constructed model, which consists of
randomly dividing the data set into five folds of
data, each of which is utilized as a testing set and the
rest as a training set. The average of all testing errors
is the 5 folds cross validation error. The grid search
technique's outcomes are shown in Figure 3.
Figure 3: The grid search technique for finding the optimal
number of hidden neurons.
The results shows that 30 neurons give the
lowest 5 folds cross validation error. As a
conclusion, the optimal architecture of the ANN
model is shown in the Figure 4.
Figure 4: the ANN architecture used for the current study
2.2.2 Model Evaluation Criteria
Two metrics indicators were applied to evaluate the
performance of the developed models (Alghamdi et
al., 2020):
Karl Pearson’s Coefficient of Correlation
(R)
𝑅
𝐴,𝐵


̅




̅


(2)
𝐴
̅
and 𝐵
are the mean of 𝐴 and 𝐵 variables,
respectively.
Root Mean Square error (RMSE)
𝑅𝑀𝑆𝐸
𝑌
𝑌

(3)
4,05
4,1
4,15
4,2
4,25
4,3
4,35
0 50 100
5foldscrossvalidation
error
Numberofhiddenneurons
BML 2021 - INTERNATIONAL CONFERENCE ON BIG DATA, MODELLING AND MACHINE LEARNING (BML’21)
12
𝑌
and 𝑌
are the actual and predicted values
values, respectively, whereas 𝑌
is the mean of
𝑌
and N represents the number of observations.
3 RESULTS AND DISCUSSION
The internal air temperature and relative humidity of
the greenhouse were predicted using an MLPNN
model trained using a Levenberg-Marquardt
backpropagation approach.
3.1 Prediction Performances
The results of the predicting stage were summarized
in figures 5 and in Table 3. In the regression plot
between the forecasted and measured values, it
could be noticed that the majority of data points are
falling on the regression line, which means that the
MLPNN model gives very accurate forecasting for
the greenhouse thermal behavior. The RMSE values
for the MLPNN, as shown in Table 3, are very low,
and the R values are very close to 1, which mean
that MLPNN have a high accuracy of forecasting.
Figure 5: The Regression plot between the
forecasted and measured values
Table 3: Performance metrics of the MLPNN model
Training Validation Testing
RMSE 4.686367 5.152746 4.637304
R 0.989980 0.987724 0.990269
3.2 Greenhouse Thermal Behavior
In this section, we randomly selected days from an
unused dataset (29 Avril to 3 Mai 2019), in order to
make a comparison between the results obtained by
the MLPNN model and the data from the
experiment. Based on the current model, the inside
air temperature and relative humidity profiles of the
greenhouse were obtained (Figure 6 and 7). It can be
seen that the predicted and measured indoor thermal
behavior are similar, which mean that the MLPNN
have a hight ability to predict the greenhouse
thermal behaviour.
Figure 6: Experimental and estimated indoor air
temperature of the greenhouse
Figure 7: Experimental and estimated indoor air relative
humidity of the greenhouse
4 CONCLUSION
The present work examined the potential of adopting
machine learning-based techniques for the prediction
20 40 60 80 100
Target
10
20
30
40
50
60
70
80
90
100
Output ~= 0.98*Target + 0.84
Training: R=0.98998
Data
Fit
Y = T
20 40 60 80 100
Target
10
20
30
40
50
60
70
80
90
100
Output ~= 0.98*Target + 0.97
Validation: R=0.98772
Data
Fit
Y = T
20 40 60 80 100
Target
10
20
30
40
50
60
70
80
90
100
Output ~= 0.98*Target + 0.77
Test: R=0.99027
Data
Fit
Y = T
20 40 60 80 100
Target
10
20
30
40
50
60
70
80
90
100
Output ~= 0.98*Target + 0.85
All: R=0.98969
Data
Fit
Y = T
Air Temperature (°C)
Air Relative Humidity (%)
Multi-layer Perceptron Neural Network to Assess the Thermal Behaviour of a Moroccan Agriculture Greenhouse
13
of air temperature and relative humidity inside a
Moroccan greenhouse for Tomato cultivation. The
main predictors were the available recorded external
weather data that can be easily obtained by low-cost
measurements, such as the ambient temperature,
solar radiation, relative humidity and wind speed.
The results shows that the RMSE values for the
MLPNN, are very low, and the R values are very
close to 1, which mean that MLPNN have a high
accuracy of forecasting. In addition the result of the
comparison between the results obtained by the
MLPNN model and the data from the experiment
shows that the predicted and measured indoor
thermal behavior are similar, which mean that the
MLPNN have a high ability to predict the
greenhouse thermal behaviour.
REFERENCES
Alghamdi, A. S., Polat, K., Alghoson, A., Alshdadi, A. A.,
& Abd El-Latif, A. A. (2020). A novel blood pressure
estimation method based on the classification of
oscillometric waveforms using machine-learning
methods. Applied Acoustics, 164, 107279.
Ali-Ou-Salah, H., Oukarfi, B., Bahani, K., & Moujabbir,
M. (2021). A New Hybrid Model for Hourly Solar
Radiation Forecasting Using Daily Classification
Technique and Machine Learning Algorithms.
Mathematical Problems in Engineering, 2021.
Bahani, K., Ali-Ou-Salah, H., Moujabbir, M., Oukarfi, B.,
& Ramdani, M. (2020, September). A Novel
Interpretable Model for Solar Radiation Prediction
based on Adaptive Fuzzy Clustering and Linguistic
Hedges. In Proceedings of the 13th International
Conference on Intelligent Systems: Theories and
Applications (pp. 1-6).
Castañeda-Miranda, A., & Castaño, V. M. (2017). Smart
frost control in greenhouses by neural networks
models. Computers and Electronics in Agriculture,
137, 102-114.
Castañeda-Miranda, A., & Castaño-Meneses, V. M.
(2020). Smart frost measurement for anti-disaster
intelligent control in greenhouses via embedding IoT
and hybrid AI methods. Measurement, 164, 108043.
Choab, N., Allouhi, A., El Maakoul, A., Kousksou, T.,
Saadeddine, S., & Jamil, A. (2019). Review on
greenhouse microclimate and application: Design
parameters, thermal modeling and simulation, climate
controlling technologies. Solar Energy, 191, 109-137.
Choab, N., Allouhi, A., El Maakoul, A., Kousksou, T.,
Saadeddine, S., & Jamil, A. (2020). Effect of
Greenhouse Design Parameters on the Heating and
Cooling Requirement of Greenhouses in Moroccan
Climatic Conditions. IEEE Access.
Dariouchy, A., Aassif, E., Lekouch, K., Bouirden, L., &
Maze, G. (2009). Prediction of the intern parameters
tomato greenhouse in a semi-arid area using a time-
series model of artificial neural networks.
Measurement, 42(3), 456-463.
Escamilla-Garcia, A., Soto-Zarazúa, G. M., Toledano-
Ayala, M., Rivas-Araiza, E., & Gastélum-Barrios, A.
(2020). Applications of Artificial Neural Networks in
Greenhouse Technology and Overview for Smart
Agriculture Development. Applied Sciences, 10(11),
3835.
Francik, S., & Kurpaska, S. (2020). The use of artificial
neural networks for forecasting of air temperature
inside a heated foil tunnel. Sensors, 20(3), 652.
Nicolosi, G., Volpe, R., & Messineo, A. (2017). An
innovative adaptive control system to regulate
microclimatic conditions in a greenhouse. Energies,
10(5), 722.
Iddio, E., Wang, L., Thomas, Y., McMorrow, G., &
Denzer, A. (2020). Energy efficient operation and
modeling for greenhouses: A literature review.
Renewable and Sustainable Energy Reviews, 117,
109480.
Moon, T. W., Jung, D. H., Chang, S. H., & Son, J. E.
(2018). Estimation of greenhouse CO 2 concentration
via an artificial neural network that uses
environmental factors. Horticulture, Environment, and
Biotechnology, 59(1), 45-50.
Taki, M., Ajabshirchi, Y., Ranjbar, S. F., Rohani, A., &
Matloobi, M. (2016). Heat transfer and MLP neural
network models to predict inside environment
variables and energy lost in a semi-solar greenhouse.
Energy and Buildings, 110, 314-329.
Trejo-Perea, M., Herrera-Ruiz, G., Rios-Moreno, J.,
Miranda, R. C., & Rivasaraiza, E. (2009). Greenhouse
energy consumption prediction using neural networks
models. training, 1(1), 2.
Wang, D., Wang, M., & Qiao, X. (2009). Support vector
machines regression and modeling of greenhouse
environment. Computers and electronics in
agriculture, 66(1), 46-52.
Yu, H., Chen, Y., Hassan, S. G., & Li, D. (2016).
Prediction of the temperature in a Chinese solar
greenhouse based on LSSVM optimized by improved
PSO. Computers and Electronics in Agriculture, 122,
94-102.
Yue, Y., Quan, J., Zhao, H., & Wang, H. (2018, August).
The Prediction of Greenhouse Temperature and
Humidity Based on LM-RBF Network. In 2018 IEEE
International Conference on Mechatronics and
Automation (ICMA) (pp. 1537-1541). IEEE.
BML 2021 - INTERNATIONAL CONFERENCE ON BIG DATA, MODELLING AND MACHINE LEARNING (BML’21)
14