| Soil is a crucial source of plant nutrients,and inadequate soil nutrient levels are linked to lower food quality and human health.While fertilization is a common method of supplementing soil nutrients,excessive chemical fertilizers have led to soil and groundwater pollution.As a result,organic fertilizers have become a significant way to enhance fertility,improve soil health,and encourage sustainable development.Despite the beneficial organic matter,nutrients,and microorganisms in organic fertilizers that enhance crop productivity and quality,they may also contain hazardous heavy metals like lead,cadmium,arsenic,and mercury,which can have lasting adverse effects on human health.Most organic fertilizer nutrient and heavy metal element detection methods rely on laborious and time-consuming laboratory analyses that cannot meet the demands for rapid quality testing in sustainable agriculture.This study aims to assess macronutrients,micronutrients,and heavy metals in organic fertilizer utilizing a noncontact optical detection approach and modern machine learning algorithms to deal with unfavorable health impacts.The present study employs two advanced techniques for elemental analysis,namely Laser-Induced Breakdown Spectroscopy(LIBS)and Visible and Near Infrared Spectroscopy(Vis-NIR).These methods are well-established and generate a vast amount of data.To streamline the analytical process,we employed innovative approaches to identify crucial features and fine-tune the machine learning model.The primary focus of this research is outlined below:(1)A novel approach involving particle swarm optimization(PSO)with two multiple stacked generalizations was built for estimating organic fertilizer’s nitrogen and organic matter(OM)by visible and near-infrared spectroscopy.The PSO-FSGC technique was used to select the best features,while the second stacked generalization method(SSGR)improved the detection of nitrogen and organic matter.Results showed that the PSO-FSGC technique was effective in finding the best feature subset,and the obtained FSGC-PSO subset combined with SSGR produced better prediction results for nitrogen and organic matter than the Ridge,SVM,and PLS models.The results showed high accuracy for predicting both N and OM.The coefficient of determination(R2p)for N was 0.9989,indicating a strong correlation between predicted and actual values,while the root mean square error of prediction(RMSEP)was 0.031.Similarly,the R2p for OM was 0.9972,which suggests a reliable prediction,and the RMSEP was 0.051.This framework is a promising tool for predicting the nitrogen and organic matter content of organic fertilizers and has the potential to be applied to other fields where spectroscopic data is available.Nitrogen management is a powerful tool for cutting back on greenhouse gas emissions.(2)Explainable AI(XAI)has been utilized to integrate Laser-Induced Breakdown Spectroscopy(LIBS)and Visible and Near-Infrared Spectroscopy(Vis-NIR)to enable identification of phosphorus(P)and potash(K)in diverse types of organic fertilizers.We developed and assessed Optimized Extratrees as a method for predicting PK.To explain the best model and decrease the amount of data,we utilized XAI through SHAP values.Our findings demonstrated that Extratrees outperformed SVM and PLS in PK characterization using both sensors.We utilized SHAP values to interpret the model and select high-impact features,enhancing PK detection performance for both sensors.By merging the spectra acquired by the two sensors(FUSION-SHAP),we obtained marginally better results than when using a single sensor(LIBS-SHAP or Vis-NIR-SHAP).The FUSION-SHAP model’s performance for P prediction yielded R2p=0.9946,RMSEP=0.0649%,and RPD=13.65,while for K prediction,it yielded R2p=0.9976,RMSEP=0.0508%,and RPD=20.28,all of which outperformed Vis-NIR-SHAP and LIBS-SHAP.Overall,this study demonstrates the potential of combining different sensing techniques with advanced XAI models for more accurate and efficient detection of important nutrients in organic fertilizers.(3)Micronutrients in organic fertilizer were analyzed using LIBS,Vis-NIR,and adaptative boosting(Adaboost)methods to address issues with deficiency and toxicity.We analyzed the various micronutrients,including copper(Cu),zinc(Zn),iron(Fe),manganese(Mn),calcium(Ca),and boron(B),utilizing complete spectral analysis and Ada Boost and extracted the pertinent characteristics for both LIBS and Vis-NIR.Various optimum feature extraction strategies were combined with optimized Adaboost to forecast micronutrients.The outcomes specified that:The performance of the quantification process of micronutrients can be improved by reducing LIBS and Vis-NIR spectra features.In terms of reduced features,PCA-LIBS obtained the highest results for Cu(R2p=0.9964,and RMSEP=0.05 mg kg-1),Zn(R2p=0.9999,and RMSEP=0.0074 mg kg-1),Mn(R2p=0.9999,and RMSEP=0.0068 mg kg-1),and B(R2p=0.9997,and RMSEP=0.016 mg kg-1).In contrast,ADA-Vis-NIR for Fe obtained the highest results with R2p=0.9984 and RMSEP=0.0299 mg kg-1.The detection of fusion sensors was found to be less effective than that of a single sensor.The results obtained with PCA-LIBS features for Cu,Zn,Mn,and B spectra and ADA-LIBS features for Fe spectra were significantly superior to those obtained with the fusion spectrum.Meanwhile,regarding Ca micronutrient,the fusion spectrum was the most accurate with R2p=0.9999 and RMSE=0.0087mg kg-1.In conclusion,both Vis-NIR and LIBS offer an alternative,quick,and ecologically friendly method of analyzing samples,contributing to the quality control of organic fertilizers.(4)A novel pipeline combining the Boruta algorithm and a deep learning framework was integrated to automatically and quickly choose features and predict heavy metals in various organic fertilizer spectra obtained using Vis-NIR.Firstly,Boruta was computed to find the best-selected wavelengths for the heavy metals.Then a deep belief network was computed to determine the heavy metals concentration for the selected and full wavelengths.The results indicated that:(1)the selected wavelengths were at the near-infrared region,except Cr and Hg,which also have some essential wavelengths in the visible part.(2)the framework allowed for the detection of four harmful heavy metals,primarily lead(Pb),cadmium(Cd),chromium(Cr),and mercury(Hg),in various organic fertilizers.Compared to traditional machine learning techniques,the DBN model performed exceptionally well,with excellent results for the selected wavelengths.The R2p value was 0.96 for chromium,0.91 for lead,0.90 for mercury,and 0.87 for cadmium.The RMSEP and RPDpred values were also very good,indicating that the model was highly accurate.Overall,this study demonstrates the feasibility of using Boruta and DBN models and Vis-NIR to screen for heavy metals in organic fertilizers.This approach has the potential to save time and effort while also improving accuracy and efficiency. |