Machine Learning and NIR Spectroscopy Quantify Soil Carbon and Nitrogen.

Vinicius Herique Kieling, Guilherme Macedo Baggio, Felipe Augusto Bueno Rossi, Marco Antonio de Castro Barbosa, Dalcimar Casanova, Larissa Macedo dos Santos Tonial, Jefferson Tales Oliva· July 2, 2026 View original

Summary

This study proposes a machine learning approach using Near-Infrared (NIR) spectroscopy to accurately quantify carbon and nitrogen content in Inceptisol and Oxisol soil types. The research evaluates various preprocessing methods and validation strategies, demonstrating that stacking ensemble models achieve high predictive performance and low overfitting, offering a rapid and non-destructive alternative to traditional soil analysis.

Traditional methods for analyzing soil composition can be slow and costly. This research explores Near-Infrared (NIR) spectroscopy as a faster, cheaper, and non-destructive alternative for quantifying carbon (C) and nitrogen (N) content in specific soil types, namely Oxisols and Inceptisols. The study leverages a portable MyNIR device to collect spectral data, which is then processed using machine learning. The methodology involved a thorough evaluation of different data preprocessing techniques, with the Savitzky-Golay filter and a robust outlier removal method proving most effective. Various validation strategies were also compared to ensure model reliability. The core of the predictive system uses stacking ensemble learning, combining Partial Least Squares (PLS), Support Vector Regression (SVR), and Ridge regression as base models, with a linear regression meta-model. The resulting models achieved strong performance metrics (R2, RMSE, MAE, RPD > 2.0) and low overfitting, validating the potential for rapid and accurate C and N quantification.

Why it matters

For agriculture and environmental management, rapid and accurate soil analysis is crucial for optimizing sustainable practices, improving fertility, and making timely decisions on nutrient management. This method offers a significant leap in efficiency.

How to implement this in your domain

  1. 1Evaluate current soil analysis methods for speed, cost, and destructiveness.
  2. 2Investigate the feasibility of integrating portable NIR spectroscopy devices with ML models for real-time soil nutrient assessment.
  3. 3Pilot the proposed ML regression and preprocessing techniques on a specific agricultural field or research plot.
  4. 4Train and validate models using local soil data to ensure accuracy for specific regional soil types.
  5. 5Develop a decision-support tool for farmers and consultants based on the rapid C and N quantification.

Who benefits

AgricultureEnvironmental MonitoringLand ManagementAgritech

Key takeaways

  • NIR spectroscopy combined with ML offers a fast, low-cost, non-destructive soil analysis.
  • The method accurately quantifies carbon and nitrogen in Inceptisol and Oxisol soils.
  • Effective preprocessing and stacking ensemble models yield high predictive performance.
  • This approach supports sustainable agriculture through faster decision-making.

Original post by Vinicius Herique Kieling, Guilherme Macedo Baggio, Felipe Augusto Bueno Rossi, Marco Antonio de Castro Barbosa, Dalcimar Casanova, Larissa Macedo dos Santos Tonial, Jefferson Tales Oliva

"arXiv:2607.00834v1 Announce Type: new Abstract: Near-Infrared (NIR) spectroscopy has emerged as a promising alternative to traditional soil analysis methods, offering advantages such as speed, low cost, and non-destructive testing. This work proposes a machine learning (ML) appro…"

View on X

Originally posted by Vinicius Herique Kieling, Guilherme Macedo Baggio, Felipe Augusto Bueno Rossi, Marco Antonio de Castro Barbosa, Dalcimar Casanova, Larissa Macedo dos Santos Tonial, Jefferson Tales Oliva on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses