1 Introduction

The use of artificial neural networks (ANNs) [1, 2] in laser-induced breakdown spectroscopy (LIBS) [3, 4] quantitative analysis has been recently proposed in several research papers [59], because of the quickness and robustness of the algorithms and the availability of specialized commercial and open-source software [10]. The idea at the basis of most of the ANNs applications to the analysis of LIBS spectra is, in fact, the construction of nonlinear combination of a given number of inputs (LIBS spectral intensities), optimized for obtaining the best representation of a set of outputs (elemental concentrations) on a number of known samples (training). The coefficients of this multivariate, nonlinear combination, after a proper validation and testing can be used for calculating the desired outputs from a set of inputs obtained on unknown samples (prediction).

A reason of the success of ANNs in LIBS analysis is the extreme facility by which is possible, in a LIBS experiment, to accumulate hundreds of spectra, thus providing a quite large database for the most critical steps of the ANN procedure, i.e., the training and validation of the ANN model [11].

On the other hand, the ANN approach has important limitations that in some cases are similar to the one encountered in linear multivariate analysis [12] or even in standard monovariate analysis (calibration curves) [13].

In fact, one can intend the training of the network in a manner similar to the construction of a (multidimensional and nonlinear) calibration curve (which eventually becomes a surface in a multidimensional parameters’ space).

For linking effectually a series of ‘inputs’ to the ‘outputs’ (in a LIBS application, one can think about spectral lines’ intensities as inputs and elemental concentration as outputs), one should bring in mind that the general rules for the building of calibration curves [14] hold also for the ANN approach, i.e.,:

Rule 1—The experimental conditions in which the ‘calibration’ spectra are acquired must be the same through all the calibration process and must be maintained constant during the acquisition of the LIBS spectra on the unknown samples;

Rule 2—The methods based on a calibration approach are good for interpolation but might fail when used for extrapolating data out of the range of the calibration set. In other words, it is advisable that the samples used for training the ANN would bracket the concentrations of the unknown samples.

These two requirements put, obviously, important constraints on the applicability of the ANN method for the analysis of LIBS spectra that, by their nature, are extremely variable in response to changes, either intentional or unwanted, in the physical parameters of the plasma, i.e., ablated mass, electron number density and electron temperature. In LIBS experiments, the variation of the experimental parameters during the measurement is often unwanted but almost unavoidable, because of the laser energy fluctuations and the matrix changes between one sample and the other. To overcome the limitation of the classical calibration approach, either monovariate or multivariate, the authors proposed several years ago a method called calibration-free LIBS [1518], which is based on the possibility of measuring the above parameters, by which the atomic emission is governed, with the aim of obtaining outputs (concentrations) which would not depend on the fluctuations in laser energy and coupling with the target. In fact, these fluctuations are the main responsible for the variation of ablated mass, plasma temperature and electron number density and, in the last instance, for the indetermination in the relation between the inputs (line intensities) and the outputs, which is reflected in a corresponding indetermination on the calibration curve or the ANN model to be used for the determination of the composition of the unknown samples.

In a recent paper [19], the authors demonstrated the possibility of integrating the information obtained from the CF-LIBS method with the ANN algorithm, proposing a fast method for measuring electron temperature and number density on a pure titanium target, at the varying of the laser beam fluence on the target.

In this paper, we will demonstrate that using an approach based on the same concept, the composition of a metallic alloy can be determined even when the rules described above are not followed, providing a result which is much more precise than the one that can be obtained using the calibration curves approach and much faster than the one obtained by the use of the CF-LIBS approach, with a similar precision.

2 Experimental approach

For obtaining a better understanding of the advantages of an approach with respect to the others, we decided to work on synthetic LIBS spectra, simulated using a software developed by the authors [20]. The software is able to reproduce a number of complex experimental plasma (multi-elemental, inhomogeneous, subject to self-absorption and with temperature and electron number density gradients) but, for the present application, the LIBS spectra of a simple binary alloy (Cu–Ni) were simulated, assuming a homogeneous plasma at a given constant temperature and electron number density, with negligible self-absorption effects.

