<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>AI-Informed Development for a Lactate Measurement Tool</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Cian Kiely</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Nicola Rossberg</string-name>
          <email>n.rossberg@cs.ucc.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Shree Krishnamoorthy</string-name>
          <email>shree.krishnamoorthy@gmail.com</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrea Visentin</string-name>
          <email>andrea.visentin@ucc.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>SFI Center for Research Training in Artificial Intelligence, University College Cork</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>SFI Insight Centre for Data Analytics, University College Cork</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>School of Computer Science &amp; IT, University College Cork</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Lactate has been identified as a key biomarker, with spikes co-occurring with high-risk medical conditions including sepsis and hypoxia. Despite its high medical value, current methods of Lactate measurement require repeated blood sampling from the patient, which is both costly and invasive, and consequently tends to be limited to intensive care units. Spectroscopy, a non-invasive light-based system, presents a cost-efective alternative to these traditional methods, which permits continuous measurement and improved patient monitoring. Through the use of machine learning, spectroscopic measurements can be used to estimate blood Lactate levels in an accessible and low-cost manner. In this study, machine learning models were trained on Near-infrared (NIR) spectroscopy data, to identify the best set-up for high-precision estimation of Lactate levels. The results of the analysis are used to determine the best path length for spectroscopic measurements. Feature selection is implemented to establish the most important wavelengths for prediction and inform on the most relevant spectral regions for the given task. Explainability is implemented to analyse feature contributions and allow inference of potentially interfering components that should be considered for further testing. The results showed that by using a random forest, R2 values of 0.9986 can be achieved. Feature selection increased predictive performance considerably with R2 values as high as 0.9996 and the implementation of explainability allowed the identification of important wavelength ranges.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Lactate Measurement</kwd>
        <kwd>Artificial Intelligence</kwd>
        <kwd>Explainability</kwd>
        <kwd>Chemometrics</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Lactate has been identified as an important marker of patient health and can function as a proxy alarm
