Improved prediction of soil properties with Multi-target Stacked Generalisation on EDXRF spectra

Improved prediction of soil properties with Multi-target Stacked Generalisation on EDXRF spectra


Machine Learning (ML) algorithms have been used for assessing soil quality parameters along with non-destructive methodologies. Among spectroscopic analytical methodologies, energy dispersive X-ray fluorescence (EDXRF) is one of the more quick, environmentally friendly and less expensive when compared to conventional methods. However, some challenges in EDXRF spectral data analysis still demand more efficient methods capable of providing accurate outcomes. Using Multi-target Regression (MTR) methods, multiple parameters can be predicted, and also taking advantage of inter-correlated parameters the overall predictive performance can be improved. In this study, we proposed the Multi-target Stacked Generalisation (MTSG), a novel MTR method relying on learning from different regressors arranged in stacking structure for a boosted outcome. We compared MTSG and 5 MTR methods for predicting 10 parameters of soil fertility. Random Forest and Support Vector Machine (with linear and radial kernels) were used as learning algorithms embedded into each MTR method. Results showed the superiority of MTR methods over the Single-target Regression (the traditional ML method), reducing the predictive error for 5 parameters. Particularly, MTSG obtained the lowest error for phosphorus, total organic carbon and cation exchange capacity. When observing the relative performance of Support Vector Machine with a radial kernel, the prediction of base saturation percentage was improved in 19%. Finally, the proposed method was able to reduce the average error from 0.67 (single-target) to 0.64 analysing all targets, representing a global improvement of 4.48%.

Machine Learning, Multi-target Regression, EDXRF, Soil

1 Introduction

Evaluation of soil management is of fundamental importance in modern agriculture to achieve an effective soil correction with focus on highly productive crops as well as high harvesting performance (Suchithra and Pai, 2019). In order to obtain such performance, precision agriculture with proximal soil sensor (PSS) is an optimal solution and a tendency. In this case, non-destructive spectroscopic analytical methodologies coupled to machine learning have been studied to correlate the analytical signal to the soil fertility parameter of interest (Wang et al., 2015; Chlingaryan et al., 2018; Mancini et al., 2019; Nawar et al., 2019; Rawal et al., 2019; Zhang et al., 2019; Margenot et al., 2020). Particularly, X-ray Fluorescence (XRF) has been revealed as an upcoming PSS technique, especially with the popularisation of the portable XRF equipment (Sharma et al., 2015; Dao, 2016; Morona et al., 2017; Declercq et al., 2019).

The Energy Dispersive XRF (EDXRF) is the modality that has been successfully applied for soil parameters analysis in different fields such as agronomy and environment (soil pollution) (Weindorf et al., 2014). The EDXRF spectral data signal or the soil elemental concentrations are obtained faster, it is non-destructive, environmentally friendly, and is less expensive than the conventional methods. These features make EDXRF feasible as a PSS. However, analytical drawbacks such as poor performance for low-Z elements, matrix effects (due to moisture, granulometry, complex soil composition) and spectral interferences are challenges to be overcome with improvement in data collection and data analysis. In this paper we focus on data analysis, i.e., in the use of machine learning algorithms to pursuit high performance regression models for soil fertility parameters.

Commonly more than one parameter is involved in these analyses, forming an output set composed of target variables. The traditional method to attack these problems is transforming the problem into sub-problems with a single output variable, sharing the same input set . This method is known as Single-target (ST) and serves as a baseline when referring to problems with multiple targets. In ST, independent individual models (regressors) are generated for each sub-problem considering the same input set and the actual target.

Recent literature shows that new methods were developed especially to address multi-target settings. These methods, which are named Multi-target Regression (MTR) methods, oppose to ST by taking into account the correlation that the targets might have (Borchani et al., 2015; Spyromitros-Xioufis et al., 2016; Melki et al., 2017; Moyano et al., 2017; Mastelini et al., 2018b). Transforming the original problem into sub-problems is a well-grounded strategy of MTR based on two main strategies: stacking and chaining.

In stacking, one or more regressors are trained for each target (as in ST). They can be referred to as base-models. After that, predictions are obtained using the base-models for training a new regressor for each target in different manners. These new models, called meta-models, can be obtained following different stacking assumptions (Spyromitros-Xioufis et al., 2016; Santana et al., 2017, 2018). The precursor was Stacked Single Target (SST) proposed by Spyromitros-Xioufis et al. (2016). SST creates one base-model with a given regression algorithm (base-learner) for each target. Predictions are made by merging the output of base-models and the original input set, forming an augmented dataset. A new regressor is trained for each target taking into account the transformed dataset, generating meta-models in the second layer. Santana et al. (2017) proposed the Deep Regressor Stacking (DRS), which a stacking process of SST is repeated continuously for creating a deep meta-model. It stops when a maximum amount of pre-defined layers is reached. In another method, called Multi-target Augmented Stacking (MTAS), multiple distinct base-learners (related to different algorithms) are trained for each target using the same strategy as SST. However, the authors (Santana et al., 2018) took advantage of predictions for only relevant targets, obtaining boosted base-models. After that, just one final predictor per target is generated using the best set of augmented data, obtaining an accurate meta-model.