We considered an ideal set of samples, with Ni concentrations ranging from 0 to 10 %, analyzed by LIBS in different experimental conditions, roughly corresponding to the use of laser energies varying from 50 to 150 mJ in a typical LIBS configuration (1,064-nm laser wavelength, 10-ns pulse width and 200-μm laser spot on the target). These data were chosen to mimic the results of a real experiment (not shown here) from where realistic values of the parameters used in the simulation (electron temperature and number densities and ablated mass) were derived.

The experimental configurations considered to generate this set of data are summarized in Table 1.

Table 1 Parameters used for the generation of the synthetic LIBS spectra: Ni concentrations, electron temperature and electron number density corresponding to the three simulated laser energies

The ablated mass was considered proportional to the electron density.

The most intense emission lines of Cu and Ni, as experimentally observed in real LIBS experiments in the wavelength range between 200 and 500 nm, were simulated. The corresponding central wavelengths are shown in Table 2.

Table 2 Spectral parameters of the lines considered

In Table 2, the symbols ‘I’ and ‘II’ refer to the neutral and singly ionized species of the element, respectively. The equations used for the generation of the synthetic spectra were based on the local thermal equilibrium approximation [21]: The Boltzmann equation, which links the intensities of the lines emitted by the same species:

$$I_{k} = F\,C^{{({\text{I,II}})}} \frac{{A_{ki} \,g_{k} }}{{U^{{({\text{I,II}})}} (T)}}e^{{ - \frac{{E_{k} }}{kT}}}$$
(1)

and the Saha–Boltzmann equation, which links the concentrations of the two different ionization stages of the same element:

$$\frac{{n_{e} \,C^{\text{II}} }}{{C^{\text{I}} }} = \frac{{\left( {2\pi \,m_{e} \,kT} \right)^{{{3 \mathord{\left/ {\vphantom {3 2}} \right. \kern-0pt} 2}}} }}{{h^{3} }}\frac{{2U^{\text{II}} (T)}}{{U^{\text{II}} (T)}}\exp \left( - \frac{{E_{\text{ion}} }}{kT}\right)$$
(2)

.

In Eqs. (1) and (2), F is a factor, proportional to the ablated mass, which in real experiments also takes into account the (constant) efficiency of the spectral detection system, T represents the electron temperature, n e is the electron number density, N is the concentration of the species, E k and E ion are the energies of the upper level of the transition and the ionization energy of the element, respectively, A ki and g k are the transition probability and the degeneracy of the upper level, tabulated in the NIST database [22], U(T) is the partition function of the species considered, k is the Boltzmann constant, m e is the electron mass and h is the Planck constant. We assumed as usual in LIBS measurements that \(C^{\text{I}} + C^{\text{II}} = C_{s}\), where C s represents the concentration of the element in the sample. The variability between the spectra was simulated by applying a random Poisson noise at each considered wavelength, with \(\lambda\) value equal to the average value of the emission intensity at that wavelength. Then, 1,000 independent spectra were simulated for each ‘sample’ in Table 1 at the different laser energies.

3 Quantitative analysis of the synthetic LIBS spectra

3.1 Calibration-free analysis

Since the simulated LIBS spectra were obtained using the basic LTE equation in ideal conditions (homogeneous plasma, no self-absorption effects), the application of the CF-LIBS method, which is based on exactly the same assumptions, would give a perfect agreement between the nominal concentrations and the ones determined by the analysis. In principle, the CF-LIBS is able to take into account the unavoidable variations in laser energy and coupling with the sample on a single spectrum basis, but this possibility is seldom exploited in practice, since in a real experimental condition, the application of the method on thousands of samples would take a prohibitively long time. The approach generally used in CF-LIBS analysis is working on averaged spectra, although it should be clear that the sample compositions calculated on an averaged spectrum could be different from the average of the compositions determined on the single spectra.

