Machine learning for optical chemical multi-analyte imaging
간접 관련 수소연료전지 · (5) 연료전지용 수분제어장치(가습기) (6) PEM(고분자전해질막)(7) MEA(막전극접합체)
기본 정보
- 저자
- DOI
- 10.1007/s00216-023-04678-8
- 저널
- Analytical and Bioanalytical Chemistry
- 발행년도
- 2023
- 발행기관
- Springer Science+Business Media
- 피인용수
- 9
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.1007/s00216-023-04678-8
- 토픽
- Analytical Chemistry and Sensors
- OpenAlex ID
- W4366238417
평가 내용
- 관련도
- 간접 관련
- 사업분야
- 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
- 부 분야
- (6) PEM(고분자전해질막), (7) MEA(막전극접합체)
- R&D 측면
- 분석·모델링
- 확신도
- 0.70
- 근거 용어
- optical chemical sensors, multi-analyte imaging, machine learning, pH and dissolved O2, hyperspectral camera
- 판단 근거
- 본 논문은 pH와 용존 산소(O2)를 동시에 측정하는 광학 화학 센서의 데이터 분석을 위해 머신러닝(XGBoost)을 적용하는 연구입니다. 이는 코오롱인더스트리의 수소연료전지(PEMFC)용 수분제어장치(가습기)나 막(Membrane)의 성능 평가 및 센싱 기술에 응용될 수 있는 분석 방법론을 다루고 있습니다.
- R&D 활용 포인트
- 연료전지용 분리막이나 가습기 내의 수분 및 가스 농도 변화를 정밀하게 모니터링하기 위한 광학 센서 데이터 분석 모델 및 머신러닝 알고리즘 개발에 활용 가능합니다.
- 평가 입력
- 섹션 본문 78,095자 중 30,032자 발췌
초록
본문 78,562자
본문 펼치기
섹션 본문 67문단 · 76,805자
(제목 없음)
1Simultaneous sensing of metabolic analytes such as pH and O 2 is critical in complex and heterogeneous biological environments where analytes often are interrelated. However, measuring all target analytes at the same time and position is often challenging. A major challenge preventing further progress occurs when sensor signals cannot be directly correlated to analyte concentrations due to additional effects, overshadowing and complicating the actual correlations. In fields related to optical sensing, machine learning has already shown its potential to overcome these challenges by solving nested and multidimensional correlations. Hence, we want to apply machine learning models to fluorescence-based optical chemical sensors to facilitate simultaneous imaging of multiple analytes in 2D. We present a proof-of-concept approach for simultaneous imaging of pH and dissolved O 2 using an optical chemical sensor, a hyperspectral camera for image acquisition, and a multi-layered machine learning model based on a decision tree algorithm (XGBoost) for data analysis. Our model predicts dissolved O 2 and pH with a mean absolute error of < 4.50·10 −2 and < 1.96·10 −1 , respectively, and a root mean square error of < 2.12·10 −1 and < 4.42·10 −1 , respectively. Besides the model-building process, we discuss the potentials of machine learning for optical chemical sensing, especially regarding multi-analyte imaging, and highlight risks of bias that can arise in machine learning-based data analysis.Publisher's note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Introduction
2Sensing multiple analytes at the same time and space has long been a key challenge in sensor development. Especially for biotechnological [1,2], environmental [3][4][5], and medical [6] applications, where entangled biological processes lead to analyte transformations and the establishment of chemical gradients, multi-analyte sensors based on luminescent optical chemical sensors (the so-called optodes) have proven to be beneficial [7,8] and are therefore in high demand. For instance, in heterogeneous systems such as biofilms, fragmented profiling of pH and O 2 does not reflect the entire heterogeneous distribution within the biofilm, nor would monitoring with two individual sensors be able to capture the interdependence of these analytes and their combined influence on the biofilm [9,10].
3Hence, various approaches for luminescent-based optical chemical sensors are currently being investigated, all aiming at the simultaneous detection of multiple analytes at the exact same position with less complex and affordable equipment. The approaches span single indicators which show sensitivity to multiple analytes [11], to multi-layered systems that meet the spectral requirements of a given read-out system [12][13][14][15][16] (color camera with 3 to 4 channels), to the further development of existing read-out instrumentations [17]. However, despite recent progress in the field, certain limitations are inevitable. Specialized indicators normally require complex synthesis and are rarely commercially available. The combination of multiple indicators into a single sensor often leads to interactions between the respective indicators, such as energy transfer reactions, or to problems regarding 1 3 the spectral separation of the respective overlapping emissions. Recently, we have shown that the later issue of overlapping emissions can be overcome by using hyperspectral imaging systems and spectral unmixing [17]. At the same time, we had to realize that while conventional methods in statistical data analysis are suitable for simple multi-analyte sensor systems where only the luminescence intensity of the indicators changes as a function of analyte concentration [17], these methods fail when indicators also undergo a spectral shift at the same time. In this case, the interactions and dependencies of the indicators become too complex. Analysts are therefore no longer able to deduce an unambiguous and universal model that considers all potential cross-sensitivities. To overcome this and decipher complex and nested datasets, machine learning algorithms (ML) offer great potential. ML exploits the ability of computers to learn from (training) data, recognize patterns in nested datasets, and automate the construction of analytical models. Since their emergence in the second half of the twentieth century, ML models have been applied in a variety of fields, including life and environmental sciences for predicting extreme natural events using remote sensing [18], enabling smart sensor systems [19], and drug delivery [20,21]. Some interesting work using ML approaches has already been done related to optical sensors [22,23]. Expanding on this work, we now want to apply ML models to enable multi-analyte imaging in 2D to visualize the heterogeneity of biological environments and the distributions of multiple analytes in 2 dimensions simultaneously. While other sensing approaches, especially fiber-based single-point sensor approaches might face an operational challenge of creating large (training) datasets, which is, however, a prerequisite for training ML models to derive an underlying trend according to the large number theorem [24,25], it is the inherent nature of imaging to record hundreds of quality sample data within one single image acquisition.
4Therefore, we present a novel proof-of-concept approach for optical chemical multi-analyte imaging using a machine learning (ML) model. Using a dual analyte sensor for pH and dissolved oxygen, we demonstrate the potential of ML for nested and intercoupled emission spectra of optical chemical sensors. Using a hyperspectral camera as the read-out system provides us with a sufficiently large amount of data within one single image acquisition, where each image pixel contains high-quality information over the entire spectral range between 470 and 900 nm. In the following, we first introduce the problem of a complex and nested dataset for the dual analyte sensor, which cannot be solved with conventional statistical models. We then describe the ML model as well as its performance and conclude with a discussion about the benefits and risks of the novel approach for optical chemical multi-analyte sensors.
Material and methods
5Refer to the supplementary materials for more information on algorithm optimization, validation of the final ML model, or its visualization. In addition, examples of the raw calibration data for the 2-layered optical chemical sensor as well as a spreadsheet containing the prepared calibration data can be downloaded from the Mendeley data repository [26]. Due to the available space at the repository, we are only able to share examples of the original hyperspectral fluorescence images.
Materials
6The O 2 -sensitive indicator dye platinum(II)-meso-tetraphenyl-tetrabenzoporphyrin (Pt-TPTBP) and the reference dye Macrolex Fluorescence Yellow (MFY 10GN) were purchased from Frontier Scientific (frontiersci.com, Logan; USA) and Lanxess AG (lanxess.com, Köln; Germany), respectively. The lipophilic pH indicator HPTS (1-hydroxypyrene-3,6,8-tris-bis(2-ethylhexyl)sulfonamide was provided by Dr. Sergey Borisov, Graz University of Technology, Austria) [27]. Additional chemicals for sensor fabrication and calibration, such as polystyrene (PS. MW 192.000 g·mol −1 ), polyurethane-based hydrogel (HydroMed D4), sodium sulfite (Na 2 SO 3 ), ethanol, and toluene, were bought from Sigma Aldrich (sigmaaldrich.com, St Louis; USA), Advan Source biomaterials (advbiomaterials.com, MA; USA), and Merck KGaA (merckgroup.com, Darmstadt; Germany). The monocrystalline diamond powder was purchased from Pureon (pureon.com, Lengwil; Switzerland). All buffer materials (sodium phosphate monobasic monohydrate NaH 2 PO 4 · H 2 O and dihydrate NaH 2 PO 4 · 2H 2 O) were obtained from Sigma Aldrich (sigmaaldrich.com, St Louis; USA). The PET support foil (Lumirror 4001, 125 µm) was obtained from Puetz Folien (puetz-folien.com, Taunusstein; Germany). All chemicals were used as received.
Optode fabrication
7A sensor cocktail was prepared for the fabrication of the optodes according to literature [28]. First, the O 2 -sensitive layer was prepared, for which 0.94 mg of the Pt-TPTBP indicator and 0.86 mg of the MFYreference dye were dissolved in 1 g of a 10%w/w polymer matrix of PS (in toluene). The sensor cocktail was knife-coated onto a dust-free PET support foil using a film applicator (Byk-Gardner GmbH, Germany) yielding a ~ 12-µm-thick sensor layer after solvent evaporation. For the pH-sensitive layer, 0.95 mg of the lipophilic HPTS and 48 mg monocrystalline diamond powder, serving as a signal enhancer, were dissolved in 1 g of a 10%w/w solution of D4 (in ethanol:water, 9:1 w/w). This sensor cocktail was knife-coated onto the top of the well-dried O 2 -sensitive layer yielding a ~ 10-µm-thick pH layer after solvent evaporation. The total thickness of the dual analyte optode was thus ~ 22 µm. In addition to the dual analyte sensor, single sensors consisting of only one layer, sensitive to either pH or O 2 , were also coated with the same cocktail compositions as described previously.
Imaging setup and optode calibration
8The setup was built similarly to that described in a previous paper of ours with some adaptations to suit the current dual analyte sensor [17]. In Fig. 1, a schematic of the imaging setup is shown for clarification. In short, the setup consisted of a hyperspectral camera (imec SnapScanVNIR camera; imec-int.com, Belgium) equipped with a color-corrected objective (Apo-Xenoplan lens, f2.0; Schneider-Kreuznach GmbH, German). A plastic filter (#10 medium yellow; LEEfilters.com, UK) was placed in front of the objective to reduce background fluorescence. The camera was connected to a PC and controlled using the manufacturers' hyperspectral image-recording software (HSI Snapscan v1.4.1.0; imec-int.com, Belgium). For image acquisition, the camera was set to scan the full image frame (1088 × 2048 pixels) and the full spectral wavelength range (470-900 nm) with a pixel step of 3 nm and an integration time of 5 ms. The pixel blur and binning were set to 0 and 1, respectively. The dual analyte sensor foil was excited with a high-power LED light source (460 nm; LED Hub, Omicron Laserage Laserprodukte GmbH, Rodgau, Germany) equipped with a 1-m liquid light guide and a collimating lens. The LED light source was controlled via a PC running the manufacturers' software. The dual analyte sensor foil of approximately 2.5 × 8 cm 2 was taped on the inner transparent glass wall of a buffer-filled measurement chamber. Excitation and imaging of the sensor foil were done frontally through the chamber wall.
9Calibration of the dual analyte optode was performed similarly to as it is described in the literature; however, some adjustments were made to suit the dual analyte optode [14,28]. For pH calibration, the pH of the phosphate buffer (0.1 mol·L −1 with an ionic strength of 0.377 mol·L −1 ) was adjusted by using 1 mol·L −1 HCl and NaOH solutions. Oxygen levels were altered by using compressed O 2 and N 2 (Air Liquide S.A., airliquide.dk; Taastrup, Denmark), which were mixed with a gas mixer (Red-y-compact; Vögtlin Instruments GmbH; Muttenz, Switzerland). At the lowest O 2 calibration points, sodium sulfite was added as an extra O 2 scavenger to ensure fully anoxic conditions. All measurements were performed at the same constant temperature (22.5 ± 0.5 °C). A pH meter (PHM210 Meterlab, Radiometer Analytical, Lyon, France) facilitated the monitoring of the pH throughout the calibration. O 2 levels and temperature were monitored with a fiber-optic O 2 phase-fluorimeter (FireSting GO 2 ; PyroScience GmbH, Aachen, Germany) equipped with a robust O 2 sensor (OXROB3; PyroScience GmbH, Aachen, Germany).
Spectral characterization of individual layers of the dual analyte optode
10For full spectral characterization of the single and dual analyte optodes, additional fluorescence and excitation spectra were acquired with a ClarioStar Plus plate reader (BMG Labtech, Ortenberg, Germany) at room temperature and different pH and oxygen conditions. The optodes were taped into a 12-well plate and filled with 1 mL of phosphate buffer, and the pH was adjusted by using 1 M HCl and NaOH solutions. The O 2 levels were either reached by shaking the buffer solution before filling it into the well or by adding a few drops of a 2% solution of sodium sulfite. For the excitation spectra, the excitation wavelength was scanned between 350 and 700 nm (slit width 10 nm, increment 2 nm), while the emission wavelength was set to 770 nm (slit width 10 nm). To record the fluorescence spectrum, the emission wavelength was scanned between 420 and 840 nm (slit width 10 nm, increment 2 nm), and the excitation wavelength was set to 380 nm (slit width 10 nm).
Required programming packages
11The radiometric correction of the raw hyperspectral image is done using a MATLAB script that can be obtained from the camera manufacturer upon request (hsisupport@imec. be). The image analysis, data processing, and the ML model were coded in Python 3.7.4 (python.org) using the following Python packages: for loading and processing hyperspectral images, we used SpectralPython (SPy, spectralpython.net), matplotlib (matplotlib.org), and Python Imaging Library (PIL; pypi.org/project/Pillow); for spectral fitting and solving the integration and the optimization problem, SciPy (scipy.org) and the nonlinear least-square fitting (lmfit; lmfit.githu-b.io) were used. Further packages required are NumPy, pandas, math, random, time, glob, pathlib, os, h5py, and andxlrd. All libraries required were to date at the time the paper was submitted. The Python code can be downloaded from GitHub (github.com/silviaelisabeth/ML_for_ pHandO2) and is openly accessible.
Performance analysis
12While classification models in ML can be assessed and evaluated straightforwardly based on certain performance measures such as their accuracy, this is not the case for regression models. In regression, the model performance is reported as its deviation or error from the expected target values. While there are various approaches to assessing the regression performance of a model, the commonly used error metrics are the root mean square error (RMSE) and the mean absolute error (MAE) [29,30].
Root mean square error (RMSE)
13The root mean square error is also called root mean square dispersion and measures the difference between the estimated (y i ) and the expected target (x i ) values. The difference between these values is first squared and then averaged across the entire data samples. Finally, the square root is calculated. The RMSE determines the average magnitude of the error and is a negatively oriented scoring rule, i.e., the lower the error, the better the model prediction performance. However, RMSE is less robust towards outliers: with y i being the estimated value and x i being the expected value for the ith sample. N is the number of samples in the given dataset.
Mean absolute error (MAE)
14The mean absolute error instead does not take the square of the difference between observed and predicted values but the absolute value. It is thus more robust towards outliers and does not penalize larger errors more than smaller ones:
15with y i being the estimated value and x i being the expected value for the ith sample. N is the number of samples in the given dataset.
Results and discussion
16In optical chemical sensing, where changing spectral properties of an analyte-sensitive indicator are correlated with the analyte concentration, the situation can quickly become complex. Not only effects such as leaching or bleaching may alter the sensor over time, but also due to the inhered interaction of individual components within the sensor with each other through energy or electron transfer reactions. This makes the evaluation of luminescence spectra more complex since these alternations and cross-interferences must be considered when calibrating the indicators, especially if those cross-interferences do not remain constant [31]. Figure 2 displays such a complex situation for the simultaneous imaging of pH and dissolved O 2 . The figure depicts the spectral excitation/emission characteristics of the individual layers of the optical chemical dual analyte sensor for pH ( Fig. 2A-B) or dissolved O 2 (Fig. 2C-D). While the two-layered structure of the optode should prevent closeproximity energy transfer reactions, such as Förster resonance energy transfer (FRET) or photoinduced electron transfer (PET), reabsorption of luminescence can still occur when the excitation and emission spectra of the indicators involved overlap [32]. Figure 2A and D reveal that reabsorption may occur to some extent, particularly under basic conditions, as the reference indicator, macrolex fluorescence yellow emits between 500 and 600 nm (Fig. 2D), which overlaps with the absorption of lipophilic HPTS (yellow and green curve in Fig. 2A). However, the reabsorption of the O 2 sensor layer (combination of macrolex fluorescence yellow dye and oxygen-sensitive Pt-TPTBP dye) (Fig. 2C) is predominant due to the
17overlapping excitation of the lipophilic HPTS dye (Fig. 2B).
18In particular under acidic conditions, when the pH indicator emits between 400 and 550 nm, reabsorption by the O 2 sensor layer (Fig. 2C) can occur. However, at higher pH values, this resonance and reabsorption are reduced since the overlap between emission and absorption is less. The complex and nested combination of several different effects creates a situation that cannot be predicted and accounted for in one or a few polynomial functions as it is required by conventional approaches to signal deconvolution. Figure 3 subsequently illustrates this nested and intercoupled situation with spectral cross-interferences when it comes to calibrating the different analytes. While Fig. 3A displays pH calibration data of the dual analyte optodes at two different O 2 concentrations (anoxic and air-saturated), Fig. 3B displays O 2 calibration data at two different pH values (4 and 8). The dashed curves in the panels represent hypothetical calibration curves if respective standard calibration fit functions were applied to the calibration data to calibrate the individual analytes. As can be seen from the graphs and especially from Fig. 3A, the fitted calibration curves fail to describe the calibration data well as there is cross-dependence in both calibrations. While most of the calibration data might be solved individually by conventional fit functions, the pH calibration under anoxic conditions as well as the interpolation of all other analyte combinations can hardly be solved by applying conventional analysis methods and calibration functions. However, it is important to note that the indicators chosen in this example show a spectral overlap and were specifically chosen to also demonstrate the limitations in selecting commonly used (available) indicators. By combining other indicators with less spectral overlap, this issue could be eliminated or reduced; this often requires the synthesis of specialized indicators, which for various reasons is not always possible.
19That is the point ML modeling comes into play as an alternative approach. The advantage of ML models lies in their capability of finding underlying patterns and parameter correlations in nested and interconnected datasets whose complexity and dimensionality are beyond human imagination. For the modeling, we decided to use the absolute fluorescence response of the dual analyte optode, as opposed to indicator are shown in the right panel. Note that the O 2 -sensitive sensor layer also contains macrolex fluorescent yellow as the reference dye. While in A, C, and D, the fluorescence intensity is displayed relative to the maximum intensity, in B, the intensity is displayed relative to the isosbestic point at 530 nm the usual approach in optical-chemical sensing, which uses ratiometric intensity relative to the reference indicator. Our decision was based on the fact that, in our tests, the former approach yielded slightly better results than the latter one.
20In the following, we first explain data extraction and preparation, which are a crucial step in modeling, and describe important aspects that can affect model performance. We then describe the process of model building and optimization, followed by a description and validation of the final model for simultaneous imaging of pH and dissolved O 2 . Especially during the validation step, the advantage of ML modeling becomes clear, but at each step, we emphasize the risks of bias that can impact the overall model performance. Scheme 1 provides an overview of the workflow with all processes conducted from initial data acquisition to the final machine learning model.
Data preparation
21The first key step in building a strong ML model is to provide a suitable dataset on which the algorithm can train and deduce an underlying (hidden) pattern. For a well-performing ML model, a suitable dataset means providing a large or even big set of samples that contain balanced and highquality information to follow the large numbers theorem [24,25,33]. Although it depends on the individual problem and its complexity, computer scientists argue that a rule of thumb is at least 1000 samples for a suitable dataset. In some cases, when the amount of data is not a limiting factor, researchers may apply dimension reduction techniques such as principal component analysis, factor analysis, or linear discriminant analysis to enhance information density and remove unwanted noise from random variables before applying further regression algorithms [34,35]. However, applying dimensional reduction techniques may also filter out relevant information for subsequent regression algorithms to find the underlying patterns. Therefore, we opted for an outlier removal test to ensure data quality instead of a dimension reduction technique. In addition, our preliminary tests (not shown here) demonstrated that this approach led to better results without sacrificing relevant information.
22Hence, to match the first requirement and extract a sufficiently large amount of spectral data from the optode image, we selected a homogeneous region of interest (RoI) from the optode calibration image. However, unlike the usual approach in optical chemical imaging, we did not average over a larger area of the optode but chose smaller sections of 5 × 5 pixels for the RoIs, cleaned the data from outliers with an interquartile range, and calculated the median average of each RoI. In this way, we obtained 7196 oxygen samples and 6476 pH samples while mitigating the noise of the optode images. A table has been compiled from these processed data, and the interested reader may download the calibration data from the publicly accessible repository Mendeley data [26].
23In the next step, we examined the distribution of sample points across calibration points to tailor the dataset to be balanced, i.e., each calibration point is almost equally represented in the dataset. This is critical to avoid bias in model accuracy and to prevent the model from being trained on a hidden bias that may stem from artifacts but has nothing to do with the actual feature correlations (overfitting). As can be seen in Fig. 4, the distribution of the sample data we obtained for each calibration point
Machine learning regression model
24When screening the literature for an appropriate machine learning algorithm, one comes across a great variety of machine learning algorithms applied to a wide range of topics and problems, including research questions in life and environmental sciences [1,2]. The field is constantly evolving, with new algorithms being introduced to solve increasingly complex problems in less time. Each of them with different strengths and potentials, but not all of them are applicable to every research question or sometimes even unnecessarily complex in terms of computational power or do not match the given data or problem at hand. Interested readers can read more about other ML models in the referenced publications [29,[33][34][35][36][37]. Subsequently, we describe how we selected and optimized an appropriate ML model based on the given dataset and validated its ultimate performance.
Model identification
25The measured calibration dataset is best described as a structured dataset summarizing the spectral responses of the dual analyte sensor along the entire wavelength between 470 and 900 nm at different pH and O 2 conditions. In addition to the spectral response of the dual analyte sensor (the so-called features of the dataset), the specific pH and O 2 concentrations during calibration are known. Thus, the calibration dataset can be described as a labeled, structured dataset with an additional target vector that allows the use of supervised ML algorithms. Another important point is that although the structured dataset provides discrete calibration points, it must be possible to obtain continuous results in subsequent measurements, which hence requires a regression model rather than a classification model. However, even though the problem can be narrowed down to a supervised regression problem by the given dataset, there remain a myriad of different approaches and algorithms. Moreover, since the dual analyte sensor is sensitive to two analytes simultaneously, the algorithm should reflect that and output both analyte information at the same time. Therefore, we decided to build a multi-layered ML model that first finds the pH that best fits a given spectral response of the dual analyte sensor and then iteratively finds a solution for dissolved O 2 . The reason for this order of the multi-layered model was that the dual analyte sensor appears to be more sensitive to changes in O 2 concentration, and cross-interactions that occur, such as FRET or alike, impact the overall sensor response more than changes in pH (see Fig. 3). Furthermore, please note that we used the absolute fluorescence spectra instead of the ratiometric ones, as is usually the case in optical chemical imaging [12].
26To now find the best ML regression algorithm, we have assessed different options and determined the performance of the overall model for the given data using different loss functions. For applied ML, the choice of the loss function can be very crucial and can lead to the favoring of different algorithms depending on where the focus lies for a given problem, i.e., whether, for example, accuracy is more relevant than sensitivity or selectivity of the sensor. One common way of describing the performance of a regression model is to determine its accuracy and dispersion in terms of mean absolute error (MAE) and root mean square error (RMSE), respectively [30]. However, while the performance measures of the dataset describe the overall performance of the algorithm for a given set, one cannot rule out that the data carry a hidden bias to which the algorithm mainly responds and trains. Thus, to prevent overfitting, the dataset is typically split into training and validation datasets. The former is used to train the model and describe the overall model performance, while the latter is used to comprehensively describe its performance on a dataset it has never seen before. Splitting the entire dataset is done using the standard split function of the Python package lmfit. This split function divides the dataset into random subsets according to Tables 1 and 2 give an overview of the performance measures of the different ML algorithms and for each individual analyte. As can be seen from Tables 1 and 2, there is not one regression algorithm that is best suited and provides optimal results for both analytes. However, the algorithms that perform best for both the training data and the validation data are the following regressors: decision tree (DT), random forest (RF), and XGBoost (XGB). Consequently, these three regressors were selected as potential candidates for the ML model, and their respective parameters were further optimized.
Model optimization
27To fine-tune the algorithm and optimize its performance, there are several set screws that define the algorithm, control its learning process, and constrain the algorithm in minimizing a predefined loss function. These so-called hyperparameters can be optimized in a process called hyperparameter optimization (HPO). This has been done for all three potential candidates and each analyte. Traditional approaches to HPO are either a parameter sweep, in which parameters are optimized by comprehensively enumerating all combinations over a manually specified subset of the hyperparameter space or a random search, in which a subset of parameter combinations is randomly defined [38]. The supplemental information provides a detailed summary of the HPO process of all three algorithms and both analytes, while Table 3 summarizes the final performance of the optimized algorithms using the same performance measures (MAE and RMSE) as described previously. Please note that the attached Excel file contains a detailed summary of all HPO processes, intended as a guide for readers new to ML modeling to be able to replicate the steps for model optimization. The Word document provides a summary of the most important intermediate results for a quick overview. Note that the Excel file provides very detailed information on the HPO process.
28As shown in Table 3, the optimal regression algorithm for pH prediction is the XGBoost regression algorithm, a scalable decision tree-based ensemble ML algorithm that uses a gradient boosting framework and provides a parallel tree boosting [39]. This is not surprising, since for small-to medium-sized structured data, XGBoost like all decision tree-based algorithms is considered to be the best performing. While the performance measures for pH prediction are clearly in favor of the XGBoost regression algorithm, this is less clear for dissolved O 2 prediction. We have therefore decided to use the XGBoost regression algorithm for the prediction of dissolved O 2 as well. Table 4 summarizes the optimized hyperparameter for each analyte yielding the performance metrics described before (Table 3).
Final ML model and model validation
29Upon performing several optimization and screening procedures, the final model for simultaneous detection of pH and dissolved O 2 using optical chemical sensors now consists of a two-layer ML model based on XGBoost algorithms. First, the pH value is predicted and, subsequently the O 2 concentration with conditional knowledge of the pH value. However, since the prediction of dissolved O 2 appeared to be rather uncertain, with some outliers and larger uncertainties, an additional ML layer using an XGBoost regression algorithm was used to iteratively optimize the O 2 prediction. Thus, the final ML model includes three XGBoost layers for pH and O 2 prediction. The final algorithm can be downloaded from GitHub (github.com/silviaelisabeth/ ML_for_pHandO2) and is freely available. As mentioned several times in this publication, the validation of an ML model is crucial in the building process to ensure its accuracy and to prevent any bias in the dataset. Besides validation by one-time sub-sampling, as performed previously, another option is cross-validation [36]. Crossvalidation is a resampling method that uses either individual samples or a larger subsample from the entire dataset to validate a model on different iterations. During the validation process, the subsamples are removed from the training dataset to avoid a prediction bias. Due to this, however, cross-validation requires more computational power than validation by one-time sub-sampling; but it also assesses the performance of the model much more accurately. An extremely accurate but, due to the large size of our dataset, computational intense cross-validation would be a leaveone-out cross-validation in which all possible combinations are trained and tested. Consequently, a good balance between these two approaches, validation by one-time subsampling or validation by leave-one-out cross-validation, would thus be k-fold cross-validation, a non-exhaustive cross-validation in which the dataset is randomly partitioned in k equally sized subsamples. While one of the k subsamples is used as validation data, the remaining subsamples are used as training data. This process is then repeated k times. In ML modeling, it is common practice to perform 10-fold cross-validation [36]. Subsequent to cross-validation, MAE and RMSE can be determined as performance metrics as described before. A summary of the validation process for the ML model is listed in Table 5, while detailed information about the variance of predicted and target pH and dissolved O 2 , respectively, can be found in the supplemental information. In order to illustrate the benefits of iterative O 2 prediction, we listed in Table 5 the performance metrics for the initial O 2 prediction as well as the performance metrics after adding the additional layer for iterative O 2 prediction. Please note that 10-fold cross-validation indicates the minimum performance of a model, whereas the true performance of the model is better and achieves lower dispersions.
30As can be seen from Table 5, the iterative process of O 2 prediction leads to particularly small performance measures with a mean absolute error of < 4.50·10 −2 (compared to < 1.57 for non-iterative O 2 prediction) and a root mean squared error of < 2.12·10 −1 (< 1.25 previously). This reduces the uncertainty of the O 2 prediction on average to the third decimal.
31As described in the supplemental information (cf. Section 4), the iterative approach for prediction of dissolved O 2 helps circumvent potential reabsorption and interference artifacts. In contrast, the performance measures for pH prediction are significantly worse, with mean absolute error and root mean square error of < 1.96·10 −1 and < 4.42·10 −1 , respectively. Thus, a prediction of pH is on average less accurate with this model and varies in the first decimal. A detailed discussion of the deviation of the predicted pH values compared to the target pH values can be found in the supplemental information (see Section 3). As shown in Fig. 5, as well as in Figure·S2 and Figure·S3, the deviations occur mainly at lower pH values when reabsorption effects and indicator interactions are more dominant. Furthermore, it should be noted that although the calibration is performed over the entire pH range, the dynamic range of the pH sensing layer is, however, limited to a range of ± 2 pH units around the pK a value, i.e., a range between 5 and 9. pH values outside this range are not considered
Conclusion
32We have developed a novel approach to multi-analyte optical chemical imaging in 2D using a machine learning model and outlined the building process of the multi-layered ML model for complex and coupled data. While the dual analyte optode calibration data for simultaneous imaging of pH and dissolved O 2 cannot be explained by conventional multivariate analysis methods, machine learning algorithms have proven useful. Consequently, we were able to build a threelayered model with individual pH and iterative O 2 prediction based on a decision tree-based algorithm (the so-called XGBoost). Figure 5C-D illustrates the conversion of the absolute fluorescence intensity emitted by the optode to the corresponding pH and concentration of dissolved O 2 in each pixel. While the dissolved O 2 can thus be predicted with an average error of < 0.045 (MAE) and < 0.212 (RMSE), pH is predicted with an average error of < 0.196 (MAE) or < 0.442 (RMSE), respectively. In other words, the iterative prediction of dissolved O 2 works excellently, while the pH prediction can be improved, if necessary, as shown in the discussion. While our contribution demonstrates the advantages of ML models for nested and intercoupled datasets that cannot be solved with conventional statistical models, we Overall model performance for predicting the pH (A) and dissolved O 2 concentration (B), respectively, assessed against test data that the algorithm has never seen before. The main plot compares the predicted and the respective target values for the entire calibration range using the multi-layered ML model based on XGBoost. The insets of each panel display the dispersion around the target value as black dotted markers. The target value is indicated as an orange solid line. C and D display examples of optode images before and after data analysis. C shows the absolute fluorescence intensity of the dual analyte optode is visualized at 773 nm, whereas D shows the chemical images in which the absolute fluorescence intensity has been translated into the corresponding pH and O 2 concentration (in hPa) to represent them in each pixel also highlighted the risks during the ML model process. For each process step during ML model development, we highlighted different risks that researchers should consider when building their own ML model, including data preparation (outlier test vs. dimension reduction), establishing a balanced training dataset and identifying and validating an appropriate ML model for the question at hand. Researchers need to be aware that while it is inherent to ML models to find patterns, it is our responsibility to not indulge into p-hacking or data dredging and follow patterns that in reality do not exist.
33Despite the risks that come with ML modeling, we should dare and bring data analysis out of its shadowy existence. We should give it due attention if we want to advance multi-analyte imaging. In particular from a practical aspect, this approach appears very appealing. ML can help construct multi-analyte sensors using already existing indicators and circumvents the need to find indicators that have limited spectral overlap or other types of interactions. Converting acquired images into quantitative data is often cumbersome and not simple, especially when additional signal deconvolution is required. ML algorithms clearly show advantages in deciphering intercoupled datasets with high dimensionality and complexity, where human imagination and conventional methods fail in finding the underlying correlations. However, we must not blindly use any ML algorithm but also be aware of the possible biases and risks when setting up training and validation data. Funding Open access funding provided by Royal Danish Library The study was supported by a research grant from the Grundfos Foundation and a Sapere Aude from the Independent Research Fund Denmark (IRFD) (DFF-8048-00057B).
Conflict of interest The authors declare no competing interests.
34Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.
Introduction
35Sensing multiple analytes at the same time and space has long been a key challenge in sensor development. Especially for biotechnological [1,2], environmental [3][4][5], and medical [6] applications, where entangled biological processes lead to analyte transformations and the establishment of chemical gradients, multi-analyte sensors based on luminescent optical chemical sensors (the so-called optodes) have proven to be beneficial [7,8] and are therefore in high demand. For instance, in heterogeneous systems such as biofilms, fragmented profiling of pH and O 2 does not reflect the entire heterogeneous distribution within the biofilm, nor would monitoring with two individual sensors be able to capture the interdependence of these analytes and their combined influence on the biofilm [9,10].
36Hence, various approaches for luminescent-based optical chemical sensors are currently being investigated, all aiming at the simultaneous detection of multiple analytes at the exact same position with less complex and affordable equipment. The approaches span single indicators which show sensitivity to multiple analytes [11], to multi-layered systems that meet the spectral requirements of a given read-out system [12][13][14][15][16] (color camera with 3 to 4 channels), to the further development of existing read-out instrumentations [17]. However, despite recent progress in the field, certain limitations are inevitable. Specialized indicators normally require complex synthesis and are rarely commercially available. The combination of multiple indicators into a single sensor often leads to interactions between the respective indicators, such as energy transfer reactions, or to problems regarding 1 3 the spectral separation of the respective overlapping emissions. Recently, we have shown that the later issue of overlapping emissions can be overcome by using hyperspectral imaging systems and spectral unmixing [17]. At the same time, we had to realize that while conventional methods in statistical data analysis are suitable for simple multi-analyte sensor systems where only the luminescence intensity of the indicators changes as a function of analyte concentration [17], these methods fail when indicators also undergo a spectral shift at the same time. In this case, the interactions and dependencies of the indicators become too complex. Analysts are therefore no longer able to deduce an unambiguous and universal model that considers all potential cross-sensitivities. To overcome this and decipher complex and nested datasets, machine learning algorithms (ML) offer great potential. ML exploits the ability of computers to learn from (training) data, recognize patterns in nested datasets, and automate the construction of analytical models. Since their emergence in the second half of the twentieth century, ML models have been applied in a variety of fields, including life and environmental sciences for predicting extreme natural events using remote sensing [18], enabling smart sensor systems [19], and drug delivery [20,21]. Some interesting work using ML approaches has already been done related to optical sensors [22,23]. Expanding on this work, we now want to apply ML models to enable multi-analyte imaging in 2D to visualize the heterogeneity of biological environments and the distributions of multiple analytes in 2 dimensions simultaneously. While other sensing approaches, especially fiber-based single-point sensor approaches might face an operational challenge of creating large (training) datasets, which is, however, a prerequisite for training ML models to derive an underlying trend according to the large number theorem [24,25], it is the inherent nature of imaging to record hundreds of quality sample data within one single image acquisition.
37Therefore, we present a novel proof-of-concept approach for optical chemical multi-analyte imaging using a machine learning (ML) model. Using a dual analyte sensor for pH and dissolved oxygen, we demonstrate the potential of ML for nested and intercoupled emission spectra of optical chemical sensors. Using a hyperspectral camera as the read-out system provides us with a sufficiently large amount of data within one single image acquisition, where each image pixel contains high-quality information over the entire spectral range between 470 and 900 nm. In the following, we first introduce the problem of a complex and nested dataset for the dual analyte sensor, which cannot be solved with conventional statistical models. We then describe the ML model as well as its performance and conclude with a discussion about the benefits and risks of the novel approach for optical chemical multi-analyte sensors.
Material and methods
38Refer to the supplementary materials for more information on algorithm optimization, validation of the final ML model, or its visualization. In addition, examples of the raw calibration data for the 2-layered optical chemical sensor as well as a spreadsheet containing the prepared calibration data can be downloaded from the Mendeley data repository [26]. Due to the available space at the repository, we are only able to share examples of the original hyperspectral fluorescence images.
Materials
39The O 2 -sensitive indicator dye platinum(II)-meso-tetraphenyl-tetrabenzoporphyrin (Pt-TPTBP) and the reference dye Macrolex Fluorescence Yellow (MFY 10GN) were purchased from Frontier Scientific (frontiersci.com, Logan; USA) and Lanxess AG (lanxess.com, Köln; Germany), respectively. The lipophilic pH indicator HPTS (1-hydroxypyrene-3,6,8-tris-bis(2-ethylhexyl)sulfonamide was provided by Dr. Sergey Borisov, Graz University of Technology, Austria) [27]. Additional chemicals for sensor fabrication and calibration, such as polystyrene (PS. MW 192.000 g·mol −1 ), polyurethane-based hydrogel (HydroMed D4), sodium sulfite (Na 2 SO 3 ), ethanol, and toluene, were bought from Sigma Aldrich (sigmaaldrich.com, St Louis; USA), Advan Source biomaterials (advbiomaterials.com, MA; USA), and Merck KGaA (merckgroup.com, Darmstadt; Germany). The monocrystalline diamond powder was purchased from Pureon (pureon.com, Lengwil; Switzerland). All buffer materials (sodium phosphate monobasic monohydrate NaH 2 PO 4 · H 2 O and dihydrate NaH 2 PO 4 · 2H 2 O) were obtained from Sigma Aldrich (sigmaaldrich.com, St Louis; USA). The PET support foil (Lumirror 4001, 125 µm) was obtained from Puetz Folien (puetz-folien.com, Taunusstein; Germany). All chemicals were used as received.
Optode fabrication
40A sensor cocktail was prepared for the fabrication of the optodes according to literature [28]. First, the O 2 -sensitive layer was prepared, for which 0.94 mg of the Pt-TPTBP indicator and 0.86 mg of the MFYreference dye were dissolved in 1 g of a 10%w/w polymer matrix of PS (in toluene). The sensor cocktail was knife-coated onto a dust-free PET support foil using a film applicator (Byk-Gardner GmbH, Germany) yielding a ~ 12-µm-thick sensor layer after solvent evaporation. For the pH-sensitive layer, 0.95 mg of the lipophilic HPTS and 48 mg monocrystalline diamond powder, serving as a signal enhancer, were dissolved in 1 g of a 10%w/w solution of D4 (in ethanol:water, 9:1 w/w). This sensor cocktail was knife-coated onto the top of the well-dried O 2 -sensitive layer yielding a ~ 10-µm-thick pH layer after solvent evaporation. The total thickness of the dual analyte optode was thus ~ 22 µm. In addition to the dual analyte sensor, single sensors consisting of only one layer, sensitive to either pH or O 2 , were also coated with the same cocktail compositions as described previously.
Imaging setup and optode calibration
41The setup was built similarly to that described in a previous paper of ours with some adaptations to suit the current dual analyte sensor [17]. In Fig. 1, a schematic of the imaging setup is shown for clarification. In short, the setup consisted of a hyperspectral camera (imec SnapScanVNIR camera; imec-int.com, Belgium) equipped with a color-corrected objective (Apo-Xenoplan lens, f2.0; Schneider-Kreuznach GmbH, German). A plastic filter (#10 medium yellow; LEEfilters.com, UK) was placed in front of the objective to reduce background fluorescence. The camera was connected to a PC and controlled using the manufacturers' hyperspectral image-recording software (HSI Snapscan v1.4.1.0; imec-int.com, Belgium). For image acquisition, the camera was set to scan the full image frame (1088 × 2048 pixels) and the full spectral wavelength range (470-900 nm) with a pixel step of 3 nm and an integration time of 5 ms. The pixel blur and binning were set to 0 and 1, respectively. The dual analyte sensor foil was excited with a high-power LED light source (460 nm; LED Hub, Omicron Laserage Laserprodukte GmbH, Rodgau, Germany) equipped with a 1-m liquid light guide and a collimating lens. The LED light source was controlled via a PC running the manufacturers' software. The dual analyte sensor foil of approximately 2.5 × 8 cm 2 was taped on the inner transparent glass wall of a buffer-filled measurement chamber. Excitation and imaging of the sensor foil were done frontally through the chamber wall.
42Calibration of the dual analyte optode was performed similarly to as it is described in the literature; however, some adjustments were made to suit the dual analyte optode [14,28]. For pH calibration, the pH of the phosphate buffer (0.1 mol·L −1 with an ionic strength of 0.377 mol·L −1 ) was adjusted by using 1 mol·L −1 HCl and NaOH solutions. Oxygen levels were altered by using compressed O 2 and N 2 (Air Liquide S.A., airliquide.dk; Taastrup, Denmark), which were mixed with a gas mixer (Red-y-compact; Vögtlin Instruments GmbH; Muttenz, Switzerland). At the lowest O 2 calibration points, sodium sulfite was added as an extra O 2 scavenger to ensure fully anoxic conditions. All measurements were performed at the same constant temperature (22.5 ± 0.5 °C). A pH meter (PHM210 Meterlab, Radiometer Analytical, Lyon, France) facilitated the monitoring of the pH throughout the calibration. O 2 levels and temperature were monitored with a fiber-optic O 2 phase-fluorimeter (FireSting GO 2 ; PyroScience GmbH, Aachen, Germany) equipped with a robust O 2 sensor (OXROB3; PyroScience GmbH, Aachen, Germany).
Spectral characterization of individual layers of the dual analyte optode
43For full spectral characterization of the single and dual analyte optodes, additional fluorescence and excitation spectra were acquired with a ClarioStar Plus plate reader (BMG Labtech, Ortenberg, Germany) at room temperature and different pH and oxygen conditions. The optodes were taped into a 12-well plate and filled with 1 mL of phosphate buffer, and the pH was adjusted by using 1 M HCl and NaOH solutions. The O 2 levels were either reached by shaking the buffer solution before filling it into the well or by adding a few drops of a 2% solution of sodium sulfite. For the excitation spectra, the excitation wavelength was scanned between 350 and 700 nm (slit width 10 nm, increment 2 nm), while the emission wavelength was set to 770 nm (slit width 10 nm). To record the fluorescence spectrum, the emission wavelength was scanned between 420 and 840 nm (slit width 10 nm, increment 2 nm), and the excitation wavelength was set to 380 nm (slit width 10 nm).
Required programming packages
44The radiometric correction of the raw hyperspectral image is done using a MATLAB script that can be obtained from the camera manufacturer upon request (hsisupport@imec. be). The image analysis, data processing, and the ML model were coded in Python 3.7.4 (python.org) using the following Python packages: for loading and processing hyperspectral images, we used SpectralPython (SPy, spectralpython.net), matplotlib (matplotlib.org), and Python Imaging Library (PIL; pypi.org/project/Pillow); for spectral fitting and solving the integration and the optimization problem, SciPy (scipy.org) and the nonlinear least-square fitting (lmfit; lmfit.githu-b.io) were used. Further packages required are NumPy, pandas, math, random, time, glob, pathlib, os, h5py, and andxlrd. All libraries required were to date at the time the paper was submitted. The Python code can be downloaded from GitHub (github.com/silviaelisabeth/ML_for_ pHandO2) and is openly accessible.
Performance analysis
45While classification models in ML can be assessed and evaluated straightforwardly based on certain performance measures such as their accuracy, this is not the case for regression models. In regression, the model performance is reported as its deviation or error from the expected target values. While there are various approaches to assessing the regression performance of a model, the commonly used error metrics are the root mean square error (RMSE) and the mean absolute error (MAE) [29,30].
Root mean square error (RMSE)
46The root mean square error is also called root mean square dispersion and measures the difference between the estimated (y i ) and the expected target (x i ) values. The difference between these values is first squared and then averaged across the entire data samples. Finally, the square root is calculated. The RMSE determines the average magnitude of the error and is a negatively oriented scoring rule, i.e., the lower the error, the better the model prediction performance. However, RMSE is less robust towards outliers: with y i being the estimated value and x i being the expected value for the ith sample. N is the number of samples in the given dataset.
Mean absolute error (MAE)
47The mean absolute error instead does not take the square of the difference between observed and predicted values but the absolute value. It is thus more robust towards outliers and does not penalize larger errors more than smaller ones:
48with y i being the estimated value and x i being the expected value for the ith sample. N is the number of samples in the given dataset.
Results and discussion
49In optical chemical sensing, where changing spectral properties of an analyte-sensitive indicator are correlated with the analyte concentration, the situation can quickly become complex. Not only effects such as leaching or bleaching may alter the sensor over time, but also due to the inhered interaction of individual components within the sensor with each other through energy or electron transfer reactions. This makes the evaluation of luminescence spectra more complex since these alternations and cross-interferences must be considered when calibrating the indicators, especially if those cross-interferences do not remain constant [31]. Figure 2 displays such a complex situation for the simultaneous imaging of pH and dissolved O 2 . The figure depicts the spectral excitation/emission characteristics of the individual layers of the optical chemical dual analyte sensor for pH ( Fig. 2A-B) or dissolved O 2 (Fig. 2C-D). While the two-layered structure of the optode should prevent closeproximity energy transfer reactions, such as Förster resonance energy transfer (FRET) or photoinduced electron transfer (PET), reabsorption of luminescence can still occur when the excitation and emission spectra of the indicators involved overlap [32]. Figure 2A and D reveal that reabsorption may occur to some extent, particularly under basic conditions, as the reference indicator, macrolex fluorescence yellow emits between 500 and 600 nm (Fig. 2D), which overlaps with the absorption of lipophilic HPTS (yellow and green curve in Fig. 2A). However, the reabsorption of the O 2 sensor layer (combination of macrolex fluorescence yellow dye and oxygen-sensitive Pt-TPTBP dye) (Fig. 2C) is predominant due to the
50overlapping excitation of the lipophilic HPTS dye (Fig. 2B).
51In particular under acidic conditions, when the pH indicator emits between 400 and 550 nm, reabsorption by the O 2 sensor layer (Fig. 2C) can occur. However, at higher pH values, this resonance and reabsorption are reduced since the overlap between emission and absorption is less. The complex and nested combination of several different effects creates a situation that cannot be predicted and accounted for in one or a few polynomial functions as it is required by conventional approaches to signal deconvolution. Figure 3 subsequently illustrates this nested and intercoupled situation with spectral cross-interferences when it comes to calibrating the different analytes. While Fig. 3A displays pH calibration data of the dual analyte optodes at two different O 2 concentrations (anoxic and air-saturated), Fig. 3B displays O 2 calibration data at two different pH values (4 and 8). The dashed curves in the panels represent hypothetical calibration curves if respective standard calibration fit functions were applied to the calibration data to calibrate the individual analytes. As can be seen from the graphs and especially from Fig. 3A, the fitted calibration curves fail to describe the calibration data well as there is cross-dependence in both calibrations. While most of the calibration data might be solved individually by conventional fit functions, the pH calibration under anoxic conditions as well as the interpolation of all other analyte combinations can hardly be solved by applying conventional analysis methods and calibration functions. However, it is important to note that the indicators chosen in this example show a spectral overlap and were specifically chosen to also demonstrate the limitations in selecting commonly used (available) indicators. By combining other indicators with less spectral overlap, this issue could be eliminated or reduced; this often requires the synthesis of specialized indicators, which for various reasons is not always possible.
52That is the point ML modeling comes into play as an alternative approach. The advantage of ML models lies in their capability of finding underlying patterns and parameter correlations in nested and interconnected datasets whose complexity and dimensionality are beyond human imagination. For the modeling, we decided to use the absolute fluorescence response of the dual analyte optode, as opposed to indicator are shown in the right panel. Note that the O 2 -sensitive sensor layer also contains macrolex fluorescent yellow as the reference dye. While in A, C, and D, the fluorescence intensity is displayed relative to the maximum intensity, in B, the intensity is displayed relative to the isosbestic point at 530 nm the usual approach in optical-chemical sensing, which uses ratiometric intensity relative to the reference indicator. Our decision was based on the fact that, in our tests, the former approach yielded slightly better results than the latter one.
53In the following, we first explain data extraction and preparation, which are a crucial step in modeling, and describe important aspects that can affect model performance. We then describe the process of model building and optimization, followed by a description and validation of the final model for simultaneous imaging of pH and dissolved O 2 . Especially during the validation step, the advantage of ML modeling becomes clear, but at each step, we emphasize the risks of bias that can impact the overall model performance. Scheme 1 provides an overview of the workflow with all processes conducted from initial data acquisition to the final machine learning model.
Data preparation
54The first key step in building a strong ML model is to provide a suitable dataset on which the algorithm can train and deduce an underlying (hidden) pattern. For a well-performing ML model, a suitable dataset means providing a large or even big set of samples that contain balanced and highquality information to follow the large numbers theorem [24,25,33]. Although it depends on the individual problem and its complexity, computer scientists argue that a rule of thumb is at least 1000 samples for a suitable dataset. In some cases, when the amount of data is not a limiting factor, researchers may apply dimension reduction techniques such as principal component analysis, factor analysis, or linear discriminant analysis to enhance information density and remove unwanted noise from random variables before applying further regression algorithms [34,35]. However, applying dimensional reduction techniques may also filter out relevant information for subsequent regression algorithms to find the underlying patterns. Therefore, we opted for an outlier removal test to ensure data quality instead of a dimension reduction technique. In addition, our preliminary tests (not shown here) demonstrated that this approach led to better results without sacrificing relevant information.
55Hence, to match the first requirement and extract a sufficiently large amount of spectral data from the optode image, we selected a homogeneous region of interest (RoI) from the optode calibration image. However, unlike the usual approach in optical chemical imaging, we did not average over a larger area of the optode but chose smaller sections of 5 × 5 pixels for the RoIs, cleaned the data from outliers with an interquartile range, and calculated the median average of each RoI. In this way, we obtained 7196 oxygen samples and 6476 pH samples while mitigating the noise of the optode images. A table has been compiled from these processed data, and the interested reader may download the calibration data from the publicly accessible repository Mendeley data [26].
56In the next step, we examined the distribution of sample points across calibration points to tailor the dataset to be balanced, i.e., each calibration point is almost equally represented in the dataset. This is critical to avoid bias in model accuracy and to prevent the model from being trained on a hidden bias that may stem from artifacts but has nothing to do with the actual feature correlations (overfitting). As can be seen in Fig. 4, the distribution of the sample data we obtained for each calibration point
Machine learning regression model
57When screening the literature for an appropriate machine learning algorithm, one comes across a great variety of machine learning algorithms applied to a wide range of topics and problems, including research questions in life and environmental sciences [1,2]. The field is constantly evolving, with new algorithms being introduced to solve increasingly complex problems in less time. Each of them with different strengths and potentials, but not all of them are applicable to every research question or sometimes even unnecessarily complex in terms of computational power or do not match the given data or problem at hand. Interested readers can read more about other ML models in the referenced publications [29,[33][34][35][36][37]. Subsequently, we describe how we selected and optimized an appropriate ML model based on the given dataset and validated its ultimate performance.
Model identification
58The measured calibration dataset is best described as a structured dataset summarizing the spectral responses of the dual analyte sensor along the entire wavelength between 470 and 900 nm at different pH and O 2 conditions. In addition to the spectral response of the dual analyte sensor (the so-called features of the dataset), the specific pH and O 2 concentrations during calibration are known. Thus, the calibration dataset can be described as a labeled, structured dataset with an additional target vector that allows the use of supervised ML algorithms. Another important point is that although the structured dataset provides discrete calibration points, it must be possible to obtain continuous results in subsequent measurements, which hence requires a regression model rather than a classification model. However, even though the problem can be narrowed down to a supervised regression problem by the given dataset, there remain a myriad of different approaches and algorithms. Moreover, since the dual analyte sensor is sensitive to two analytes simultaneously, the algorithm should reflect that and output both analyte information at the same time. Therefore, we decided to build a multi-layered ML model that first finds the pH that best fits a given spectral response of the dual analyte sensor and then iteratively finds a solution for dissolved O 2 . The reason for this order of the multi-layered model was that the dual analyte sensor appears to be more sensitive to changes in O 2 concentration, and cross-interactions that occur, such as FRET or alike, impact the overall sensor response more than changes in pH (see Fig. 3). Furthermore, please note that we used the absolute fluorescence spectra instead of the ratiometric ones, as is usually the case in optical chemical imaging [12].
59To now find the best ML regression algorithm, we have assessed different options and determined the performance of the overall model for the given data using different loss functions. For applied ML, the choice of the loss function can be very crucial and can lead to the favoring of different algorithms depending on where the focus lies for a given problem, i.e., whether, for example, accuracy is more relevant than sensitivity or selectivity of the sensor. One common way of describing the performance of a regression model is to determine its accuracy and dispersion in terms of mean absolute error (MAE) and root mean square error (RMSE), respectively [30]. However, while the performance measures of the dataset describe the overall performance of the algorithm for a given set, one cannot rule out that the data carry a hidden bias to which the algorithm mainly responds and trains. Thus, to prevent overfitting, the dataset is typically split into training and validation datasets. The former is used to train the model and describe the overall model performance, while the latter is used to comprehensively describe its performance on a dataset it has never seen before. Splitting the entire dataset is done using the standard split function of the Python package lmfit. This split function divides the dataset into random subsets according to Tables 1 and 2 give an overview of the performance measures of the different ML algorithms and for each individual analyte. As can be seen from Tables 1 and 2, there is not one regression algorithm that is best suited and provides optimal results for both analytes. However, the algorithms that perform best for both the training data and the validation data are the following regressors: decision tree (DT), random forest (RF), and XGBoost (XGB). Consequently, these three regressors were selected as potential candidates for the ML model, and their respective parameters were further optimized.
Model optimization
60To fine-tune the algorithm and optimize its performance, there are several set screws that define the algorithm, control its learning process, and constrain the algorithm in minimizing a predefined loss function. These so-called hyperparameters can be optimized in a process called hyperparameter optimization (HPO). This has been done for all three potential candidates and each analyte. Traditional approaches to HPO are either a parameter sweep, in which parameters are optimized by comprehensively enumerating all combinations over a manually specified subset of the hyperparameter space or a random search, in which a subset of parameter combinations is randomly defined [38]. The supplemental information provides a detailed summary of the HPO process of all three algorithms and both analytes, while Table 3 summarizes the final performance of the optimized algorithms using the same performance measures (MAE and RMSE) as described previously. Please note that the attached Excel file contains a detailed summary of all HPO processes, intended as a guide for readers new to ML modeling to be able to replicate the steps for model optimization. The Word document provides a summary of the most important intermediate results for a quick overview. Note that the Excel file provides very detailed information on the HPO process.
61As shown in Table 3, the optimal regression algorithm for pH prediction is the XGBoost regression algorithm, a scalable decision tree-based ensemble ML algorithm that uses a gradient boosting framework and provides a parallel tree boosting [39]. This is not surprising, since for small-to medium-sized structured data, XGBoost like all decision tree-based algorithms is considered to be the best performing. While the performance measures for pH prediction are clearly in favor of the XGBoost regression algorithm, this is less clear for dissolved O 2 prediction. We have therefore decided to use the XGBoost regression algorithm for the prediction of dissolved O 2 as well. Table 4 summarizes the optimized hyperparameter for each analyte yielding the performance metrics described before (Table 3).
Final ML model and model validation
62Upon performing several optimization and screening procedures, the final model for simultaneous detection of pH and dissolved O 2 using optical chemical sensors now consists of a two-layer ML model based on XGBoost algorithms. First, the pH value is predicted and, subsequently the O 2 concentration with conditional knowledge of the pH value. However, since the prediction of dissolved O 2 appeared to be rather uncertain, with some outliers and larger uncertainties, an additional ML layer using an XGBoost regression algorithm was used to iteratively optimize the O 2 prediction. Thus, the final ML model includes three XGBoost layers for pH and O 2 prediction. The final algorithm can be downloaded from GitHub (github.com/silviaelisabeth/ ML_for_pHandO2) and is freely available. As mentioned several times in this publication, the validation of an ML model is crucial in the building process to ensure its accuracy and to prevent any bias in the dataset. Besides validation by one-time sub-sampling, as performed previously, another option is cross-validation [36]. Crossvalidation is a resampling method that uses either individual samples or a larger subsample from the entire dataset to validate a model on different iterations. During the validation process, the subsamples are removed from the training dataset to avoid a prediction bias. Due to this, however, cross-validation requires more computational power than validation by one-time sub-sampling; but it also assesses the performance of the model much more accurately. An extremely accurate but, due to the large size of our dataset, computational intense cross-validation would be a leaveone-out cross-validation in which all possible combinations are trained and tested. Consequently, a good balance between these two approaches, validation by one-time subsampling or validation by leave-one-out cross-validation, would thus be k-fold cross-validation, a non-exhaustive cross-validation in which the dataset is randomly partitioned in k equally sized subsamples. While one of the k subsamples is used as validation data, the remaining subsamples are used as training data. This process is then repeated k times. In ML modeling, it is common practice to perform 10-fold cross-validation [36]. Subsequent to cross-validation, MAE and RMSE can be determined as performance metrics as described before. A summary of the validation process for the ML model is listed in Table 5, while detailed information about the variance of predicted and target pH and dissolved O 2 , respectively, can be found in the supplemental information. In order to illustrate the benefits of iterative O 2 prediction, we listed in Table 5 the performance metrics for the initial O 2 prediction as well as the performance metrics after adding the additional layer for iterative O 2 prediction. Please note that 10-fold cross-validation indicates the minimum performance of a model, whereas the true performance of the model is better and achieves lower dispersions.
63As can be seen from Table 5, the iterative process of O 2 prediction leads to particularly small performance measures with a mean absolute error of < 4.50·10 −2 (compared to < 1.57 for non-iterative O 2 prediction) and a root mean squared error of < 2.12·10 −1 (< 1.25 previously). This reduces the uncertainty of the O 2 prediction on average to the third decimal.
64As described in the supplemental information (cf. Section 4), the iterative approach for prediction of dissolved O 2 helps circumvent potential reabsorption and interference artifacts. In contrast, the performance measures for pH prediction are significantly worse, with mean absolute error and root mean square error of < 1.96·10 −1 and < 4.42·10 −1 , respectively. Thus, a prediction of pH is on average less accurate with this model and varies in the first decimal. A detailed discussion of the deviation of the predicted pH values compared to the target pH values can be found in the supplemental information (see Section 3). As shown in Fig. 5, as well as in Figure·S2 and Figure·S3, the deviations occur mainly at lower pH values when reabsorption effects and indicator interactions are more dominant. Furthermore, it should be noted that although the calibration is performed over the entire pH range, the dynamic range of the pH sensing layer is, however, limited to a range of ± 2 pH units around the pK a value, i.e., a range between 5 and 9. pH values outside this range are not considered
Conclusion
65We have developed a novel approach to multi-analyte optical chemical imaging in 2D using a machine learning model and outlined the building process of the multi-layered ML model for complex and coupled data. While the dual analyte optode calibration data for simultaneous imaging of pH and dissolved O 2 cannot be explained by conventional multivariate analysis methods, machine learning algorithms have proven useful. Consequently, we were able to build a threelayered model with individual pH and iterative O 2 prediction based on a decision tree-based algorithm (the so-called XGBoost). Figure 5C-D illustrates the conversion of the absolute fluorescence intensity emitted by the optode to the corresponding pH and concentration of dissolved O 2 in each pixel. While the dissolved O 2 can thus be predicted with an average error of < 0.045 (MAE) and < 0.212 (RMSE), pH is predicted with an average error of < 0.196 (MAE) or < 0.442 (RMSE), respectively. In other words, the iterative prediction of dissolved O 2 works excellently, while the pH prediction can be improved, if necessary, as shown in the discussion. While our contribution demonstrates the advantages of ML models for nested and intercoupled datasets that cannot be solved with conventional statistical models, we Overall model performance for predicting the pH (A) and dissolved O 2 concentration (B), respectively, assessed against test data that the algorithm has never seen before. The main plot compares the predicted and the respective target values for the entire calibration range using the multi-layered ML model based on XGBoost. The insets of each panel display the dispersion around the target value as black dotted markers. The target value is indicated as an orange solid line. C and D display examples of optode images before and after data analysis. C shows the absolute fluorescence intensity of the dual analyte optode is visualized at 773 nm, whereas D shows the chemical images in which the absolute fluorescence intensity has been translated into the corresponding pH and O 2 concentration (in hPa) to represent them in each pixel also highlighted the risks during the ML model process. For each process step during ML model development, we highlighted different risks that researchers should consider when building their own ML model, including data preparation (outlier test vs. dimension reduction), establishing a balanced training dataset and identifying and validating an appropriate ML model for the question at hand. Researchers need to be aware that while it is inherent to ML models to find patterns, it is our responsibility to not indulge into p-hacking or data dredging and follow patterns that in reality do not exist.
66Despite the risks that come with ML modeling, we should dare and bring data analysis out of its shadowy existence. We should give it due attention if we want to advance multi-analyte imaging. In particular from a practical aspect, this approach appears very appealing. ML can help construct multi-analyte sensors using already existing indicators and circumvents the need to find indicators that have limited spectral overlap or other types of interactions. Converting acquired images into quantitative data is often cumbersome and not simple, especially when additional signal deconvolution is required. ML algorithms clearly show advantages in deciphering intercoupled datasets with high dimensionality and complexity, where human imagination and conventional methods fail in finding the underlying correlations. However, we must not blindly use any ML algorithm but also be aware of the possible biases and risks when setting up training and validation data. Funding Open access funding provided by Royal Danish Library The study was supported by a research grant from the Grundfos Foundation and a Sapere Aude from the Independent Research Fund Denmark (IRFD) (DFF-8048-00057B).
Conflict of interest The authors declare no competing interests.
67Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.
참고문헌 36건
- A simple and inexpensive high resolution color ratiometric planar optode imaging approach: application to oxygen and pH sensing. Limnology and Oceanography Methods · Wiley · 2011 10.4319/lom.2011.9.348
- Guide to the Expression of Uncertainty in Measurement Cambridge University Press eBooks · Cambridge University Press · 2013 10.1017/cbo9781139135085.018
- Simultaneous multi-analyte determination of estrone, isoproturon and atrazine in natural waters by the RIver ANAlyser (RIANA), an optical immunosensor Biosensors and Bioelectronics · Elsevier BV · 2003 10.1016/s0956-5663(03)00255-0
- Heterogeneity in biofilms: Table 1 FEMS Microbiology Reviews · Oxford University Press · 2000 10.1111/j.1574-6976.2000.tb00565.x
- Physiological heterogeneity in biofilms Nature Reviews Microbiology · Nature Portfolio · 2008 10.1038/nrmicro1838
- <title>Miniaturized integrated optic chemical sensors for environmental monitoring and remediation</title> Proceedings of SPIE, the International Society for Optical Engineering/Proceedings of SPIE · SPIE · 1996 10.1117/12.260580
- Fluorescent poly(styrene-block-vinylpyrrolidone) nanobeads for optical sensing of pH Sensors and Actuators B Chemical · Elsevier BV · 2008 10.1016/j.snb.2008.08.028
- Low cost referenced luminescent imaging of oxygen and pH with a 2-CCD colour near infrared camera The Analyst · Royal Society of Chemistry · 2014 10.1039/c4an00783b
- Methodology for real‐time, multianalyte monitoring of fermentations using an <i>in‐situ</i> mid‐infrared sensor Biotechnology and Bioengineering · Wiley · 2003 10.1002/bit.10618
- Evaluation of Measurement Uncertainty Based on the Propagation of Distributions Using Monte Carlo Simulation Measurement Techniques · Springer Science+Business Media · 2003 10.1023/b:mete.0000008439.82231.ad
- Evaluation of the Paratrend Multi-Analyte Sensor for Potential Utilization in Long-Duration Automated Cell Culture Monitoring Biomedical Microdevices · Springer Science+Business Media · 2004 10.1023/b:bmmd.0000042054.02940.b6
- Point of Care Diagnostics: Status and Future Analytical Chemistry · American Chemical Society · 2011 10.1021/ac2030199
- The Elements of Statistical Learning: Data Mining, Inference, and Prediction Journal of the Royal Statistical Society Series A (Statistics in Society) · Royal Statistical Society · 2010 10.1111/j.1467-985x.2010.00646_6.x
- XGBoost 2016 10.1145/2939672.2939785
- Design and Application of an Optical Sensor for Simultaneous Imaging of pH and Dissolved O<sub>2</sub> with Low Cross-Talk ACS Sensors · American Chemical Society · 2016 10.1021/acssensors.6b00071
- Principles of Fluorescence Spectroscopy 2006 10.1007/978-0-387-46312-4
- Comparison of methods for wavelength combination selection from multi-wavelength fluorescence spectra for on-line monitoring of yeast cultivations Analytical and Bioanalytical Chemistry · Springer Science+Business Media · 2016 10.1007/s00216-016-9823-2
- Nanoparticle- and microparticle-based luminescence imaging of chemical species and temperature in aquatic systems: a review Microchimica Acta · Springer Science+Business Media · 2019 10.1007/s00604-018-3202-y
- Applied Machine Learning Springer eBooks · Springer Nature · 2019 10.1007/978-3-030-18114-7
- Multi-Task Learning for Multi-Dimensional Regression: Application to Luminescence Sensing Applied Sciences · Multidisciplinary Digital Publishing Institute · 2019 10.3390/app9224748
- TADF-Emitting Zn(II)-Benzoporphyrin: An Indicator for Simultaneous Sensing of Oxygen and Temperature ACS Sensors · American Chemical Society · 2020 10.1021/acssensors.9b02512
- Deep Learning on Three-Dimensional Multiscale Data for Next-Hour Tornado Prediction Monthly Weather Review · American Meteorological Society · 2020 10.1175/mwr-d-19-0372.1
- Machine Learning‐Enabled Smart Sensor Systems Advanced Intelligent Systems · Wiley · 2020 10.1002/aisy.202000063
- Visualizing NH3 emission and the local O2 and pH microenvironment of soil upon manure application using optical sensors Environment International · Elsevier BV · 2020 10.1016/j.envint.2020.106080
- Dual Oxygen and Temperature Luminescence Learning Sensor with Parallel Inference MDPI (MDPI AG) · Multidisciplinary Digital Publishing Institute (Switzerland) · 2020 10.3390/s20174886
- Hyperspectral Luminescence Imaging in Combination with Signal Deconvolution Enables Reliable Multi-Indicator-Based Chemical Sensing ACS Sensors · American Chemical Society · 2020 10.1021/acssensors.0c02084
- Optode Based Chemical Imaging—Possibilities, Challenges, and New Avenues in Multidimensional Optical Sensing ACS Sensors · American Chemical Society · 2021 10.1021/acssensors.1c00480
- Machine learning methods in drug delivery Elsevier eBooks · Elsevier BV · 2021 10.1016/b978-0-12-821092-5.00007-3
- MEMES: Machine learning framework for Enhanced MolEcular Screening Chemical Science · Royal Society of Chemistry · 2021 10.1039/d1sc02783b
- Automated Machine Learning The Springer series on challenges in machine learning · Springer International Publishing · 2019 10.1007/978-3-030-05318-5
- Robust Dual Optical Sensor for pH and Dissolved Oxygen ACS Sensors · American Chemical Society · 2022 10.1021/acssensors.2c00242
- Advanced multimodal solid-state optochemical pH and dual pH/O2 sensors for cell analysis Sensors and Actuators B Chemical · Elsevier BV · 2022 10.1016/j.snb.2022.132486
- Online 2D Fluorescence Monitoring in Microtiter Plates Allows Prediction of Cultivation Parameters and Considerable Reduction in Sampling Efforts for Parallel Cultivations of Hansenula polymorpha Bioengineering · Multidisciplinary Digital Publishing Institute · 2022 10.3390/bioengineering9090438
- Principles of Chemical Sensors Springer eBooks · Springer Nature · 2009 10.1007/b136378
- A visual detection strategy for SARS-CoV-2 based on dual targets-triggering DNA walker Sensors and Actuators B Chemical · Elsevier BV · 2022 10.1016/j.snb.2022.133252
- Hyperspetral fluorescence images of an pH+O2 dual-analyte optical chemical sensor 2023 10.17632/zchkwzh3kk.1