Chaining strategies, as the name implies, cascade the insertion of target-related information when creating new predictors. Similarly to stacking, chaining methods augment the original training set with predictions of the targets. Nonetheless, rather than using predictions of all responses at once, the chaining methods incrementally augment the datasets one target at the time. This idea is similar to the Bayesian network inference in design and was designed initially for classification problems (Read et al., 2009). Different strategies were proposed in the recent MTR literature (Spyromitros-Xioufis et al., 2016; Mastelini et al., 2018a). The Ensemble of Regressor Chains (ERC) constructs multiple randomly ordered target chains (Spyromitros-Xioufis et al., 2016). For each chain, base-models are trained for each target, starting from the first one. New regressors use the prediction of the previous base-models as extra input features. The final predictions for each target are accounted for as the average output between all chains. Multi-output Tree Chaining (MOTC) (Mastelini et al., 2018a) constructs a tree structure rather than multiple chains, where each node represents a target. To this end, a measure of inter-target correlation is used. Once the tree is constructed, starting from the leaves to the root, MOTC starts training the base-models. Each node uses its descendants’ base-models predictions as extra outputs. Thus, a specialised chain based on a tree branch is created to improve each target prediction.

The MTR methods have been applied to different fields, as to predict vegetation condition, water quality and rock mass parameters, wheat flour quality and even in soil assessment for heavy metal concentration (Kocev et al., 2009; Spyromitros-Xioufis et al., 2016; Barbon Junior et al., 2019; Liu et al., 2019). The potential gains that MTR could bring motivated the application and evaluation of these methods to handle soil samples analysed by EDXRF, which presents difficulties of identification due the complexity of the soil EDXRF spectra.

Also, inspired by the stacking ensemble strategy, we developed a novel MTR method, Multi-target Stacked Generalisation (MTSG). Stacked Generalisation (SG) was the first stacking technique proposed in the literature, but it has not been explicitly addressed in the MTR tasks. In our proposal, as an ensemble technique, SG aims at combining the learning biases of different base-learners towards reducing the prediction error. MTSG follows the same principle, but differently from the other MTR stacking based methods, MTSG uses the original input set only in the first phase. After creating the first base-model and obtaining the predictions outputted by them, new base-models are created based only on those predictions as the input. Hence, MTSG not only models inter-target dependencies but also consider the learning strategies of different regressor algorithms to provide responses. As shown in the SG literature, if these regressors are dissimilar in their bias, this methodology is capable of reducing error (Breiman, 1996). We believe this error reduction can also be achieved in the MTR field, particularly on EDXRF spectra, since the signal represents different properties and linearities from the same set of data. In other words, the proposed method is able to support the improved predictions of several targets taking advantage of different base-learner characteristics such as linearity, monotonicity and kernel function.

This work aims at evaluating MTR methods in an EDXRF soil spectra dataset to predict 10 soil quality parameters and attest the best predictor for each target. Besides, it assesses the performance of the new method MTSG for minimising the prediction error. Random Forest and Support Vector Machine (with linear and radial kernel) were used as base learners for the methods.

After examining the background of this research, the work is organised as follows: Section 2 introduces MTSG, the new developed multi-target method. Following this, Section 3 details the experimental setup, showing the dataset acquisition, the compared methods and algorithms, and the evaluation metrics. In Section 4, the results and their discussion are presented. Section 5 outlines the main conclusions of the work. Lastly, two appendices were added with descriptive statistic of the soil parameters and the MTSG performance in benchmarking datasets.

2 Multi-Target Stacked Generalisation

Ensemble methods were used in different tasks to improve predictive performance over single predictors (Brown et al., 2005; Mendes-Moreira et al., 2012). The wisdom of ensembles consists of the combination of different specialised components (with local minima) to produce a global minimum. Besides, these components can be obtained by different learning processes (either by different learning algorithms, parameters or training sets). The mentioned components can be classifiers or regressors, depending on the kind of problem. Since we deal with a regression problem, the specialised components in this work equal to regressors.

Ensemble approaches evolve generally two steps: ensemble generation step and integration step. The first is when the components are built and in the second the output of the components are aggregated to generate a new prediction (Rooney et al., 2004). This aggregation can be made in different forms, for example, by a linear combination of the models.

Another strategy to integrate the specialised components is to obtain a model that has as input the prediction generated by the components, process known as Stacked Generalisation (SG) (Wolpert, 1992). Figure 1 represents SG technique.

Figure 1: Representation of SG ensemble technique.

SG consists of two main phases. The Level 0 training set is composed of the input set with features and the output variable . Considering as the set of possible regression algorithms, instances of it () will be used to obtain the base-models for the targets.

After creating these base-models, the set is used once again to obtain the first predictions (). The set of predicted targets is then considered the new input set at Level 1.

In the second phase, one learning algorithm is chosen as the regressor (). Thus, one Level 1 meta-model will be induced and considered the final predictor, and its prediction () will be considered the final output.

The Multi-Target Stacked Generalisation (MTSG) extends the SG concept to multiple outputs: whereas in original stacked generalisation multiple meta-models are trained for a single target, in MTSG multiple meta-models are trained for the multiple targets. Figure 2 illustrates the MTSG design.

Figure 2: Representation of MTSG method.

MTSG also has the generation and integration phases, with an intermediate pruning step made by a filter . The Level 0 training set is composed by the input set with features and the output set with targets. base-learners will be used to obtain base-models for each target. In the first phase, base-models are induced for each target using the original training set.

The Level 0 base-models will be used along with the set to obtain the first predictions (). Since base-models are induced for each target at Level 0 and there are targets, values will be delivered for each instance at this level.

As an additional step, the set of predicted targets will pass by the filter . This filter will assess the relevance of the predictions in relation to each target and will preserve only the relevant ones for each target (). Those will be considered the new input set at Level 1. For performing the filtering, different metrics can be used (e.g. liner correlation among the targets). In this work we adopted the importance extracted from Random Forest (RF), as in Santana et al. (2018), since it is capable of modelling nonlinear relationships.

In the integration step, similarly to SG, one learning algorithm is chosen as the base-learner (). In a supervised fashion, Level 1 meta-models will be induced, i.e., there will be one new regressor () for each target. These will be considered the final models and their predictions () will be considered the final output of the method.

