Detection of Bovine Mastitis in Raw Milk, Using a Low-Cost NIR Spectrometer and k-NN Algorithm
Abstract
:1. Introduction
2. Materials and Methods
2.1. Data Acquisition
2.2. k-Nearest Neighbor
2.3. Autoscaling of the Data
2.4. Feature Selection
2.5. Data Partition
2.6. Performance Metrics
2.7. Proposed Method
- Preprocessing techniques used in the data.
- Wavelength selection threshold.
- Number of nearest neighbors.
3. Results
3.1. Data Preprocessing
- Raw reflectance spectra directly obtained from the NIR-reflectance instrument without further preprocessing. This is the primary source of information in any NIR spectra [50].
- The Beer–Lambert technique suggests a linear relationship between the concentration of a component and the absorbance of the spectra. The formula can be expressed as follows [50]:Aλ = −log10(R) ≅ ϵλlc
- The aim of the detrending technique is to remove the baseline and the curvilinearity of the spectra. This method models the baseline as a linear function, which is then subtracted from each spectrum value independently [57].
- Savitzky and Golay [58] popularized a method named after its authors, which consists of a smoothing function for the numerical derivation of a vector. In this method, a p-order polynomial is fitted and then the d-order derivative is calculated at center point i.
- Standard normal variate (SNV) is a technique used for scattering correction [59]. This process can be expressed in the form of the following equation:
3.2. Optimization of Model 1: Classification of Positive/Negative Samples
3.3. Optimization of Model 2: Classification of Clinical/Subclinical Positive Samples
4. Discussion
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Sharma, N.; Rho, G.J.; Hong, Y.H.; Kang, T.Y.; Lee, H.K.; Hur, T.Y.; Jeong, D.K. Bovine Mastitis: An Asian Perspective. Asian J. Anim. Vet. Adv. 2012, 7, 454–476. [Google Scholar] [CrossRef] [Green Version]
- Sudhan, N.A.; Sharma, N. Mastitis-an Important Production Disease of Dairy Animals. In SMVS Dairy Year Book; SMVS: Ghaziabad, India, 2010; pp. 72–88. [Google Scholar]
- León-Galván, M.F.; Barboza-Corona, J.E.; Lechuga-Arana, A.A.; Valencia-Posadas, M.; Aguayo, D.D.; Cedillo-Pelaez, C.; Martínez-Ortega, E.A.; Gutierrez-Chavez, A.J. Molecular Detection and Sensitivity to Antibiotics and Bacteriocins of Pathogens Isolated from Bovine Mastitis in Family Dairy Herds of Central Mexico. BioMed Res. Int. 2015, 2015, 615153. [Google Scholar] [CrossRef]
- Hogeveen, H.; Huijps, K.; Lam, T.J.G.M. Economic Aspects of Mastitis: New Developments. N. Z. Vet. J. 2011, 59, 16–23. [Google Scholar] [CrossRef]
- Schroeder, J.W. Bovine Mastitis and Milking Management. Drug Ther. 2012, 8, 4. [Google Scholar]
- Dohoo, I.R.; Smith, J.; Andersen, S.; Kelton, D.F.; Godden, S. Mastitis Research Workers’ Conference Diagnosing Intramammary Infections: Evaluation of Definitions Based on a Single Milk Sample. J. Dairy Sci. 2011, 94, 250–261. [Google Scholar] [CrossRef] [Green Version]
- Zimmer, M. A Comparison between the DHIA Test for Somatic Cell Counts Compared to Porta Side Test on the Individual Quarters of the High SCC Cows at the Cal Poly Dairy; California Polytechnic State University: San Luis Obispo, CA, USA, 2010. [Google Scholar]
- Janik, I.A. The Detection and Prediction of Mastitis in Dairy Cows by Particle Analysis. Ph.D. Thesis, Coventry University, Coventry, UK, 2013. [Google Scholar]
- Perrin, G.G.; Mallereau, M.P.; Lenfant, D.; Baudry, C. Relationships between California Mastitis Test (CMT) and Somatic Cell Counts in Dairy Goats. Small Rumin. Res. 1997, 26, 167–170. [Google Scholar] [CrossRef]
- Shitandi, A.; Kihumbu, G. Assessment of the California Mastitis Test Usage in Smallholder Dairy Herds and Risk of Violative Antimicrobial Residues. J. Vet. Sci. 2004, 5, 5–9. [Google Scholar] [CrossRef] [Green Version]
- Schalm, O.W.; Noorlander, D.O. Experiments and Observations Leading to Development of the California Mastitis Test. J. Am. Vet. Med. Assoc. 1957, 130, 199–204. [Google Scholar]
- McDougall, S.; Murdough, P.; Pankey, W.; Delaney, C.; Barlow, J.; Scruton, D. Relationships among Somatic Cell Count, California Mastitis Test, Impedance and Bacteriological Status of Milk in Goats and Sheep in Early Lactation. Small Rumin. Res. 2001, 40, 245–254. [Google Scholar] [CrossRef]
- Viguier, C.; Arora, S.; Gilmartin, N.; Welbeck, K.; O’Kennedy, R. Mastitis Detection: Current Trends and Future Perspectives. Trends Biotechnol. 2009, 27, 486–493. [Google Scholar] [CrossRef]
- Hamann, J.; Krömker, V. Potential of Specific Milk Composition Variables for Cow Health Management. Livest. Prod. Sci. 1997, 48, 201–208. [Google Scholar] [CrossRef]
- Kaur, H. Counterfeit Pharmaceuticals and Methods to Test Them. In Annual Report of the Government Chief Scientific Adviser 2015: Forensic Science and Beyond: Authenticity, Provenance and Assurance Evidence and Case Studies; Walport, M., Ed.; Government Office for Science: London, UK, 2015; pp. 132–137. [Google Scholar]
- Guillemain, A.; Dégardin, K.; Roggo, Y. Performance of NIR Handheld Spectrometers for the Detection of Counterfeit Tablets. Talanta 2017, 165, 632–640. [Google Scholar] [CrossRef]
- Weesepoel, Y.J.A.; van Ruth, S.M. Miniaturized NIRs for Age and Expiration Date Prediction of Packaged Chicken Fillets; Academic: Cambridge, MA, USA, 2016. [Google Scholar]
- Holroyd, S.E. The Use of near Infrared Spectroscopy on Milk and Milk Products. J. Near Infrared Spectrosc. 2013, 21, 311–322. [Google Scholar] [CrossRef]
- Meilina, H.; Kuroki, S.; Jinendra, B.M.; Ikuta, K.; Tsenkova, R. Double Threshold Method for Mastitis Diagnosis Based on NIR Spectra of Raw Milk and Chemometrics. Biosyst. Eng. 2009, 104, 243–249. [Google Scholar] [CrossRef]
- Veleva-Doneva, P.; Draganova, T.; Atanassova, S.; Tsenkova, R. Detection of Bacterial Contamination in Milk Using NIR Spectroscopy and Two Classification Methods—SIMCA and Neuro—Fuzzy Classifier. IFAC Proc. Vol. 2010, 43, 225–229. [Google Scholar] [CrossRef]
- Russell, A. Milk Spectroscopy. Master’s Thesis, The University of Waikato, Hamilton, New Zealand, 2013. [Google Scholar]
- Tsenkova, R.; Atanassova, S.; Ozaki, Y.; Toyoda, K.; Itoh, K. Near-Infrared Spectroscopy for Biomonitoring: Influence of Somatic Cell Count on Cow’s Milk Composition Analysis. Int. Dairy J. 2001, 11, 779–783. [Google Scholar] [CrossRef]
- Wilson, B.K.; Kaur, H.; Allan, E.L.; Lozama, A.; Bell, D. A New Handheld Device for the Detection of Falsified Medicines: Demonstration on Falsified Artemisinin-Based Therapies from the Field. Am. J. Trop. Med. Hyg. 2017, 96, 1117. [Google Scholar] [CrossRef] [Green Version]
- Vanderroost, M.; Ragaert, P.; Verwaeren, J.; De Meulenaer, B.; De Baets, B.; Devlieghere, F. The Digitization of a Food Package’s Life Cycle: Existing and Emerging Computer Systems in the Logistics and Post-Logistics Phase. Comput. Ind. 2017, 87, 15–30. [Google Scholar] [CrossRef]
- Rateni, G.; Dario, P.; Cavallo, F. Smartphone-Based Food Diagnostic Technologies: A Review. Sensors 2017, 17, 1453. [Google Scholar] [CrossRef]
- Aernouts, B.; Polshin, E.; Lammertyn, J.; Saeys, W. Visible and near-Infrared Spectroscopic Analysis of Raw Milk for Cow Health Monitoring: Reflectance or Transmittance? J. Dairy Sci. 2011, 94, 5315–5329. [Google Scholar] [CrossRef] [Green Version]
- Ozcan, A. Mobile Phones Democratize and Cultivate next-Generation Imaging, Diagnostics and Measurement Tools. Lab Chip 2014, 14, 3187–3194. [Google Scholar] [CrossRef]
- Brasil, Y.L.; Cruz-Tirado, J.P.; Barbin, D.F. Fast Online Estimation of Quail Eggs Freshness Using Portable NIR Spectrometer and Machine Learning. Food Control 2022, 131, 108418. [Google Scholar] [CrossRef]
- Cruz-Tirado, J.P.; da Silva Medeiros, M.L.; Barbin, D.F. On-Line Monitoring of Egg Freshness Using a Portable NIR Spectrometer in Tandem with Machine Learning. J. Food Eng. 2021, 306, 110643. [Google Scholar] [CrossRef]
- Wu, X.; Kumar, V.; Quinlan, J.R.; Ghosh, J.; Yang, Q.; Motoda, H.; McLachlan, G.J.; Ng, A.; Liu, B.; Yu, P.S.; et al. Top 10 Algorithms in Data Mining. Knowl. Inf. Syst. 2008, 14, 1–37. [Google Scholar] [CrossRef] [Green Version]
- Goldring, D.; Sharon, D.; Brodetzki, G.; Ruf, A. Withdrawn Patent as Per the Latest Uspto Withdrawn List. US Patent US10704954B2, 7 July 2020. [Google Scholar]
- Quinn, P.J.; Carter, M.E.; Morley, B.; Carter, G.R. Bovine Mastitis and Antibiotic Resistance Patterns in Selalle Smallholder Dairy Farms, Central Ethiopia. Clin. Vet. Microbiol. 1994, 1, 861–868. [Google Scholar] [CrossRef]
- Amer, S.; Gálvez, F.L.A.; Fukuda, Y.; Tada, C.; Jimenez, I.L.; Valle, W.F.M.; Nakai, Y. Prevalence and Etiology of Mastitis in Dairy Cattle in El Oro Province, Ecuador. J. Vet. Med. Sci. 2018, 80, 861–868. [Google Scholar] [CrossRef] [Green Version]
- Mucherino, A.; Papajorgji, P.J.; Pardalos, P.M. Data Mining in Agriculture; Springer Optimization and Its Applications; Springer: New York, NY, USA, 2009; Volume 34, pp. 143–160. ISBN 9780387886145. [Google Scholar]
- Blanco, M.; Villarroya, I. NIR Spectroscopy: A Rapid-Response Analytical Tool. Trends Analyt. Chem. 2002, 21, 240–250. [Google Scholar] [CrossRef]
- Guyon, I.; Gunn, S.; Nikravesh, M.; Zadeh, L.A. Feature Extraction: Foundations and Applications; Studies in Fuzziness and Soft Computing; Springer: Berlin/Heidelberg, Germany, 2008; ISBN 9783540354888. [Google Scholar]
- Chandrashekar, G.; Sahin, F. A Survey on Feature Selection Methods. Comput. Electr. Eng. 2014, 40, 16–28. [Google Scholar] [CrossRef]
- Saeys, Y.; Inza, I.; Larrañaga, P. A Review of Feature Selection Techniques in Bioinformatics. Bioinformatics 2007, 23, 2507–2517. [Google Scholar] [CrossRef] [Green Version]
- Szymańska, E.; Gerretzen, J.; Engel, J.; Geurts, B.; Blanchet, L.; Buydens, L.M.C. Chemometrics and Qualitative Analysis Have a Vibrant Relationship. Trends Analyt. Chem. 2015, 69, 34–51. [Google Scholar] [CrossRef]
- Hall, M.A. Correlation-Based Feature Selection for Machine Learning. Ph.D. Thesis, The University of Waikato, Hamilton, New Zealand, 1999. [Google Scholar]
- Kim, J.; Ko, J.; Choi, H.; Kim, H. Printed Circuit Board Defect Detection Using Deep Learning via A Skip-Connected Convolutional Autoencoder. Sensors 2021, 21, 4968. [Google Scholar] [CrossRef]
- Bishop, C.M. Pattern Recognition and Machine Learning; Springer: Berlin/Heidelberg, Germany, 2006; ISBN 9780387310732. [Google Scholar]
- Mucherino, A.; Ruß, G. Recent Developments in Data Mining and Agriculture. In Proceedings of the Industrial Conference on Data Mining-Workshops, New York, NY, USA, 30 August–3 September 2011; pp. 90–98. [Google Scholar]
- Cawley, G.C.; Talbot, N.L. On over-Fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation. J. Mach. Learn. Res. 2010, 11, 2079–2107. [Google Scholar]
- Fawcett, T. An Introduction to ROC Analysis. Pattern Recognit. Lett. 2006, 27, 861–874. [Google Scholar] [CrossRef]
- Altman, D.G.; Bland, J.M. Diagnostic Tests 2: Predictive Values. BMJ 1994, 309, 102. [Google Scholar] [CrossRef] [Green Version]
- Hastie, T.; Tibshirani, R.; Friedman, J. The Elements of Statistical Learning: Data Mining, Inference, and Prediction, 2nd ed.; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2009; ISBN 9780387848587. [Google Scholar]
- Müller, A.C.; Guido, S. Introduction to Machine Learning with Python: A Guide for Data Scientists; O’Reilly Media, Inc.: Sebastopol, CA, USA, 2016; ISBN 9781449369903. [Google Scholar]
- Ma, X.; Zhang, Y.; Wang, Y. Performance Evaluation of Kernel Functions Based on Grid Search for Support Vector Regression. In Proceedings of the 2015 IEEE 7th International Conference on Cybernetics and Intelligent Systems (CIS) and IEEE Conference on Robotics, Automation and Mechatronics (RAM), Siem Reap, Cambodia, 15–17 July 2015; pp. 283–288. [Google Scholar]
- Rinnan, Å.; van Berg, F.D.; Engelsen, S.B. Review of the Most Common Pre-Processing Techniques for near-Infrared Spectra. Trends Analyt. Chem. 2009, 28, 1201–1222. [Google Scholar] [CrossRef]
- dos Santos, C.A.T.; Lopo, M.; Páscoa, R.N.M.J.; Lopes, J.A. A Review on the Applications of Portable near-Infrared Spectrometers in the Agro-Food Industry. Appl. Spectrosc. 2013, 67, 1215–1233. [Google Scholar] [CrossRef]
- Xu, L.; Zhou, Y.-P.; Tang, L.-J.; Wu, H.-L.; Jiang, J.-H.; Shen, G.-L.; Yu, R.-Q. Ensemble Preprocessing of near-Infrared (NIR) Spectra for Multivariate Calibration. Anal. Chim. Acta 2008, 616, 138–143. [Google Scholar] [CrossRef]
- Martelo-Vidal, M.J.; Vázquez, M. Evaluation of Ultraviolet, Visible, and near Infrared Spectroscopy for the Analysis of Wine Compounds. Czech J. Food Sci. 2014, 32, 37. [Google Scholar] [CrossRef] [Green Version]
- Xie, L.; He, X.; Duan, B.; Tang, S.; Luo, J.; Jiao, G.; Shao, G.; Wei, X.; Sheng, Z.; Hu, P. Optimization of Near-Infrared Reflectance Model in Measuring Gelatinization Characteristics of Rice Flour with a Rapid Viscosity Analyzer (RVA) and Differential Scanning Calorimeter (DSC). Cereal Chem. 2015, 92, 522–528. [Google Scholar] [CrossRef]
- Hadad, G.M.; Ra, A.S.; Elkhoudarya, M.M. Simultaneous Determination of Clarithromycin, Tinidazole and Omeprazole in Helicure Tablets Using Reflectance Near-Infrared Spectroscopy with the Aid of Chemometry. Pharm. Anal. Acta 2015, 2015. [Google Scholar] [CrossRef] [Green Version]
- Ramírez-Morales, I.; Rivero, D.; Fernández-Blanco, E.; Pazos, A. Optimization of NIR Calibration Models for Multiple Processes in the Sugar Industry. Chemom. Intellig. Lab. Syst. 2016, 159, 45–57. [Google Scholar] [CrossRef]
- Luypaert, J.; Heuerding, S.; de Jong, S.; Massart, D.L. An Evaluation of Direct Orthogonal Signal Correction and Other Preprocessing Methods for the Classification of Clinical Study Lots of a Dermatological Cream. J. Pharm. Biomed. Anal. 2002, 30, 453–466. [Google Scholar] [CrossRef]
- Savitzky, A.; Golay, M.J.E. Smoothing and Differentiation of Data by Simplified Least Squares Procedures. Anal. Chem. 1964, 36, 1627–1639. [Google Scholar] [CrossRef]
- Barnes, R.J.; Dhanoa, M.S.; Lister, S.J. Standard Normal Variate Transformation and De-Trending of Near-Infrared Diffuse Reflectance Spectra. Appl. Spectrosc. 1989, 43, 772–777. [Google Scholar] [CrossRef]
- Jaeger, S.; Virchow, F.; Torgerson, P.R.; Bischoff, M.; Biner, B.; Hartnack, S.; Rüegg, S.R. Test Characteristics of Milk Amyloid A ELISA, Somatic Cell Count, and Bacteriological Culture for Detection of Intramammary Pathogens That Cause Subclinical Mastitis. J. Dairy Sci. 2017, 100, 7419–7426. [Google Scholar] [CrossRef] [Green Version]
- Ramirez-Morales, I. NIR Spectral Signal of Healthy and Mastitic Milk Samples. Mendeley Data 2021, 1. [Google Scholar] [CrossRef]
CMT | Interpretation | Class | Number of Samples |
---|---|---|---|
0 | Negative | Negative | 130 |
+ | Trace | Weak Positive | 57 |
++ | Weak positive | ||
+++ | Distinctive positive | Strong Positive | 23 |
++++ | Strong positive |
Performance Metric | Model 1: Positive—Negative | Model 2: Clinical—Subclinical |
---|---|---|
Accuracy | = 0.912 σ = 0.051 | = 0.951 σ = 0.08 |
Sensitivity | = 0.858 σ = 0.129 | = 0.95 σ = 0.158 |
Specificity | = 0.94 σ = 0.064 | = 0.957 σ = 0.096 |
Positive Predictive Value | = 0.89 σ = 0.11 | = 0.917 σ = 0.18 |
Negative Predictive Value | = 0.925 σ = 0.072 | = 0.978 σ = 0.07 |
F1 Score | = 0.867 σ = 0.089 | = 0.913 σ = 0.144 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Ramirez-Morales, I.; Aguilar, L.; Fernandez-Blanco, E.; Rivero, D.; Perez, J.; Pazos, A. Detection of Bovine Mastitis in Raw Milk, Using a Low-Cost NIR Spectrometer and k-NN Algorithm. Appl. Sci. 2021, 11, 10751. https://doi.org/10.3390/app112210751
Ramirez-Morales I, Aguilar L, Fernandez-Blanco E, Rivero D, Perez J, Pazos A. Detection of Bovine Mastitis in Raw Milk, Using a Low-Cost NIR Spectrometer and k-NN Algorithm. Applied Sciences. 2021; 11(22):10751. https://doi.org/10.3390/app112210751
Chicago/Turabian StyleRamirez-Morales, Ivan, Lenin Aguilar, Enrique Fernandez-Blanco, Daniel Rivero, Jhonny Perez, and Alejandro Pazos. 2021. "Detection of Bovine Mastitis in Raw Milk, Using a Low-Cost NIR Spectrometer and k-NN Algorithm" Applied Sciences 11, no. 22: 10751. https://doi.org/10.3390/app112210751
APA StyleRamirez-Morales, I., Aguilar, L., Fernandez-Blanco, E., Rivero, D., Perez, J., & Pazos, A. (2021). Detection of Bovine Mastitis in Raw Milk, Using a Low-Cost NIR Spectrometer and k-NN Algorithm. Applied Sciences, 11(22), 10751. https://doi.org/10.3390/app112210751