3.2 Calibration curve approach

A simpler approach to the quantitative analysis of a large number of spectra is the building of a suitable calibration curve by plotting the line intensity of one of the characteristic emission lines of the element versus its known concentration in the sample. In the case of the LIBS simulated data that are the subject of our discussion, the calibration curve approach in correspondence of the three configurations considered, roughly corresponding to laser energies of 50, 100 and 150 mJ, produces, as it should, three different linear curves (see Fig. 1).

Fig. 1
figure 1

Calibration curves for the samples analyzed at the laser energy of 50 mJ (black squares), 100 mJ (green squares) and 150 mJ (red squares)

The effect of the variation of laser energy is often compensated, in the framework of the calibration curve approach, by plotting the ratio of the line intensity of the minor element of interest (in this case, Ni) to the line intensity of an element in the matrix (Cu), as a function of the concentration ratio. In our case, being the alloy binary, the two concentrations of Cu and Ni are related as [Ni] = 100 % − [Cu] and the square brackets indicate the concentration of the element in percent. It is therefore very simple to obtain the individual concentrations of Ni and Cu once their ratio is known. However, this approach does not completely reduce the spread between the calibration curves obtained at the different energies, as evidenced in Fig. 2.

Fig. 2
figure 2

Calibration curves for the samples analyzed at the laser energy of 50 mJ (black squares), 100 mJ (green squares) and 150 mJ (red squares). The intensity ratio between intensities of the Ni I line at 362.0 and the Cu I line at 578.2 nm is plotted versus the ratio of Ni and Cu concentrations

I n fact, the ratio of two lines of Ni and Cu can be written as

$$\frac{{I_{k}^{\text{Ni}} }}{{I_{k}^{\text{Cu}} }} = \frac{{[{\text{Ni}}\,{\text{I}}]}}{{[{\text{Cu}}\,{\text{I}}]}}\frac{{A_{ki}^{\text{Ni}} \,g_{k}^{\text{Ni}} \,U^{\text{Cu}} (T)}}{{A_{ki}^{\text{Cu}} \,g_{k}^{\text{Cu}} \,U^{\text{Ni}} (T)}}e^{{ - \frac{{\left( {E_{k}^{\text{Cu}} \, - \,E_{k}^{\text{Ni}} } \right)}}{kT}}} .$$
(3)

Neglecting the dependence on the temperature of the partition function U(T), the only dependence on the electron temperature T of the line ratio of Eq. (3) is through the exponential, which becomes close to 1 when \(E_{k}^{\text{Cu}} \approx E_{k}^{\text{Ni}}\). This is apparently the case of the lines considered in Fig. 2, where the Ni I line at 362.0 nm (E k  = 3.1 × 10cm−1) is divided by the Cu I line at 578.2 nm (E k  = 3.05 × 10cm−1). However, the Saha–Boltzmann equation [Eq. (2)] states that even when \(E_{k}^{\text{Cu}} \approx E_{k}^{\text{Ni}}\), the ratio between two lines of the same ionization stage is proportional to the ratio between the concentrations of the two corresponding species, which is not the same as the ratio of the concentrations of the elements, because [Cu] = [Cu I] + [Cu II], [Ni] = [Ni I] + [Ni II] and the ratios [Ni II]/[Ni I] and [Cu II]/[Cu I] depend on the temperature differently for the two elements, according to the predictions of Eq. (2).

It is thus evident that a simple approach based on the building of a calibration curve would not allow for the quantitative analysis of LIBS spectra when both the Ni concentration and the laser irradiance on the sample are unknown.

3.3 Artificial neural network analysis