The training procedure of MTSG is shown in Algorithm 1. It receives and , representing the input and output sets, respectively. represents the set of base-learners that will be used at Level 0 and represents the base-learner employed to create the final meta-models.

1:function MTSG(, , , )
2:     // To store the Level 0 predictions
4:     // Level 0 base-models
6:     // Regression model induction for each target and learner
7:     for  do
8:         for t = 1 todo
9:              // model induction
13:     // Second layer of meta-models
15:     for t = 1 todo
Algorithm 1 MTSG training algorithm

In this method, the original problem’s features are disregarded at Level 1. To the best of our knowledge, this represents a distinction when comparing to the other multi-target stacking methods of the literature.

Besides, since it is an ensemble method, the performance of MTSG is sensitive to the diversity achieved by the Level 0 regressors. Using more learning algorithms tend to bring more diversity, however it increases the complexity of the method. For this reason, the number and type of regressors that will be used represent the compromise between performance and complexity in MTSG.

3 Experimental Setup

3.1 EDXRF working principle

EDXRF is a technique used in several study fields for identification and quantification of chemical elements present in varied materials (Byers et al., 2019; Khuder et al., 2010; Mantler and Schreiner, 2000; Parsons et al., 2013; Rodrigues dos Santos et al., 2017; Weindorf et al., 2012). The working principle of EDXRF depends on the interaction of high-energy X-rays with matter. These interactions may be performed by photoelectric effect, elastic and inelastic scattering (Van Grieken and Markowicz, 2002). The fluorescent phenomenon is related with the photoelectric effect in which electrons are ejected from inner shells of the atom by the incidence of an external X-ray beam. As a consequence, to stabilise the atom, electrons from external layers fill these vacancies and the energy difference is emitted as characteristic X-ray photons. Thus, it is possible to identify the elements present in the sample since these energies differences are well defined for each transition in each element. By evaluating the peak intensities in the spectra, the elemental concentrations may be calculated (Van Grieken and Markowicz, 2002). Besides the total inorganic content, the EDXRF spectra also provide some information about the samples complex organic content. The inorganic and organic samples information is mainly embodied in the spectra scattering region since the cross-section of the scattering effects is greater for low Z-elements.

3.2 Conventional analyses and spectral measurements

Soil samples (n=396) from an agricultural area in Ribeirão Vermelho basin in Cambé municipality, Paraná State, Brazil (north region of Paraná state) were used in this study. The area has two types of soil classified as Latossolo Vermelho Amarelo Distrófico (Orthic Ferralsol) and Nitossolo Vermelho Distrófico, according to Brazilian classification system and FAO classification (WRB, IUSS Working Group, 2014; Santos et al., 2006), both with high clay texture. Samples were collected in three depths (0-5 cm, 5-10 cm e 10-20 cm), dried at 40 ºC for 48 h, grinded and sieved through a 2 mm stainless steel sieve. Next, soil samples were sent to laboratory for conventional analysis of the chemical parameters and EDXRF spectral measurements.

The soil fertility parameters analysed were: bioavailable phosphorus (P), total organic carbon (TOC), pH, potential acidity (, that will be denoted by H+Al for simplification purpose), (Ca), (Mg), (K), sum of exchange bases (SB), cation exchange capacity (CEC) and base saturation percentage (BSP). All analyses were carried out in the IAPAR Soil Analysis Laboratory in Londrina, Paraná, Brazil following the recommendations of Pavan et al. (1992).

The EDXRF measurements were carried out in the Shimadzu (EDX720 model) benchtop equipment with Rh X-ray tube. For this, five grams of samples were placed in XRF plastic cups covered with Mylar films. The measurements were repeated three times in different sample portions (shaking the XRF cup before each measurement) using the operation condition of 15 kV for 200 s. The detection was carried out using a Si (Li) detector cooled with liquid nitrogen. All samples were measured using 10-mm focal spot without any filter in the primary beam.

3.3 Methods and algorithms

The use of machine learning tools may help to work around and minimise the analytical drawbacks mentioned in the introduction and also perform rapid dataset analyses for soil characterisation (Kaniu et al., 2012; Nawar et al., 2019).

The original dataset was split into two sub-sets following Kennard–Stone algorithm, which reserves 2/3 of the samples for training and 1/3 for test. This resulted in a training set containing 264 examples and a test set containing 132 examples. The samples were further pre-processed using auto-scaling.

ST was compared to SST, ERC, MTAS, MOTC, DRS and the novel method, MTSG. Random Forest (RF) and Support Vector Machine (SVM) were used as Level 0 and base regressors in this work. All methods along with the base regressors were implemented in R 3.4.0 with default settings, and the implementation can be accessed in 2. The packages used for RF and SVM were ranger and e1071, respectively.

RF creates multiple decision trees considering subsets of training set features, forming a forest with specialised trees. The output of RF, when applied to regression problems, is the average of the trees in the forest.

SVM creates a hyperplane that minimises the training error. When using a linear kernel (SVM_L), it creates a linear function to accomplish the task of minimising the error. When using a radial kernel (SVM_R), it maps the training data to a higher dimension via a radial function and then finds a hyperplane that best minimises the error.

These algorithms were chosen due to the expressive performance in previous studies and to guarantee a diversity to ensemble, since they offer different biases.

3.4 Evaluation metrics

For analysing the quality of the methods concerning the prediction of each soil variable, the Root Mean Squared Error (RMSE) of each target was calculated between the predicted value () and the true value of the target () for the testing instances. It indicates the concentration of the data in relation to the fitting model (Elavarasan et al., 2018).


Still focusing on the performance for each target, the multi-target methods can be compared to the single-target by the Relative Performance per Target (RPT), in which a value greater than 1 is a synonym of improved performance of MTR method in relation to the ST method:


For this problem, corresponds to each soil parameter and , to the base learner.

To compare the performance of different methods for different problems, it is necessary a metric that can be computed regardless of the number of targets . The general performance of each method can be computed by the average Relative Root Mean Square Error (aRRMSE) (Borchani et al., 2015):


A complementary metric to access the performance of the best models related to the reference values is the ratio of performance to deviation (RPD) which is the ratio of the standard deviation (SD) of the conventional analysis (reference) to the RMSE of the prediction.


According to Rossel et al. (2006) for soil attributes RPD 1.0 indicates very poor predictions and their use is not recommended; RPD between 1.0 and 1.4 indicates poor predictions where only high and low values are distinguishable; RPD between 1.4 and 1.8 indicates fair predictions which may be used for assessment and correlation; RPD values between 1.8 and 2.0 indicates good predictions where quantitative predictions are possible; RPD between 2.0 and 2.5 indicates very good, quantitative predictions, and RPD 2.5 indicates excellent predictions.

4 Results and Discussion

The results were presented and discussed starting by exposing the correlation between the targets (Section 4.1). This information corroborates with the importance of applying MTR methods since correlated targets lead to reduced errors in MTR predictions. Afterwards, in Section 4.2, we present the results of ST and MTR methods, highlighting the contribution of MTSG, which overcome the other methods. Finally, the predictions of each soil property are compared for evaluating their predictive performance and bring insights from patterns of EDXRF spectra in Section 4.3.

4.1 Soil properties correlation

Figure 3 reveals the Pearson correlation coefficients among the targets. They were computed pair-wisely and the closer to 1 or -1, the higher the linear correlation among the two variables. Coefficients closer to 0 means a low correlation.

Figure 3: Pearson correlation coefficients among the 10 targets.

As observed, several targets are strongly correlated: Ca and SB result in the most expressive coefficient since they presented a correlation coefficient of 0.95, almost a perfect positive linear correlation. Other targets pairs that are strongly correlated are BSP and SB (0.91), BSP and pH (0.86), BSP and Ca (0.83), CEC and Ca (0.82), and Mg and pH (0.79). The targets BSP and H+Al presented a negative strong correlation (-0.90). The targets that were mostly uncorrelated were P and SB (0.03), P and BSP (-0.03), P and H+Al (0.05), and P and CEC (0.08). In fact, P was the most uncorrelated target among the other nine.

4.2 Multi-target prediction

Figure 4 shows the aRRMSE for all methods and base-learners. For this, the lower the value, the better the performance. Comparing the base-learners with the average error of all targets, SVM_L was an effective machine learning algorithm, obtaining the same performance in all methods (ST and MTR, except for MTAS). SVR_R and RF were able to reduce the average error only when used embedded in MTAS and MTSG.

Figure 4: aRRMSE for the different combinations of methods and regressors. The horizontal line represents the lowest aRRMSE for ST.

With ST, the lowest aRRMSE was obtained using SVM with a linear kernel, resulting in an aRRMSE of 0.67. Despite of introducing non linearities, the MTSG presented a significative improvement in the predictive power of the models. MTSG using SVM with a radial kernel and RF as base regressor led to the lowest aRRMSE, 0.64. Other improvements in relation to the lowest ST value were obtained by DRS using RF (0.66), MTAS with SVM_L (0.66) and MTAS with RF (0.66).

After evaluating the general error results of the methods, their performances were evaluated for each target in terms of RPT, as registered in Table 1. For this metric, values greater than 1 represent an improvement of MTR over ST.

For P, TOC, pH, H+Al, Ca, Mg, K, SB, CEC and BSP, i.e., all the targets, all the combinations of MTR methods obtained improved or at least equivalent performance with respect to their corresponding ST version. It is noteworthy that many improvements reached up to around 10% (using MTSG) in relation to the corresponding ST. When observing the average RPT (last column in Table 1), just MTAS was able to improve results using SVM_L, the other MTR methods shared the same performance of ST for this algorithm. However, using SVM_R and RF, MTSG was the most promising method. It may also be noted in Table 1 that RF generated a performance improvement in all the MTRs in relation to ST for SB.

Regressor P TOC pH H+Al Ca Mg K SB CEC BSP Average
SVM_L 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
SVM_R 1.00 1.04 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.01 1.01
RF 1.01 1.00 1.00 1.00 1.13 1.00 1.00 1.10 1.00 1.03 1.03
SVM_L 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
SVM_R 1.00 1.04 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
RF 1.01 1.00 1.00 1.00 1.13 1.00 1.00 1.10 1.00 1.02 1.03
SVM_L 1.01 1.05 1.00 1.00 1.00 1.00 1.00 1.00 1.13 1.03 1.02
SVM_R 1.01 1.04 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.04 1.01
RF 1.03 1.04 1.00 1.00 1.13 1.00 1.00 1.10 1.00 1.03 1.03
SVM_L 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
SVM_R 1.00 1.04 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
RF 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.10 1.00 1.03 1.01
SVM_L 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
SVM_R 1.01 1.04 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.04 1.01
RF 1.01 1.00 1.00 1.00 1.13 1.00 1.00 1.10 1.00 1.08 1.03
SVM_L 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
SVM_R 1.06 1.14 1.00 1.11 1.13 1.00 1.11 1.10 1.13 1.19 1.10
RF 1.08 1.14 1.00 1.00 1.13 1.00 1.00 1.10 1.13 1.00 1.06
Table 1: RPT for each target considering the different combinations of methods and regressors. The best average result of regressor are highlighted by bold.

4.3 Soil properties prediction