system for various severe health conditions including sepsis [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Lactate is produced during a process
called ’Glycolysis’, where glucose is broken down into Lactate or pyruvate and the energy released
during this process is used to create high-energy molecules such as ATP [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. As the key metabolite
of the anaerobic pathway, Lactate is produced when aerobic respiration cannot meet tissues’ energy
demands. If Lactate is not adequately cleared due to illness or overproduction, lactic acidosis occurs,
which has been identified as a precipitator to severe health complications. The current clinical method
of measuring blood Lactate levels involves intermittent blood sampling using an arterial blood gas
analyzer (ABG), which requires arterial blood samples [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ]. This method is usually restricted to
use in intensive care units due to cost and high invasiveness. Consequentially, there is a need for an
alternative method of monitoring Lactate levels in a hospital setting. Spectroscopy ofers two key
advantages over the traditional approach. First, spectroscopic measurements are comparatively cheaper,
hence easing measurement and potentially allowing for more widespread implementation. Second,
spectroscopic measurements are non-invasive and can therefore be implemented without additional
blood samples, reducing patient burden. As such, spectroscopy may ofer a feasible alternative to the
traditional methods of estimating lactate concentrations.
      </p>
      <p>
        In this study, these advantages of spectroscopy are leveraged to design a machine learning system
that allows the prediction of Lactate levels through NIR spectroscopy. In previous works, machine
learning was used as a post-hoc approach for the classification of spectroscopic signals [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. This study
now aims to use machine learning methodologies to inform the experimental design and measurement
of spectroscopic signals and hence increase the predictive power of these models through intervention
at the data collection stage. Three machine learning models are implemented to identify the best path
length for predicting Lactate across a wide range of concentrations. Feature selection is conducted to
identify important wavelength ranges and allow the reduction of the number of recorded signals. This
feature selection enables the removal of redundancy in highly correlated data, increasing processing
times and algorithm eficiency. After feature selection, SHapley Additive exPlanations (SHAP)[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
is used to analyse the contributions of each feature to the prediction of the outcome, allowing the
identification of important features. This is advantageous, as certain wavelengths can be linked to
biological components and by identifying which wavelengths lead to a given prediction, further testing
for interfering components can be informed. Through these analyses, the best design and setup for
spectral measurements and prediction of Lactate can be identified.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Literature Review</title>
      <p>This literature review will first discuss the importance of Lactate as a biomarker for adult and infant
health. It will then review current approaches to Lactate measurement and previous spectroscopic
applications for Lactate measurement.</p>
      <sec id="sec-2-1">
        <title>2.1. Lactate as Biomarker</title>
        <p>
          Lactate has been identified as a key indicator of patient health in a series of medical conditions. While
resting Lactate levels in healthy individuals vary between 1 and 2 mmol/L, increased resting levels
are indicative of a wide range of serious health complications including hypoxia, sepsis, diabetes and
toxin-related conditions [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. Several previous studies have examined the predictive power of Lactate
levels on patient development. A meta-analysis by Zhang and Xu [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] found that Lactate clearance
was predictive of all-cause mortality in critically ill patients, with higher Lactate clearance predicting
improved health outcomes. A second study by Mokline et al. [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] emphasised that plasma Lactate can
function as a powerful predictive indicator of sepsis and mortality in patients sufering from burn
wounds. However, while the importance of Lactate level monitoring as a marker for patient health
and development has been established, the implementation of continuous monitoring in a hospital
setting remains challenging. Traditionally, patient Lactate levels are established via blood samples. The
problem with this methodology is the invasiveness and high cost of taking measurements. Additionally,
this method does not lend itself to continuous measurement of Lactate levels. As such, alternative
methods of establishing Lactate levels are desired for improved health monitoring.
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Current Methods of Measuring Lactate</title>
        <p>
          Several new methodologies have been proposed to allow the continuous measurement of Lactate
levels. A comprehensive overview of the diferent approaches to Lactate monitoring can be found
in Lafuente et al. [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]. Below two examples of such methods are reviewed and their advantages and
shortcomings are detailed. Sughimoto et al. [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] designed a machine learning model to predict Lactate
levels continuously between blood draws, using previous Lactate levels in combination with other
diagnostic details. While this model allows for less frequent measurement and continuous estimation of
Lactate levels, it does not account for ’black swan events’, where Lactate levels may spike unexpectedly
due to rapid, unexpected, negative developments in the patient’s health. Ming et al. [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] proposed a
method in which a microneedle patch could be worn for continuous Lactate measurement in a
nonclinical context. The findings of the study were encouraging, with continuous measurements being
successfully taken from the patch. However, the use of venous Lactate levels can only be used in place
of arterial Lactate levels accurately below 2 mmol/l, hence making it unsuitable for clinical settings
where patients with critical illness may exceed this level [12].
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Spectroscopy for Lactate Measurement</title>
        <p>
          An alternative approach to the measurement of Lactate levels is through the use of spectroscopy. Here,
light signals are used to infer Lactate levels, hence providing the opportunity for continuous non-invasive
estimation based on a series of Lactate-correlates. Previous studies have employed Raman spectroscopy
for the quantification of Lactate levels [ 13, 14, 15]. Raman spectroscopy involves illuminating a sample
with a laser and analyzing the wavelength shifts in the scattered light. These shifts occur due to
interactions with molecular vibrations within the sample, providing a ”fingerprint” that can identify
specific molecular structures. However, these results are limited to in-vitro and ex-vivo measurements,
with in-vivo implementation remaining challenging. A diferent approach is through the use of NIR. NIR
is an absorption spectroscopy method which records which parts of the light are transmitted through a
sample. Two previous studies employing NIR for Lactate measurement were conducted by Budidha et al.
[
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] and Mamouei et al. [16]. The work by Budidha et al. [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] emphasised that the deep penetration of
human tissue possible through NIR, as well as its high predictive values in in-vitro samples, recommends
NIR for the continuous measurement of Lactate in an in-vivo setting. Furthermore Mamouei et al. [16]
emphasises that NIR, in combination with Mid-Infrared visible and Ultraviolet optical spectroscopy has
the potential to measure Lactate, albeit only indirectly for the in-vivo setting.
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology</title>
      <p>This section first describes the problem at hand and then details the datasets and the necessary
preprocessing. The machine learning employed models, explainability methods and performance metrics
are then introduced. For the sake of reproducibility, the code has been made available1.</p>
      <sec id="sec-3-1">
        <title>3.1. Problem description</title>
        <p>The goal of this study is to identify the optimal path length measurement to use for measuring Lactate
concentration using NIR spectroscopy. Path length refers to the distance light travels through the sample
inside a cuvette. As light absorbance varies with the concentration of a compound, the ideal path length
depends on the compound’s concentration. The relationship between absorbance and concentration
is quantified by the Beer-Lambert law, where absorbance is calculated as the product of the molar
absorbance of the sample, the concentration of the sample, and the path length [17]. If concentration
becomes excessively large or small, the linearity of its relationship with absorbance is afected. Path
length choice can rectify this, with shorter path lengths restoring linearity at higher concentrations and
vice versa. The diference in the average response depending on path length can be seen in Figure 1.
This demonstrates the importance of this choice, as the absorbance patterns vary considerably between
path lengths. This study tests which path lengths are best suited for the estimation of Lactate at varying
concentrations.</p>
        <p>The dataset employed for this study contains the results of 1195 samples with varying concentrations
of Lactate in a phosphate-bufered saline (PBS) solution, with the cuvette thickness as a variable
quantifying path length. The three cuvette measures were 2 mm, 5 mm and 10 mm. Four diferent
Lactate concentrations were measured at all path lengths alongside a clear PBS solution to use as a
baseline reference. The four concentrations are 1.3 mmol/l, 13 mmol/l, 130 mmol/l and 1300 mmol/l.
The spectra of the samples are measured across 350 wavelengths within the NIR range from 1014.08
nm to 2580.07 nm. To normalise the spectra, the baseline reflectance of the PBS solution is subtracted
from all spectra to account for its absorption index. After pre-processing, the dataset is divided by path
length and going forward, the respective subsets will be referred to as ’Path Length 2’, ’Path Length 5’,
1https://github.com/CianK99/Lactate-Detection
and ’Path Length 10’. Undersampling is implemented to account for data imbalance with respect to
path length and concentration. After undersampling, a total of 1047 samples are retained.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Machine Learning Models</title>
        <p>The machine learning models chosen for this project were Partial Least Squares (PLS), Least Absolute
Shrinkage and Selection Operator (LASSO) and Random Forest (RF). Each will be described in turn
below.</p>
        <p>Partial Least Squares (PLS): PLS is a statistical method designed to model complex relationships
by extracting latent structures from the data. It is particularly useful when predictors are highly
collinear or when the number of predictors exceeds the number of observations, both of which are
common problems with spectroscopic data. PLS creates latent variables as linear combinations of the
original predictors and responses, aiming to maximise the covariance between these new variables
while minimising the residual variance in the responses[18].</p>
        <p>The basic form of the PLS model is:</p>
        <p>X = TPT + E,</p>
        <p>Y = UQT + F
Here, X represents the matrix of predictors and Y represents the matrix of responses. The matrices
T and U contain the latent scores extracted from X and Y, respectively. P and Q are matrices of
loadings, which represent how the original variables relate to the latent components. E and F are
residual matrices capturing the variability not explained by the model. PLS iteratively extracts latent
variables from X and Y to optimise the shared variance. Once a latent component is extracted, the
matrices X and Y are deflated to remove the explained variance. Finally, the response matrix Y is
modelled as a linear combination of the latent variables:</p>
        <p>Y = TC + F
where C is a matrix of regression coeficients for the latent variables. PLS is particularly suited for
handling high-dimensional data, small sample sizes, and datasets with multicollinear predictors. The
optimisation of shared variance between predictors and responses ensures the model is both predictive
and interpretable.</p>
        <p>Least Absolute Shrinkage and Selection Operator (LASSO): LASSO regression is a type of linear
regression that includes a regularisation component. LASSO regression aims to enhance the prediction
performance and interpretability of the regression model by performing both variable selection and
regularisation. The formula for LASSO is given by:</p>
        <p>
minimise  1
 2n</p>
        <p>n
X(yi − β 0 −
i=1</p>
        <p>p
X β j xij )2 + λ
j=1</p>
        <p>p
X |β j |
j=1



Here, the model aims to minimise the residual sum of squares subject to a penalty proportional to the
absolute sum of the coeficients. The parameter λ controls the strength of the penalty; higher values lead
to greater regularisation. This penalty term encourages the solution to have fewer non-zero coeficients,
efectively conducting variable selection and promoting model simplicity and interpretability. This
feature reduction is important as not all bands of light are needed for the detection of Lactate[19].</p>
        <p>Random Forest (RF): RF is an ensemble model that enhances the performance of decision trees
by combining multiple trees constructed from randomly selected subsets of data and features. Each
tree in the forest operates independently, and their outputs are aggregated via averaging for regression
and majority voting for classification to produce the final model prediction. This method improves
generalisation and precision over individual decision trees and ofers robust predictions and better
handling of overfitting.</p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Evaluation</title>
        <p>The evaluation metrics used to compare models and classifiers in this project are R-squared (R2),
Mean Absolute Error (MAE), and Root Mean Squared Error (RMSE). For all metric evaluations, k-fold
cross-validation is utilised, ensuring that every observation from the original dataset can appear in both
the training and the test set. This method computes the model performance and aids in understanding
model reliability and robustness across diferent subsets of data. For all the experiments in this project,
10 folds were used.</p>
      </sec>
      <sec id="sec-3-4">
        <title>3.4. Explainability</title>
        <p>Explainable Machine Learning (xAI) is essential in medical applications to ensure transparency and
trust. Previous studies have shown that implementing explainability can increase practitioner trust
and decrease model bias [20]. Furthermore, with the introduction of the EU AI Act, the
implementation of explainability in the medical domain is a legal requirement to ensure system auditability and
consequential accountability [21].</p>
        <p>For explainability in this study, feature importance in the RF model using the Mean Decrease in
Impurity (MDI) method was computed. The RF model is chosen for further analysis due to its strong
predictive performance during initial testing on the whole dataset as seen in Section 4.1. This method
assesses each feature’s importance based on how much it reduces Gini impurity at each split in the
decision trees. This reduction is summed across all trees and normalised to provide an overall importance
score, with greater reductions in Gini Impurity leading to higher feature importance.</p>
        <sec id="sec-3-4-1">
          <title>Feature Selection</title>
          <p>Reducing the feature space through feature selection yields several advantages for spectroscopic data.
First, it eases explainability as the high dimensionality and multicollinearity of data are decreased
after feature selection. Second, the identification of important features becomes more straightforward,
allowing the identification of links to underlying tissue components. Finally, the runtime and complexity
of models may improve in a reduced feature space, allowing for faster data processing and improved
medical implementation of developed algorithms. In this study, feature selection was implemented based
on the feature importance scores computed by the random forest. Models were pruned by iteratively
removing the least important features and recalculating importance after each reduction. The method
involves removing the bottom 20% of features at each iteration up until it reaches the top 20 features,
and from this point, one feature is removed at a time.</p>
        </sec>
        <sec id="sec-3-4-2">
          <title>SHAP Analysis</title>
          <p>To explain model prediction mechanisms and increase the auditability of the designed system,
explainability is implemented through the use of SHAP. SHAP is a method for explaining the predictions of
machine learning models based on concepts from cooperative game theory. It attributes the output of a
model to its input features. SHAP values are additive, meaning the contributions of all features sum up
to the diference between the average output and the actual prediction. This approach provides insights
into how each feature influences the prediction, ofering a powerful tool for understanding complex
models. In the current study, this allows the identification of interfering features and the identification
of candidate components for further testing can be identified.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Experimental Results</title>
      <p>This section details the processes and results of this study’s modelling. It first presents the results of
initial testing on the full wavelength ranges in Section 4.1. The results of the feature selection, based
on the best-performing model, are presented in Section 4.2 and a novel approach to creating a general
wavelength range on their basis is presented in Section 4.3. Finally, the outcomes of the explainability
analysis are presented in Section 4.4.</p>
      <sec id="sec-4-1">
        <title>4.1. Initial Testing</title>
        <p>Initial testing involved creating models on the full feature set for All Path Lengths, Path Length 2, Path
Length 5 and Path Length 10. The initial prediction results of the implemented models are shown in
Table 1. RF is found to perform the best on the All Path Lengths, Path Length 5 and Path Length 10
datasets, and is outperformed by LASSO and PLS in the Path Length 2 dataset.</p>
        <p>Based on the initial testing results RF is identified as the best-performing model and selected for
feature selection and additional testing. This selection is conducted on the basis of RF having the
overall best performance as well as the most potential for improvement by feature selection. Feature
selection is integrated into LASSO through L1 regularisation, efectively shrinking less important
feature coeficients to zero, and in PLS through the calculation of latent variables. These built-in feature
reductions limit the capacity of PLS and LASSO for further enhancement, as they have already optimised
the feature space during training. As a result, RF holds more promise for iterative optimization and
refinement and is used for all further testing in this paper.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Modelling on Reduced Feature Sets</title>
        <p>To explore model performance in a reduced feature set, feature selection is implemented based on the
RF model and following the methodology specified in Section 3. At each stage of reduction, the train
and test R2, RMSE and MAE values are calculated. The set of features resulting in the highest test R2
for each path-length dataset individually was selected and is referred to as the optimum feature set. As
seen in Figure 2, the R2 for the training set remains relatively high throughout the selection process,
only decreasing when 3 or fewer features are maintained, which is likely a result of general overfitting
in the training data. The testing R2 is found to perform best when retaining 14 features, which was
chosen as the final number. The optimum number of features for Path Length 2, Path Length 5 and
Path Length 10 were 12, 14, and 26 features respectively. In Figure 3 the most important features of
each of the path length datasets are plotted against the average response of all the samples. It is clear
from this graph that the features most predictive of each respective path length dataset are distinctive,
with some minor overlap between Path Length 10 and Path Length 5 between 1300 - 1400 nm. This also
displays a high degree of clustering between the most important features. This gives promise to a more
specified tool being possible.</p>
        <p>The prediction results after feature selection are shown in Table 2. Performance increases considerably
in the reduced feature set. Interestingly, Path Length 5 now surpasses the performance of Path Length
10 in all metrics. It is worth acknowledging these R2 values are very high in all cases. While these
highperformance values are encouraging and suggest a good fit for the data, they may be influenced by the
lack of distinct Lactate levels in the dataset. This could result in an overestimation of model performance,
as the model may be capturing patterns specific to the available data rather than generalising efectively
to broader, more varied Lactate concentrations.</p>
        <p>To investigate the concentrations of Lactate at which the model predicts with the least error, RMSE
was computed for each concentration level. Table 3 presents the RMSE results for each concentration
when using the optimal feature sets. Path Length 5 demonstrates the best performance across all
concentrations, except at 1.3 mmol/l, where Path Length 10 outperforms it. It is important to note that
the RMSE scores at zero concentration are poor for all path lengths. However, Lactate levels of zero are
an artificial laboratory condition and do not reflect real-world scenarios, rendering this issue negligible.
Additionally, while Path Length 5 performs best across the majority of the dataset, its lower performance
at 1.3 mmol/l should be carefully considered, as this range is the most biologically significant for Lactate
and should be prioritised in a medical context [22].</p>
      </sec>
      <sec id="sec-4-3">
        <title>4.3. Evaluating a General Wavelength Range</title>
        <p>As the feature wavelengths used in the dataset are discrete and specific, a method to generalise this
range for reproducibility and further experimentation was designed. By binning the wavelengths
selected during feature selection, relevant sections of the spectrum can be identified and the size of
the instruments needed for data collection could be reduced. The proposed approach takes the list of
optimal features and defines a range around each identified feature. Preliminary testing determined
that grouping wavelengths within a 15 nm window produced the best results. Any wavelengths
within a 15nm window of each other were consolidated into the same range. A centre for each range
was identified by computing the interpolated average of the wavelengths weighted by their feature
importance. This means that if one of the edge wavelengths were most important for a defined range,
the centre would be pulled closer to this important wavelength. These ranges and centres can be seen
in Table 4. The new feature counts are presented alongside the new wavelength ranges.</p>
        <p>When testing the RF model on these new feature ranges, the results presented in Table 5 are achieved.
Path Length 5 and Path Length 10 perform better using the generalised range, with Path Length 2
performing marginally worse when compared to the results in Table 2. These ranges are more useful to
inform the specifications of a tool than the wavelengths in the data. Using these feature ranges, the
evaluation of RMSE by concentration yields a similar pattern to that observed with the optimal feature
sets above. Specifically, Path Length 10 performs best at 1.3 mmol/l and Path Length 5 performs best for
the others.</p>
      </sec>
      <sec id="sec-4-4">
        <title>4.4. Implementing Explainability</title>
        <p>As Path Length 5 has been found to perform best across the majority of Lactate concentrations, it was
selected for further analysis. SHAP is used to analyse the feature usage of the Path Length 5 model to
investigate the individual feature contributions to the prediction of the model. SHAP visualisations
allow for easy identification of where mistakes occur in the model.</p>
        <p>SHAP Beeswarm Plot Figure 4 shows the generated SHAP beeswarm plot with the most to least
important wavelengths of the model being shown from top to bottom. The x-axis shows the degree
to which a feature supports a prediction, with points left of the origin decreasing the prediction and
vice versa. The colour range from blue to red shows the importance of the feature with red features
contributing more. Most of the features have a positive relationship with the Lactate concentration,
increasing the predicted value of Lactate. One exception is 1695.05, which tends to increase the prediction
when its value is low. This implies that this wavelength difers from the remaining features included in
the analysis. This is in keeping with expectations as all remaining wavelengths fall within 100 nm of
each other (1278.72 nm - 1371.99 nm) and are likely modelling the same interaction in the data. As such
it is reasonable to assume that the relative distance of the 1695.05 nm feature leads to its contrasting
efect on the prediction.</p>
        <p>SHAP Waterfall Plot Individual instances of both correct and incorrect predictions were further
analysed to understand the cause of the mispredictions identified in the stacked force plot. An example
of a correct and incorrect prediction, respectively, for a 1.3 mmol/l sample can be seen in Figures 5a
and 5b. Figure 5a shows the correct prediction with all features detracting from the mean prediction of
409.616mmol/1. Figure 5b shows how the feature contributions difer for an incorrect prediction. It is
clear from the plot that the influential feature is 1371.99 as this is the only feature difering from Figure
5a. This is a prime example of the importance of explainability as it permits the auditing of the system
and the successful identification of potentially problematic features.</p>
        <p>(a) A SHAP waterfall plot of a correct prediction.</p>
        <p>(b) A SHAP waterfall plot of an incorrect prediction
identified from the stacked force plot.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>This study aimed to inform the design of a tool to measure blood Lactate levels non-invasively using
NIR spectroscopy via machine learning. Through analysis of achieved prediction results, the best choice
of path length for NIR measurements was identified. Feature selection was implemented to establish
the best wavelengths and a general wavelength range was computed. Finally, through explainability
analysis, components interfering at given wavelengths can be identified and further testing for these
compounds can be implemented accordingly. With RF, a 10 mm path length was found to perform
best in the biologically relevant ranges of Lactate, whereas Path Length 5 performed best on average.
Feature selection conducted based on the feature importance computed by the Random Forest model
allowed for considerable improvement in algorithm performance. Explainability was implemented to
audit the system and allowed the identification of important and potentially problematic features. In
conclusion, this study demonstrates the ability of ML models to successfully estimate Lactate levels
based on spectroscopic measurements and identify the best laboratory setup for such measurement. This
contributes to the ongoing efort to establish non-invasive methods for the continuous measurements
of Lactate in a hospital setting.</p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgments</title>
      <p>This work was conducted with the financial support of Science Foundation Ireland under Grant Nos.
12/RC/2289-P2 and 18/CRT/6223 which are co-funded under the European Regional Development
Fund. This research was partially supported by the EU’s Horizon Digital, Industry, and Space program
under grant agreement ID 101092989-DATAMITE. For the purpose of Open Access, the author has
applied a CC BY public copyright license to any Author Accepted Manuscript version arising from this
submission.
D. O’Hare, A. H. Holmes, Real-time continuous measurement of lactate through a minimally
invasive microneedle patch: a phase i clinical study, BMJ Innovations 8 (2022).
[12] S. A. Samaraweera, B. Gibbons, A. Gour, P. Sedgwick, Arterial versus venous lactate: a measure of
sepsis in children, European Journal of Pediatrics 176 (2017) 1055–1060.
[13] I. Olaetxea, E. Lopez, A. Valero, A. Seifert, Determination of physiological lactate and pH by
Raman spectroscopy, in: 2019 41st Annual International Conference of the IEEE Engineering in
Medicine and Biology Society (EMBC), 2019, pp. 475–481. Journal Abbreviation: 2019 41st Annual
International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC).
[14] I. Olaetxea, A. Valero, E. Lopez, H. Lafuente, A. Izeta, I. Jaunarena, A. Seifert, Machine
LearningAssisted Raman Spectroscopy for pH and Lactate Sensing in Body Fluids, Analytical Chemistry 92
(2020) 13888–13895. Publisher: American Chemical Society.
[15] N. C. Shah, O. Lyandres, J. T. Walsh, M. R. Glucksberg, R. P. Van Duyne, Lactate and Sequential
LactateGlucose Sensing Using Surface-Enhanced Raman Spectroscopy, Analytical Chemistry 79
(2007) 6927–6932. Publisher: American Chemical Society.
[16] M. Mamouei, K. Budidha, N. Baishya, M. Qassem, P. A. Kyriacou, An empirical investigation of
deviations from the Beer–Lambert law in optical estimation of lactate, Scientific Reports 11 (2021)
13734.
[17] D. F. Swinehart, The Beer-Lambert Law, Journal of Chemical Education 39 (1962) 333. Publisher:</p>
      <p>American Chemical Society.
[18] S. Wold, M. Sjöström, L. Eriksson, PLS-regression: a basic tool of chemometrics, Chemometrics
and Intelligent Laboratory Systems 58 (2001) 109–130.
[19] D. Lafrance, L. C. Lands, D. H. Burns, In vivo lactate measurement in human tissue by near-infrared
difuse reflectance spectroscopy, The Second International Symposium on Two-dimensional
Correlation Spectroscopy (2DCOS-II), University of Nottingham, UK, 21-23 August, 2003 36 (2004)
195–202.
[20] K. Rasheed, A. Qayyum, M. Ghaly, A. Al-Fuqaha, A. Razi, J. Qadir, Explainable, trustworthy, and
ethical machine learning for healthcare: A survey, Computers in Biology and Medicine (2022)
106043.
[21] L. Edwards, The EU AI Act: a summary of its significance and scope, Artificial Intelligence (the</p>
      <p>EU AI Act) 1 (2021).
[22] D. Marikar, P. Babu, M. Fine-Goulden, How to interpret lactate, Archives of Disease in Childhood
- Education and Practice 106 (2021) 167–171. Publisher: Royal College of Paediatrics and Child
Health Section: Interpretations.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>K.</given-names>
            <surname>Rathee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Dhull</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Dhull</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <article-title>Biosensors based on electrochemical lactate detection: A comprehensive review</article-title>
          ,
          <source>Biochemistry and biophysics reports 5</source>
          (
          <year>2016</year>
          )
          <fpage>35</fpage>
          -
          <lpage>54</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>K. O.</given-names>
            <surname>Alfarouk</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Verduzco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Rauch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. K.</given-names>
            <surname>Muddathir</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. B.</given-names>
            <surname>Adil</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. O.</given-names>
            <surname>Elhassan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. E.</given-names>
            <surname>Ibrahim</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. D. P.</given-names>
            <surname>Orozco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. A.</given-names>
            <surname>Cardone</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. J.</given-names>
            <surname>Reshkin</surname>
          </string-name>
          , et al.,
          <article-title>Glycolysis, tumor metabolism, cancer growth and dissemination. a new ph-based etiopathogenic perspective and therapeutic approach to an old cancer question</article-title>
          ,
          <source>Oncoscience</source>
          <volume>1</volume>
          (
          <year>2014</year>
          )
          <fpage>777</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>K.</given-names>
            <surname>Budidha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mamouei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Baishya</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Qassem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Vadgama</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. A.</given-names>
            <surname>Kyriacou</surname>
          </string-name>
          ,
          <article-title>Identification and quantitative determination of lactate using optical spectroscopy-towards a noninvasive tool for early recognition of sepsis</article-title>
          ,
          <source>Sensors</source>
          <volume>20</volume>
          (
          <year>2020</year>
          )
          <fpage>5402</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Mamouei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Budidha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Baishya</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Qassem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Kyriacou</surname>
          </string-name>
          ,
          <article-title>Comparison of wavelength selection methods for in-vitro estimation of lactate: a new unconstrained, genetic algorithm-based wavelength selection</article-title>
          ,
          <source>Scientific Reports</source>
          <volume>10</volume>
          (
          <year>2020</year>
          )
          <fpage>16905</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J.-L.</given-names>
            <surname>Lafuente</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>González</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Aibar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Rivera</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Avilés</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.-J.</given-names>
            <surname>Beunza</surname>
          </string-name>
          ,
          <article-title>Continuous and non-invasive lactate monitoring techniques in critical care patients</article-title>
          ,
          <source>Biosensors</source>
          <volume>14</volume>
          (
          <year>2024</year>
          )
          <fpage>148</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S. M.</given-names>
            <surname>Lundberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.-I.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <surname>A Unified</surname>
          </string-name>
          <article-title>Approach to Interpreting Model Predictions</article-title>
          , in: I. Guyon,
          <string-name>
            <given-names>U. V.</given-names>
            <surname>Luxburg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Bengio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wallach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Fergus</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Vishwanathan</surname>
          </string-name>
          , R. Garnett (Eds.),
          <source>Advances in Neural Information Processing Systems</source>
          , volume
          <volume>30</volume>
          ,
          <string-name>
            <surname>Curran</surname>
            <given-names>Associates</given-names>
          </string-name>
          , Inc.,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A.</given-names>
            <surname>Poscia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Messeri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Moscone</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Valgimigli</surname>
          </string-name>
          ,
          <article-title>A novel continuous subcutaneous lactate monitoring system</article-title>
          ,
          <source>Biosensors and bioelectronics 20</source>
          (
          <year>2005</year>
          )
          <fpage>2244</fpage>
          -
          <lpage>2250</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Xu</surname>
          </string-name>
          ,
          <article-title>Lactate clearance is a useful biomarker for the prediction of all-cause mortality in critically ill patients: a systematic review and meta-analysis</article-title>
          ,
          <source>Critical care medicine 42</source>
          (
          <year>2014</year>
          )
          <fpage>2118</fpage>
          -
          <lpage>2125</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Mokline</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abdenneji</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Rahmani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Gharsallah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Tlaili</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            <surname>Harzallah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Gasri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Hamouda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Messadi</surname>
          </string-name>
          ,
          <article-title>Lactate: prognostic biomarker in severely burned patients</article-title>
          ,
          <source>Annals of burns and fire disasters 30</source>
          (
          <year>2017</year>
          )
          <fpage>35</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>K.</given-names>
            <surname>Sughimoto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Levman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Baig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Berger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Oshima</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Kurosawa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Aoki</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Seino</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Ueda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Liu</surname>
          </string-name>
          , et al.,
          <article-title>Machine learning predicts blood lactate levels in children after cardiac surgery in paediatric icu</article-title>
          ,
          <source>Cardiology in the Young</source>
          <volume>33</volume>
          (
          <year>2023</year>
          )
          <fpage>388</fpage>
          -
          <lpage>395</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>D. K.</given-names>
            <surname>Ming</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Jangam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. A.</given-names>
            <surname>Gowers</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Wilson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. M.</given-names>
            <surname>Freeman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Boutelle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. E.</given-names>
            <surname>Cass</surname>
          </string-name>
          ,
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>