Artificial neural networks are data-driven intelligent systems with the capability to learn from examples. Based on suitable collected data, ANNs can be trained to approximate any input–output relationship with any desired degree of accuracy. We therefore decided to apply the neural network approach to the specific case under study in order to overcome the unsatisfactory results of the calibration curve approach. To this aim, we built a neural network using as output the Ni concentration of the samples, and as inputs the simulated intensities of a suitable subset of the available spectral lines shown in Table 2. We chose for this purpose two neutral copper lines (Cu I at 521.8 and Cu I at 578.2 nm) and two lines belonging to different stages of ionization of Ni (Ni II at 241.6 and Ni I at 362.0 nm). The network was trained using as inputs the values of the LIBS intensities of the four spectral lines selected and as output the known Ni concentration of the samples. After the training, the ANN model is expected to give the Ni concentration in unknown samples on the basis of the measured LIBS intensities of the same lines used at the training stage.

We used a feed-forward neural network with one hidden layer, to implement the fitting model. The transfer functions for the hidden neurons and the output neurons are, respectively, the usual hyperbolic tangent sigmoid function and linear function, as Fig. 3 shows. We tried a number of hidden neurons ranging from 3 to 10. For each number of hidden neurons, we performed ten different experiments by training, validating and testing the network with 70, 15 and 15 %, respectively, of the spectra. The spectra at our disposal were 13,000. For each experiment, the network performance was evaluated as the average of the mean squared errors (MSE) made on the test set in the ten runs. The best performance was achieved with three hidden neurons. The parameters used are summarized in Table 3.

Fig. 3
figure 3

Network model employed in the experiments. The model has four inputs, three hidden neurons with hyperbolic tangent sigmoid transfer function, and one output neuron with linear transfer function (the figure was depicted in the Matlab® environment)

Table 3 Parameters of the neural network model employed

Figure 4 shows the regression graphs for the training, validation and test sets, and the whole data set: the R value = 1 indicates an optimal linear fitting of the model to the data. Indeed, the MSE is of the order of 10−4. Figure 5 shows the error histogram for the training, validation and test sets.

Fig. 4
figure 4

Regression performance of the ANN predictions with respect to the nominal Ni concentration for training, validation and test sets, and the whole data set. Continuous lines correspond to the ideal condition where the output coincides with target

Fig. 5
figure 5

Error histogram of the ANN predictions with respect to the nominal Ni concentration for training, validation and test sets

Note that the ANN model correctly predicts the Ni concentration of the test samples independently on the experimental parameters used for the generation of the simulated spectra, in a way very similar to the CF-LIBS approach. However, a more sensible assessment of the ANN performance can be obtained by testing the network on ‘unknown’ samples that were never used during the training phase. To this purpose, we generated another set of simulated LIBS spectra, roughly corresponding to laser energies of 75 and 125 mJ, as reported in Table 4.

As done before, 1,000 spectra per sample were simulated and used as test of the performance of the ANN.

The results of this test (Fig. 6) are unsatisfactory. Indeed, the MSE of the ANN predictions on spectra obtained in conditions different from the ones used for the training of the net is of the order of 10−1, showing that the information provided to the ANN is, evidently, not enough to disentangle the complex link between temperature, electron number density, Ni concentration and the LIBS line intensities. Similar results can be obtained using as inputs all the seven spectral lines simulated in the experiment.

Fig. 6
figure 6

Comparison between the target values and the neural outputs for the Ni concentrations related to the ‘unknown’ LIBS spectra corresponding to the parameters in Table 4. Continuous line corresponds to the ideal condition where the output coincides with the target