Continuing the discussion for individual targets, we present (Figure 5) the absolute error values between the ST and the MTR methods for each target. For all the targets, except for BSP, ST models presented the lowest RMSE using SVM_L, and thus indicates a linear relationship between the EDXRF spectral data and the studied targets.

a) P b) TOC
c) pH d) H+Al
e) Ca f) Mg
g) K h) SB
i) CEC j) BSP
Figure 5: RMSE values for each target considering the different combinations of methods and base-learners. The horizontal lines represent the lowest RMSE for ST related to each target.

Two properties, pH and Mg, did not improve their predictive performances through the use of MTR. For pH and Mg, all base-learners (SVM_L, SVM_R and RF) provided the same lowest RMSE in ST and MTR methods, respectively 0.3 and 0.4 cmol kg.

All the other properties, we have at least one meta-model with reduced error in comparison to ST. Regarding K, all ST and MTR methods obtained 0.10 cmol kg, except our proposal. MTSG (SVM_R) was able to reduce the error to 0.09 cmol kg. For P, SVM_L provided the lowest RMSE in ST method (7.8 mg kg). Considering P and MTR methods, MTSG with RF was able to reduce this error to 7.6 mg kg. For TOC, SVM_L provided the lowest RMSE in ST method (2.3 g kg). Regarding TOC and MTR methods, MTSG with SVM_R and RF was able to reduce the error to 2.1 g kg. Dealing with H+Al, SVM_L and RF provided the lowest RMSE in ST method (0.9 cmol kg). About MTR methods and this property, SVM_L and RF achieved the same error (0.9 cmol kg). MTSG with SVM_R was also able to achieve this value. When predicting Ca, SVM_L provided the lowest RMSE in ST method (0.8 cmol kg). Using MTR methods, SST, ERC, MTAS and DRS with SVM_L and RF achieved the same error (0.8 cmol kg). MOTC achieved this error only using SVM_L and MTSG achieved this error with RF, SVM_L and SVM_R. Regarding SB, SVM_L provided the lowest RMSE in ST method (1.0 cmol kg). Considering MTR methods, SVM_L and RF achieved the same error (1.0 cmol kg). MTSG with SVM_R was also able to achieve this value. For CEC, SVM_L, SVM_R and RF provided the lowest RMSE in ST method (0.9 cmol kg). Considering MTR methods, MTAS with SVM_L and MTSG with SVM_R and RF were able to reduce the error to 0.8 cmol kg. Finally, regarding BSP, RF provided the lowest RMSE in ST method (6.6%). Considering MTR methods, DRS with RF was able to reduce the error to 6.1%.

To summarise, in ST method, for pH and, Mg, all base-learners shared the same RMSE. RF alone presented the lowest error in ST only for BSP. Thus, for ST method, SVM_R was not the unique best regressor for any of the targets, and there is a prevalence of SVM_L. This scenario, however, changed when these regressors were used as base-learners for the MTR methods: ignoring the cases that MTR did not bring improvements to ST, RF was present as the base-learner for 4 targets (P, TOC, CEC and BSP), SVM_R for 3 targets (TOC, K and CEC) and SVM_L for 1 target (CEC). This shows that the modifications inherent to MTR methods introduced non-linearity to the data.

P is one target that was favoured by this non-linearly: the Pearson correlation coefficients of P with other targets, as discussed in Figure 3, revealed that it was least linearly correlated to other targets. Nonetheless, its RMSE lowered with MTSG coupled with RF.

As observed, the best MTR methods resulted in RMSE values at least equivalent to ST. For the targets pH, H+Al, Ca, Mg and SB, none of the MTR methods improved the performance, so ST would be preferable to predict them due to the lower complexity. On the other hand, for the other 5 targets, at least one MTR method improved the performance, specially MTSG, but also DRS and MTAS.

In order to evaluate the accuracy of the best models for each target related to the conventional methods, the RPD for the predictions were calculated (Table 2). The standard deviation data used for RPD calculation is on the Appendix A.

Targets Best model(s) RMSE RPD
P (mg kg) MTSG (RF) 7.6 1.2
TOC (g kg) MTSG (SVM_R, RF) 2.1 2
pH All models 0.3 1.3
H+Al (cmol kg) Several models 0.9 1.3
Ca (cmol kg) Several models 0.8 1.9
Mg (cmol kg) All models 0.4 1.5
K (cmol kg) MTSG (SVM_R) 0.09 1.3
SB (cmol kg) Several models 1 1.9
CEC (cmol kg) MTAS (SVM_L), MTSG (SVM_R, RF) 0.8 1.9
BSP (%) DRS (RF) 6.1 1.8
Table 2: RPD performance of the best models.

The targets that presented poor prediction, where only high and low values are distinguishable, were P, pH, H+Al and K. These targets had low prediction performance with EDXRF sensor due to its low detection sensibility for light elements. For Mg, the models obtained fair predictions, indicating the viability of the method. BSP is in the threshold of fair and good predictions. Ca, SB and CEC presented good predictions. Finally, TOC is in the threshold between good and very good quantitative predictions.

5 Conclusion

In this work, we evaluated the usage of MTR methods to predict 10 soil parameters based on EDXRF as input information. We also developed MTSG, a novel MTR method. In relation to the aRRMSE, MTR methods were able to reduce the error over ST, especially MTAS, DRS and MTSG. Concerning RPT, for all targets, all MTR methods were better than or equal to their respective regressor version in ST. MTSG was the best method for predicting the soil characteristics of the problem, obtaining the lowest RMSE for 4 out of the 10 targets and was able to reduce the baseline aRRMSE from 0.67 to 0.64, representing a global improvement of 4.48%. In the best target improvement, i.e. base saturation percentage (BSP), the proposed method boosted in 19% the predictive performance using SVM_R baseline. The comparison to reference methods also showed that the predictions were at least fair for 6 targets. Based on the results, MTR is capable of improving the prediction of soil properties.