The strategy that we applied for improving the ANN performance on ‘unknown’ samples derives from the results obtained in Ref. [19]; in that paper, the authors demonstrated the possibility of training an ANN for determining, using only the spectral information obtained from the LIBS spectrum, the electron temperature and electron number density of the corresponding LIBS plasma. The main issue faced in Ref. [19] was the problem related to the acquisition of LIBS spectra with ‘known’ values of electron temperature and electron number density to be used for the training of the ANN. A feasible solution was found associating to all the spectra acquired in the same experimental conditions the same values of the electron temperature and number density, as previously calculated using the CF-LIBS algorithm on the corresponding averaged spectra. This simplification reduces dramatically the time needed for the preliminary analysis of the samples to be used for the training. The robustness of the ANN algorithm tolerates the intrinsic experimental uncertainty on these parameters and the ANN model created, after the training stage, was demonstrated to give reliable information on the electron temperature and electron number density of unknown spectra, on a single spectrum basis, in fractions of a second. Of course, for the method to be effective, the spectral lines used as inputs for the network must bring the information needed for determining the parameters of the LIBS plasma. Actually, the relative intensities of the lines selected for the previous experiments depend on the electron temperature (that could be calculated from the two neutral copper lines at 521.8 and 578.2 nm), while the two Ni lines, belonging to different stages of ionization (Ni II at 241.6 and Ni I at 362 nm) would allow the determination of the electron number density. The same lines provide information about the Ni concentration in the samples. Therefore, in this case, the outputs of the neural network are the values of the electron temperature and the electron number density (properly rescaled for having all the variables in the same order of magnitude), together with the Ni concentration. The network architecture has been experimentally determined as explained earlier (see Fig. 7).

Fig. 7
figure 7

Improved neural network model employed in the experiments. The model has four inputs, three hidden neurons with hyperbolic tangent sigmoid transfer function, and three outputs with linear transfer function

As in the previous test, the ANN demonstrates a good ability in reproducing almost perfectly the plasma parameters and Ni concentration, at the three laser energies considered in this paper (see Figs. 8 and 9). The MSE on training, validation and test sets is of the order of 10−4.

Fig. 8
figure 8

Regression performance of the improved ANN for training, validation and test sets, and the whole data set

Fig. 9
figure 9

Error histogram of the improved ANN outputs with respect to the target for training, validation and test sets

The real test of the performance of the improved ANN exploits a set of samples not used for the training stage. As in the previous case, we used as test set the new set of LIBS spectra simulated using the parameters in Table 4. The results of the analysis are shown in Fig. 10.

Table 4 Parameters used for the generation of the ‘unknown’ synthetic LIBS spectra
Fig. 10
figure 10

Comparison between the target values and the output of the improved ANN for the Ni concentration related to the ‘unknown’ LIBS spectra corresponding to the parameters in Table 4. Continuous line corresponds to the ideal condition where the output coincides with the target

In this case, the improved ANN is capable of predicting with appreciable precision (MSE of the order of 10−3) the Ni concentration in the ‘truly unknown’ samples used for the test. One should note that the improved ANN gives also the correct values of the electron temperature and electron number density (with an error around 2 %), on a single spectrum base, as shown in Fig. 11.

Fig. 11
figure 11

Predictions of the improved ANN for the spectral parameters of the set of ‘unknown’ LIBS spectra, corresponding to the parameters in Table 4. Left: Electron temperature; Right: Electron number density. The curve in red represents the predictions of the ANN, the one in black the nominal value of the parameters. Each point corresponds to a single LIBS spectrum

4 Conclusion

In this paper, we have demonstrated that in the presence of large variations, either wanted or undesired, of the laser beam energy or of its coupling with the sample, an approach based on the use of a single calibration curve might not be appropriate. Using a set of simulated LIBS spectra, synthetized assuming different experimental parameters (electron temperature, electron number density and ablated mass) we have also shown that a ‘general purpose’ approach based on the application of a simple ANN, having as inputs the LIBS line intensities, might have a poor precision in predicting the Ni concentration on a Cu matrix. However, a hybrid approach where the ANN is trained using the results of a CF-LIBS calculation of the electron temperature and electron number densities (on the averaged spectra) has demonstrated to be much more precise, giving as fringe benefit also a good information on the electron temperature and electron number densities on the unknown samples, on a single spectrum base, as in CF-LIBS analysis but in a much faster way. These results underline the importance to deal with the mathematical aspects of the ANN method without forgetting the physical principles at the basis of the LIBS technique, when the objective is using the ANN technique for ‘real world’ applications.