As future work, we will investigate the use of MTSG with more different base-learners when creating the base-models, even the meta-model, since it was observed suitable algorithms for particular targets. Besides, the combination of different types of PSS (e.g. Infrared spectroscopy, Raman spectroscopy, EDXRF, etc) and MTR methods may offer a viable solution for direct soil analysis, and it can be further explored.

6 Acknowledgement

This study was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001, CNPQ (grants #420562/2018-4, #142985/2016-3 and #304722/2017-0), São Paulo Research Foundation (FAPESP) grant #2018/07319-6 and Fundação Araucária (Brazilian Agencies). We would like to thank Dr. Graziela M.C. Barboza, Dr. José Francirlei de Oliveira and IBITIBA research project ( for the support in sample collection and conventional analysis.


Appendix A: General comparison of MTSG with other methods

The Table 3 presents the descriptive statistic of the soil parameters determined by conventional analysis for all samples, calibration set and prediction set.

Parameters Mean SD CV (%) Minimum Maximum
All samples (n=396)
TOC (g kg) 19.8 4.1 22 7.6 30.5
pH 5.3 0.4 8 4.2 6.5
H+Al (cmol kg) 5.4 1.1 20 2.7 9.7
Ca (cmol kg) 6.0 1.5 25 1.4 9.2
Mg (cmol kg) 2.0 0.6 28 0.7 3.7
K (cmol kg) 0.24 0.16 67 0.05 1.15
P (mg kg) 13.9 9.9 71 0.4 69.8
SB (cmol kg) 8.2 1.9 23 2.1 12.6
CEC (cmol kg) 13.7 1.5 11 9.3 17.9
BSP (%) 60 10 18 18 80
Calibration set (n=264)
TOC (g kg) 20.0 4.4 22 7.6 30.5
pH 5.3 0.4 8 4.2 6.5
H+Al (cmol kg) 5.4 1.0 19 2.7 9
Ca (cmol kg) 6.1 1.5 24 1.4 9.2
Mg (cmol kg) 2.1 0.6 28 0.7 3.5
K (cmol kg) 0.25 0.17 68 0.05 1.15
P (mg kg) 14.1 10.2 72 0.4 69.8
SB (cmol kg) 8.4 1.8 22 2.2 12.6
CEC (cmol kg) 13.8 1.6 11 9.3 17.9
BSP (%) 60 9 15 20 80
Prediction set (n=132)
TOC (g kg) 19.4 4.2 22 9.5 29.2
pH 5.3 0.4 8 4.2 6.5
H+Al (cmol kg) 5.5 1.2 22 3.1 9.7
Ca (cmol kg) 5.6 1.5 27 1.4 8.7
Mg (cmol kg) 2.0 0.6 30 0.6 3.7
K (cmol kg) 0.20 0.12 60 0.05 0.65
P (mg kg) 13.5 9.4 70 0.6 55
SB (cmol kg) 7.9 1.9 24 2.1 11.9
CEC (cmol kg) 13.4 1.4 11 9.4 17.2
BSP (%) 58 11 18 18 77
Table 3: Result of descriptive statistics of soil parameters determined by conventional methods. SD represents standard deviation and CV, coefficient of variation.

Appendix B: General comparison of MTSG with other methods

MTSG is being first proposed in this work. To validate this method, MTSG performance was assessed in benchmarking datasets commonly used in MTR literature.

These datasets enclose different kind of problems, as shown in (Spyromitros-Xioufis et al., 2016): air ticket prices (atp1d and atp7d), machining parameter settings (edm), solar flares types (sf1 and sf2), heavy metals concentration in soil (jura), energy efficient buildings requirements (enb), concrete properties (slump), water quality properties (andro) and online engagement (scpf).

The aRRMSE resulting of the usage of ST, SST, ERC, MTAS, MTSG, MOTC and DRS with the base learners RF and SVM_R for these datasets are presented in Table 4. The average rankings obtained by each of the MTR methods are also presented at the bottom of the table for visual clarity.


width=center Dataset ST SST ERC MTAS MOTC DRS MTSG RF SVM_R RF SVM_R RF SVM_R RF SVM_R RF SVM_R RF SVM_R RF SVM_R atp1d 0.3927 0.4291 0.3889 0.4290 0.3898 0.4290 0.3841 0.4170 0.4064 0.4627 0.3894 0.4311 0.3935 0.4230 atp7d 0.5108 0.6169 0.5041 0.6166 0.5094 0.6169 0.5107 0.5983 0.5844 0.7805 0.5025 0.6159 0.5250 0.5877 edm 0.6668 0.7400 0.7146 0.7321 0.6620 0.7355 0.6852 0.6779 0.6655 0.8761 0.6799 0.7489 0.7404 0.6691 sf1 0.8749 0.8054 1.0145 0.8131 0.9078 0.8013 1.0347 0.8167 0.8723 0.9938 0.8744 0.8040 1.0499 1.0001 sf2 0.8254 0.7840 0.8955 0.7878 0.8399 0.7851 0.9150 0.7894 0.8280 1.5992 0.8303 0.7829 0.9324 1.4815 jura 0.5842 0.6210 0.5734 0.6240 0.5752 0.6202 0.5673 0.5997 0.5792 0.6967 0.5758 0.6280 0.5739 0.6596 enb 0.1504 0.2510 0.1145 0.2190 0.1293 0.2415 0.1085 0.1236 0.1169 0.3171 0.1129 0.1688 0.1162 0.2017 slump 0.8293 0.7348 0.8484 0.7510 0.8182 0.7293 0.8159 0.8165 0.7633 0.7039 0.8654 0.7364 0.7982 0.7487 andro 0.8131 1.1912 0.7330 1.0197 0.7886 1.0929 0.5952 0.8980 0.5568 1.1806 0.5435 0.7713 0.6078 0.6009 scpf 0.8683 0.8190 0.8533 0.8016 0.8321 0.8060 0.9466 2.5352 0.8701 3.3978 0.8444 0.8026 0.8793 0.8033 Average rank 7.20 8.50 6.60 7.80 6.20 7.70 6.20 7.90 5.90 12.20 5.40 7.30 8.10 8.00

Table 4: aRRMSE comparison among the methods for literature benchmarking datasets. The bold values correspond to the smallest aRRMSE per dataset for each learning algorithm.

As observed, none of the methods is the best for all the problems. MTAS presented the lowest performance in 3 datasets for both RF and SVM_R. ERC, MTSG, MOTC and DRS presented the lowest aRRMSE for 3 datasets each, depending on the base regressor. SST and ST were able to minimise the aRRMSE once each.

To conclude, the result shows that MTSG performance is comparable to previous proposed methods. Also, depending on the problem, its performance can be superior to the other methods.


  1. journal: arXiv


  1. Barbon Junior, S., Mastelini, S.M., Barbon, A.P.A.C., Barbin, D.F., Calvini, R., Lopes, J.F., Ulrici, A., 2019. Multi-target prediction of wheat flour quality parameters with near infrared spectroscopy. Information Processing in Agriculture .
  2. Borchani, H., Varando, G., Bielza, C., Larrañaga, P., 2015. A survey on multi-output regression. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery 5, 216–233.
  3. Breiman, L., 1996. Stacked regressions. Machine learning 24, 49–64.
  4. Brown, G., Wyatt, J., Harris, R., Yao, X., 2005. Diversity creation methods: a survey and categorisation. Information Fusion 6, 5–20.
  5. Byers, H.L., McHenry, L.J., Grundl, T.J., 2019. XRF techniques to quantify heavy metals in vegetables at low detection limits. Food Chemistry: X 1, 100001.
  6. Chlingaryan, A., Sukkarieh, S., Whelan, B., 2018. Machine learning approaches for crop yield prediction and nitrogen status estimation in precision agriculture: A review. Computers and Electronics in Agriculture 151, 61–69.
  7. Dao, T.H., 2016. Instantaneous accounting for leaf water in X-ray fluorescence spectra of corn grown in manure-and fertilizer-amended soils. Computers and Electronics in Agriculture 129, 84–90.
  8. Declercq, Y., Delbecque, N., De Grave, J., De Smedt, P., Finke, P., Mouazen, A.M., Nawar, S., Vandenberghe, D., Van Meirvenne, M., Verdoodt, A., 2019. A comprehensive study of three different portable XRF scanners to assess the soil geochemistry of an extensive sample dataset. Remote Sensing 11, 2490.
  9. Elavarasan, D., Vincent, D.R., Sharma, V., Zomaya, A.Y., Srinivasan, K., 2018. Forecasting yield by integrating agrarian factors and machine learning models: A survey. Computers and Electronics in Agriculture 155, 257–282.
  10. Kaniu, M., Angeyo, K., Mwala, A., Mangala, M., 2012. Direct rapid analysis of trace bioavailable soil macronutrients by chemometrics-assisted energy dispersive X-ray fluorescence and scattering spectrometry. Analytica Chimica Acta 729, 21–25.
  11. Khuder, A., Ahmad, M., Hasan, R., Saour, G., 2010. Improvement of X-ray fluorescence sensitivity by dry ashing method for elemental analysis of bee honey. Microchemical Journal 95, 152–157.
  12. Kocev, D., Džeroski, S., White, M.D., Newell, G.R., Griffioen, P., 2009. Using single- and multi-target regression trees and ensembles to model a compound index of vegetation condition. Ecological Modelling 220, 1159–1168.
  13. Liu, B., Wang, R., Guan, Z., Li, J., Xu, Z., Guo, X., Wang, Y., 2019. Improved support vector regression models for predicting rock mass parameters using tunnel boring machine driving data. Tunnelling and Underground Space Technology 91, 102958.
  14. Mancini, M., Weindorf, D.C., Chakraborty, S., Silva, S.H.G., dos Santos Teixeira, A.F., Guilherme, L.R.G., Curi, N., 2019. Tracing tropical soil parent material analysis via portable X-ray fluorescence (pXRF) spectrometry in Brazilian Cerrado. Geoderma 337, 718–728.
  15. Mantler, M., Schreiner, M., 2000. X-ray fluorescence spectrometry in art and archaeology. X-Ray Spectrometry: An International Journal 29, 3–17.
  16. Margenot, A., O’Neill, T., Sommer, R., Akella, V., 2020. Predicting soil permanganate oxidizable carbon (POXC) by coupling drift spectroscopy and artificial neural networks (ANN). Computers and Electronics in Agriculture 168, 105098.
  17. Mastelini, S.M., da Costa, V.G.T., Santana, E.J., Nakano, F.K., Guido, R.C., Cerri, R., Barbon, S., 2018a. Multi-output tree chaining: An interpretative modelling and lightweight multi-target approach. Journal of Signal Processing Systems , 1–25.
  18. Mastelini, S.M., Santana, E.J., da Costa, V.G.T., Barbon, S., 2018b. Benchmarking multi-target regression methods, in: 2018 7th Brazilian Conference on Intelligent Systems (BRACIS), IEEE. pp. 396–401.
  19. Melki, G., Cano, A., Kecman, V., Ventura, S., 2017. Multi-target support vector regression via correlation regressor chains. Information Sciences 415, 53–69.
  20. Mendes-Moreira, J., Soares, C., Jorge, A.M., Sousa, J.F.d., 2012. Ensemble approaches for regression: A survey. ACM Computing Surveys (CSUR) 45, 10.
  21. Morona, F., dos Santos, F.R., Brinatti, A.M., Melquiades, F.L., 2017. Quick analysis of organic matter in soil by energy-dispersive X-ray fluorescence and multivariate analysis. Applied Radiation and Isotopes 130, 13–20.
  22. Moyano, J.M., Gibaja, E.L., Ventura, S., 2017. An evolutionary algorithm for optimizing the target ordering in ensemble of regressor chains, in: 2017 IEEE congress on evolutionary computation (CEC), IEEE. pp. 2015–2021.
  23. Nawar, S., Delbecque, N., Declercq, Y., De Smedt, P., Finke, P., Verdoodt, A., Van Meirvenne, M., Mouazen, A.M., 2019. Can spectral analyses improve measurement of key soil fertility parameters with X-ray fluorescence spectrometry? Geoderma 350, 29–39.
  24. Parsons, C., Grabulosa, E.M., Pili, E., Floor, G.H., Roman-Ross, G., Charlet, L., 2013. Quantification of trace arsenic in soils by field-portable X-ray fluorescence spectrometry: considerations for sample preparation and measurement conditions. Journal of Hazardous Materials 262, 1213–1222.
  25. Pavan, M.A., Bloch, M.d.F., Zempulski, H.d.C., Miyazawa, M., Zocoler, D.C., 1992. Manual de análise química de solo e controle de qualidade. IAPAR Londrina, Londrina.
  26. Rawal, A., Chakraborty, S., Li, B., Lewis, K., Godoy, M., Paulette, L., Weindorf, D.C., 2019. Determination of base saturation percentage in agricultural soils via portable X-ray fluorescence spectrometer. Geoderma 338, 375–382.
  27. Read, J., Pfahringer, B., Holmes, G., Frank, E., 2009. Classifier chains for multi-label classification, in: Joint European Conference on Machine Learning and Knowledge Discovery in Databases, Springer. pp. 254–269.
  28. Rooney, N., Patterson, D.W., Anand, S.S., Tsymbal, A., 2004. Random subspacing for regression ensembles., in: FLAIRS Conference.
  29. Rossel, R.V., McGlynn, R., McBratney, A., 2006. Determining the composition of mineral-organic mixes using UV–vis–NIR diffuse reflectance spectroscopy. Geoderma 137, 70–82.
  30. Santana, E.J., Geronimo, B.C., Mastelini, S.M., Carvalho, R.H., Barbin, D.F., Ida, E.I., Barbon, S., 2018. Predicting poultry meat characteristics using an enhanced multi-target regression method. Biosystems Engineering 171, 193 – 204.
  31. Santana, E.J., Mastelini, S.M., Barbon Jr., S., 2017. Deep Regressor Stacking for Air Ticket Prices Prediction, in: XIII Brazilian Symposium on Information Systems: Information Systems for Participatory Digital Governance, Brazilian Computer Society (SBC). pp. 25–31.
  32. Rodrigues dos Santos, F., de Almeida, E., da Cunha Kemerich, P.D., Melquiades, F.L., 2017. Evaluation of metal release from battery and electronic components in soil using SR-TXRF and EDXRF. X-Ray Spectrometry 46, 512–521.
  33. Santos, H.G.d., Jacomine, P.K.T., Anjos, L.H.C.d., Oliveira, V.A.d., Oliveira, J.B.d., Coelho, M.R., Lumbreras, J.F., Cunha, T.J.F.d., 2006. Sistema brasileiro de classificação de solos .
  34. Sharma, A., Weindorf, D.C., Wang, D., Chakraborty, S., 2015. Characterizing soils via portable X-ray fluorescence spectrometer: 4. cation exchange capacity (cec). Geoderma 239, 130–134.
  35. Spyromitros-Xioufis, E., Tsoumakas, G., Groves, W., Vlahavas, I., 2016. Multi-target regression via input space expansion: treating targets as inputs. Machine Learning 104, 55–98.
  36. Suchithra, M., Pai, M.L., 2019. Improving the prediction accuracy of soil nutrient classification by optimizing extreme learning machine parameters. Information Processing in Agriculture .
  37. Van Grieken, R., Markowicz, A., 2002. Handbook of X-ray Spectrometry. Marcel Dekker, New York.
  38. Wang, Y., Huang, T., Liu, J., Lin, Z., Li, S., Wang, R., Ge, Y., 2015. Soil pH value, organic matter and macronutrients contents prediction using optical diffuse reflectance spectroscopy. Computers and Electronics in Agriculture 111, 69–77.
  39. Weindorf, D.C., Bakr, N., Zhu, Y., 2014. Advances in portable X-ray fluorescence (PXRF) for environmental, pedological, and agronomic applications, in: Advances in Agronomy. Elsevier. volume 128, pp. 1–45.
  40. Weindorf, D.C., Zhu, Y., Chakraborty, S., Bakr, N., Huang, B., 2012. Use of portable X-ray fluorescence spectrometry for environmental quality assessment of peri-urban agriculture. Environmental Monitoring and Assessment 184, 217–227.
  41. Wolpert, D.H., 1992. Stacked generalization. Neural networks 5, 241–259.
  42. WRB, IUSS Working Group, 2014. World reference base for soil resources 2014, update 2015. International soil classification system for naming soils and creating legends for soil maps. World Soil Resources Report 106.
  43. Zhang, Y., Sui, B., Shen, H., Ouyang, L., 2019. Mapping stocks of soil total nitrogen using remote sensing data: A comparison of random forest models with different predictors. Computers and Electronics in Agriculture 160, 23–30.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description