Applied Science, Faculty of
Engineering, School of (Okanagan)
DSpace
UBCO
Rincón Remolina, María Claudia
Master of Applied Science - MASc
University of British Columbia
Approximately 1.4 billion m³ of fluid tailings produced from oil sands mining operations are currently being held in Alberta, Canada and pose a significant risk to the environment if not properly treated and managed. The ability to quantify levels of toxic compounds present in oil sands tailings, such as naphthenic acids (NAs), phenol, and polycyclic aromatic hydrocarbons (PAHs), is required to ensure the protection of the surrounding aquatic environment. In this thesis, machine learning techniques are applied to rapidly detect toxic contaminants from the production of petroleum products and crude oil extraction in natural surface waters. The first study implemented modern neural network structures for improving supervised regression of NA and phenol concentrations in water. Multilayer perceptron (MLP) and convolutional neural networks (CNN) were both capable of identifying relevant spectral features of the pollutants and were accurate in estimating concentrations in the presence of background interference from organic matter in natural waters. NAs were relatively easy to detect by MLP and CNN, however, deep CNNs resulted in optimized performance for phenol with mean absolute errors (MAE) of 1.78 – 1.81 mg/L and 4.68 - 5.41 µg/L for NAs and phenol, respectively. Visualization of spectral areas of importance revealed that both MLPs and deep CNNs utilized logical regions of the fluorescence spectra associated with NAs and phenol signals. The second study aimed to improve available methods for in situ quantification of NA, phenol, pyrene, and fluoranthene concentrations in natural waters. An augmentation network that fuses data from field and lab-based optical measures was used to improve the quality of field measurements. NAs, fluoranthene and pyrene were easy to quantify by the augmentation network, however, performance for phenol was more challenging due to the low intensity of the signal and overlap with other more dominant signals from NAs. Detection and quantification of phenol was optimized by the augmentation network proposed compared to standard in situ methods such peak-picking (peak-picking MAE of 30.48 µg/L, augmentation network MAE of 8.30 µg/L). Finally, an unsupervised approach to detecting pollutants in water was investigated, where no knowledge of contaminant levels is needed to train the model. A variational autoencoder was used to reduce data dimensionality and, through unsupervised methods, NAs and phenol could be identified in natural surface waters. According to the unsupervised classification methods, water samples contaminated with only NAs had the highest accuracy scores. The model classified water samples contaminated with NAs and phenol as if they were only contaminated with NAs, since NAs signals overshadowed phenol signals.
MACHINE LEARNING APPLIED FOR CONTAMINANT DETECTION IN NATURAL SURFACE WATER by María Claudia Rincón Remolina B.Sc., Universidad Industrial de Santander, 2020 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE in THE COLLEGE OF GRADUATE STUDIES (Civil Engineering) THE UNIVERSITY OF BRITISH COLUMBIA (Okanagan) February 2023 © María Rincón, 2023 ii The following individuals certify that they have read, and recommend to the College of Graduate Studies for acceptance, a thesis entitled: Machine learning applied for contaminant detection in natural surface water submitted by Maria Claudia Rincon Remolina in partial fulfillment of the requirements of the degree of Master of Applied Science. Dr. Nicolas Peleato, School of Engineering Supervisor Dr. Anas Chaaban, School of Engineering Supervisory Committee Member Dr. Alyse Kiesser, School of Engineering Supervisory Committee Member Dr. Liwei Wang, School of Engineering University Examiner iii Abstract Approximately 1.4 billion m3 of fluid tailings produced from oil sands mining operations are currently being held in Alberta, Canada and pose a significant risk to the environment if not properly treated and managed. The ability to quantify levels of toxic compounds present in oil sands tailings, such as naphthenic acids (NAs), phenol, and polycyclic aromatic hydrocarbons (PAHs), is required to ensure the protection of the surrounding aquatic environment. In this thesis, machine learning techniques are applied to rapidly detect toxic contaminants from the production of petroleum products and crude oil extraction in natural surface waters. The first study implemented modern neural network structures for improving supervised regression of NA and phenol concentrations in water. Multilayer perceptron (MLP) and convolutional neural networks (CNN) were both capable of identifying relevant spectral features of the pollutants and were accurate in estimating concentrations in the presence of background interference from organic matter in natural waters. NAs were relatively easy to detect by MLP and CNN, however, deep CNNs resulted in optimized performance for phenol with mean absolute errors (MAE) of 1.78 – 1.81 mg/L and 4.68 - 5.41 µg/L for NAs and phenol, respectively. Visualization of spectral areas of importance revealed that both MLPs and deep CNNs utilized logical regions of the fluorescence spectra associated with NAs and phenol signals. The second study aimed to improve available methods for in situ quantification of NA, phenol, pyrene, and fluoranthene concentrations in natural waters. An augmentation network that fuses data from field and lab-based optical measures was used to improve the quality of field measurements. NAs, fluoranthene and pyrene were easy to quantify by the augmentation network, however, performance for phenol was more challenging due to the low intensity of the signal and overlap with other more dominant signals from NAs. Detection and quantification of iv phenol was optimized by the augmentation network proposed compared to standard in situ methods such peak-picking (peak-picking MAE of 30.48 µg/L, augmentation network MAE of 8.30 µg/L). Finally, an unsupervised approach to detecting pollutants in water was investigated, where no knowledge of contaminant levels is needed to train the model. A variational autoencoder was used to reduce data dimensionality and, through unsupervised methods, NAs and phenol could be identified in natural surface waters. According to the unsupervised classification methods, water samples contaminated with only NAs had the highest accuracy scores. The model classified water samples contaminated with NAs and phenol as if they were only contaminated with NAs, since NAs signals overshadowed phenol signals. v Lay Summary This thesis contributes several new ideas to quickly identify when natural waters have been impacted by potentially toxic wastewater from oil sands operations. Toxic contaminants produced during oil extraction represent a major environmental and human health risk. An example is the recent event in Iqaluit, where undetected fuel contamination affected the city’s drinking water system for two months. Standard methods for quantifying toxic contaminants in natural water are costly and time-consuming, which limits the ability to detect sudden and unexpected contamination. Fluorescence spectroscopy is a promising technique for detecting signals related to contaminants in natural water. However, conventional methods to interpret fluorescence data and separate the signals of interest from background noise require expert supervision and are labour-intensive. The lack of strategies to detect these toxic contaminants rapidly and efficiently was the motivation for this thesis to implement machine learning techniques to process optical water quality measurements, such as fluorescence spectroscopy. Through this approach, it is hoped that machine learning techniques will reduce the expert supervision needed to separate the signals of interest and provide a cheap, easy, and fast way to provide feedback on potential spills or impacts. vi Preface This thesis is based on the research work completed in the School of Engineering at the University of British Columbia, Okanagan, under the supervision and guidance of Dr. Nicolás Peleato. All published works are included in this thesis. Chapter 3 is based on the following published paper and used with permission of Journal of Hazardous Materials: • Remolina, M. C. R., Li, Z., & Peleato, N. M. (2022). Application of machine learning methods for rapid fluorescence-based detection of naphthenic acids and phenol in natural surface waters. Journal of Hazardous Materials, 430, 128491. Chapter 4 is based on the following published paper and used with permission of Springer. It was also presented at BCWWA 2022 Annual Conference & Trade Show in Victoria, BC, and the AWWA 2022 Water Quality Technology Conference in Cincinnati, OH. • Rincón Remolina, M. C., & Peleato, N. M. (2023). Augmentation of field fluorescence measures for improved in situ contaminant detection. Environmental Monitoring and Assessment, 195(1), 1-13. vii Table of Contents Abstract ................................................................................................................................... ii Lay Summary .......................................................................................................................... v Preface .................................................................................................................................. vi Table of Contents .................................................................................................................. vii List of Tables ........................................................................................................................... x List of Figures ........................................................................................................................ xi List of Acronyms................................................................................................................... xiii Acknowledgements .............................................................................................................. xiv Dedication ............................................................................................................................. xv Chapter 1: Introduction ........................................................................................................... 1 1.1 Motivation ................................................................................................................... 1 1.2 Literature Review ........................................................................................................ 2 1.2.1 Contaminant monitoring ............................................................................................ 2 1.2.2 Fluorescence spectroscopy for water quality monitoring ........................................... 3 1.2.2.1 Fluorescence spectroscopy for rapid quantification of toxic contaminants ....... 5 1.2.2.2 Fluorescence data pre-processing .................................................................. 6 1.2.3 Field measurements for contaminant detection ......................................................... 8 1.2.4 Machine learning for contaminant detection .............................................................. 9 1.3 Research gaps ..........................................................................................................13 1.4 Objectives ..................................................................................................................15 Objective 1: Improve the accuracy of prediction of the concentration of toxic compounds in natural water with variable background water quality, by applying machine learning techniques to process fluorescence data. ..........................................................................15 viii Objective 2: Improve the accuracy in the prediction of the concentration of toxic contaminants in field, by applying a data fusion method that combines field and lab measurements. .................................................................................................................16 Objective 3: Propose an unsupervised learning method for rapid contaminant detection in natural surface water when labelled data is not available. .................................................17 Chapter 2: Methods ...............................................................................................................18 2.1 Samples and mixing experiments ..............................................................................18 2.2 Fluorescence .............................................................................................................19 2.3 Artificial Neural Networks ...........................................................................................20 2.3.1 Multilayer perceptron (MLP) .....................................................................................20 2.3.2 Convolutional neural networks (CNNs) ....................................................................21 2.4 Data fusion between field and lab measurements ......................................................22 2.4.1 Generation of the EEMs and estimating pollutant concentrations ............................22 2.4.2 Comparison with other methods ..............................................................................26 2.5 Unsupervised classification........................................................................................28 2.5.1 Convolutional variational autoencoder .....................................................................28 2.5.2 Reduction of the EEM ..............................................................................................29 2.5.3 Comparison with other methods ..............................................................................32 Chapter 3: Application of Machine Learning Methods for Rapid Fluorescence-based Detection of Naphthenic Acids and Phenol in Natural Surface Waters ..................................33 3.1 Deep and convolutional networks ..............................................................................33 3.2 Visualizing network attention .....................................................................................37 3.3 Summary ...................................................................................................................41 Chapter 4: Augmentation of field fluorescence measures for improved in-situ contaminant detection ...............................................................................................................................42 4.1 Peak picking and full EEMs .......................................................................................43 ix 4.2 Analysis of the regions ...............................................................................................44 4.3 Estimation of contaminant concentration ...................................................................47 4.4 Relationship between concentration accuracy and generated EEMs accuracy ..........50 4.5 Summary ...................................................................................................................52 Chapter 5: Unsupervised classification of toxic contaminants in natural surface waters ........54 5.1 Variational autoencoder .............................................................................................55 5.2 PCA and conventional autoencoder ...........................................................................60 5.3 Summary ...................................................................................................................63 Chapter 6: Conclusions .........................................................................................................64 6.1 Summary of contributions ..........................................................................................64 6.2 Limitations .................................................................................................................67 6.3 Future Research ........................................................................................................68 Bibliography ..........................................................................................................................70 x List of Tables Table 1. ex/em pairs from the peak picking method in Otonabee River and Okanagan Lake ....27 Table 2. Mean absolute error according to the number of intensities chosen and the type of model used between linear regression (LR) and multilayer perceptron (MLP). ..........................44 Table 3. Summary of the Rand score obtained according to the each reduction dimensionality technique. .................................................................................................................................61 xi List of Figures Figure 1. A sketch of the Rayleigh scattering occurring in an EEM. ............................................ 8 Figure 2. a) NA standard and b) phenol Milli-Q® pure water. ....................................................19 Figure 3. General schematic of MLP. The number of hidden layers vary with every model. ......21 Figure 4. General schematic of convolutional neural network structure. ....................................22 Figure 5. Flowchart of the generation of the augmentation networks and the estimation of the contaminants. ...........................................................................................................................26 Figure 6. Structure of the Convolutional Variational Autoencoder (CVAE). ................................29 Figure 7. Flowchart of the CVAE and classification of the EEM according to the water samples contaminated with NAs or phenol. .............................................................................................32 Figure 8. Mean absolute error for NAs and Phenol, according to the number of layers in Okanagan Lake and Mission Creek. .........................................................................................34 Figure 9. Mean absolute error of NAs and phenol with respect to the number of convolutional layers used in Okanagan Lake and Mission Creek. A max pooling layer was included after every 3 convolutional layers. ...............................................................................................................37 Figure 10. Heat maps from random occlusion of variable importance for MLPs prediction of a) NAs in Okanagan Lake, b) Phenol in Okanagan Lake, c) NAs in Mission Creek, d) Phenol in Mission Creek. ..........................................................................................................................39 Figure 11. Heat maps from random occlusion of variable importance for CNN prediction of a) NAs in Okanagan Lake, b) Phenol in Okanagan Lake, c) NAs in Mission Creek, d) Phenol in Mission Creek. ..........................................................................................................................40 Figure 12. Division of the EEMs and ex/em pairs chosen in each region in (left) Otonabee River and (right) Okanagan Lake........................................................................................................45 Figure 13. Frequency each region was chosen for the detection of a) NAs, b) phenol, c) fluoranthene, and d) pyrene. .....................................................................................................46 xii Figure 14. Mean absolute error for contaminant detection according to the number of inputs used to generate the EEMs for naphthenic acids and phenol (left) and fluoranthene and pyrene (right). . .....................................................................................................................................49 Figure 15. Original vs predicted EEMs for Otonabee River. ......................................................51 Figure 16. Graphics at the top correspond to the fluorescence spectra at ex=235 nm in Otonabee River of the original and predicted EEMs using a) 3 inputs, b) 4 inputs, and c) 9 inputs to generate the EEMs. ..............................................................................................................52 Figure 17. Total loss and Rand score according to the B value implemented, and the dropout rate. ..........................................................................................................................................56 Figure 18. Encoded representation of the CVAE, and the centers obtained by the K-means method to classify the data........................................................................................................58 Figure 19. Matrix of the continuous distribution of the EEMs produced by the decoder part of the CVAE. .......................................................................................................................................60 Figure 20. Visualization of the encoded representation of the EEMs according to the dimensionality reduction technique implemented. ....................................................................62 xiii List of Acronyms ANN – Artificial Neural Networks. CNN – Convolutional Neural Networks. CVAE – Convolutional Variational Autoencoder. EEM – Excitation-Emission Matrix. ELU – Exponential Linear Units. IFE – Inner Filter Effect. MAE – Mean Absolute Error. MIG – Mutual Information Gap. MLP – Multilayer Perceptron. MSQ – Mean Squared Error. NA – Naphthenic Acids. NOM – Natural Organic Matter. OSPW – Oil Sands Processed-Affected Water. PAHs – Polycyclic Aromatic Hydrocarbons. PARAFAC – Parallel Factor Analysis. PCA – Principal Component Analysis. R2 – Coefficient of Determination. ReLU – Rectified Linear Units. VAE – Variational Autoencoder. xiv Acknowledgements I am deeply grateful to my supervisor Dr. Nicolas Peleato for being the best professor I have ever had. He gave me all the guidance, advice, and knowledge I needed to succeed during my studies at the University of British Columbia. Dr. Nicolas encouraged me to never stop learning and to always push myself towards excellence. Thank you for all your help. xv Dedication I dedicate this thesis to my parents and my brothers. Thank you for loving me unconditionally and for never being more than a phone call away. Specially to Jose and Kristel for welcoming me in their home and giving me all the love and support I needed. Last but not least, to Hunter for always being by my side loving me and keeping me company. 1 Chapter 1: Introduction 1.1 Motivation The production of petroleum products and crude oil extraction is a significant potential source of pollutants, including hazardous and toxic contaminants such us polycyclic aromatic hydrocarbons (PAHs), naphthenic acids (NAs) and phenol (Li et al., 2017). A sudden release of these compounds is also possible from loss of containment events when these products are stored or transported. According to the United States Environmental Protection Agency, polycyclic aromatic hydrocarbons (PAHs) are classified as prime concern contaminants to be regulated in aquatic ecosystems (Keith, 2015). Many PAHs threaten public health due to their toxic and carcinogenic properties (Abdel-Shafy and Mansour, 2016) and can cause a food chain imbalance (Foo and Hameed, 2010). Petroleum spills and oil refineries are some of the primary sources of PAHs contamination, with the major PAH species being emitted, including fluoranthene and pyrene (Canet et al., 2001; Tang et al., 2005). NAs and phenol are present in the wastewater produced during the water-heavy process for oil extraction from bituminous sands. Industry reporting has indicated year-to-year growth of held fluid tailings in Alberta, with current estimates of approximately 1.4 billion m3 as of 2020 (Alberta Energy Regulator 2021). A large amount of wastewater or oil sands processed-affected water (OSPW) is stored in surface ponds, and there is a risk of infiltration or unplanned release of NAs and phenol to surface water systems from these ponds (Barrow et al., 2009). When organisms are exposed to NAs and phenol, their health can be compromised due to physiological problems, immunological malfunction, and impaired reproduction (Kavanagh et al., 2012; Rogers et al., 2002; Almeda et al., 2013). Recent events, such as the undetected fuel contamination of Iqaluit’s drinking water, showed that the rapid detection of these toxic contaminants in natural surface waters is needed to protect public health and the aquatic environment. 2 This thesis proposes several new methods based on machine learning and fluorescence spectroscopy for rapid contaminant detection. The developed methods can be used to detect and quantify NAs, phenol, and the PAHs fluoranthene and pyrene in natural surface waters, at environmentally relevant concentrations. Furthermore, natural surface waters were used as background water to explicitly address the influence of background water quality, such as from natural organic matter, on observed signals. 1.2 Literature Review 1.2.1 Contaminant monitoring The Athabasca basin in northeastern Alberta is one of the largest reserves of hydrocarbons in the world, with approximately 700 billion barrels of bitumen (Alberta Energy, 2017). After the extraction process, a toxic mixture of organic and inorganic constituents called Oil sands process water (OSPW) is generated and stored in tailings ponds. Toxic components such as naphthenic acids, phenol, and polycyclic aromatic hydrocarbons are present in the OSPW, and represent a major risk to the environment and human health (Kavanagh et al., 2012; Rogers et al., 2002; Almeda et al., 2013, Panel, 2010). Thus, it results necessary to monitor water sources near the tailing ponds. Conventional methods to characterize these toxic components include liquid chromatography or gas chromatography coupled to mass spectrometry (Madison et al., 2020; Yang et al., 2019; Ross et al., 2012; Frank et al., 2014; Sun et al., 2017). In 2012, Ross et al. used ultra-high performance liquid chromatography time-of-flight mass spectrometry for quantification of classical and oxidized NA to obtain knowledge of the occurrence, composition, and transfer of NAs in the groundwater of the Alberta oil sands operation area. They found two tributaries to the Athabasca River (Beaver River and McLean Creek) as possibly receiving OSPW seepage. Frank et al., 2014 used orbitrap mass spectrometry (Orbitrap-MS) to investigated and compared profiles of acid-extractable organics (AEOs) for OSPW and groundwater and suggested that that OSPW-affected groundwater may reach Athabasca River. 3 In 2017, Sun et al., used Orbitrap-MS analyses to characterize NAs and other dissolved organics in Athabasca River. Results did not show evidence of bitumen-derived organics at any location in the river mainstem surface but showed high concentrations of NAs Athabasca’s groundwater and tributary river. These methods for contaminant characterization require several processes of sample treatment, which are costly and time-consuming. There is the need for improving monitoring to asses potential impacts of the OSPW on freshwater resources (Brook et al. 2019). 1.2.2 Fluorescence spectroscopy for water quality monitoring Fluorescence spectroscopy is a fast and promising optical method that can characterize and quantify organic compounds and contaminants in the water. Fluorescence refers to the emission of electromagnetic radiation, caused by excitation of atoms in a material. In excited singlet states, the electron in the excited orbital is paired to the second electron in the ground-state orbital. Then, the electron in the excited states returns to the ground state rapidly by the emission of a photon (Lakowicz, 2006). A fluorescence emission spectrum is a plot of the fluorescence intensity versus emission wavelength, upon a fixed excitation wavelength. Fluorescence excitation-emission matrices (EEMs) are obtained when fluorescence intensities are measured at iterated excitation and emission wavelengths. The peak locations showed by the EEM indicate the type of compounds emitting the fluorescence, and the locations can be cross-referenced with previous studies to identify the specific type of compounds. The peak intensity of a compound is related to its concentration. However, in natural water samples many other compounds, such as humic-like compounds, interfere the fluorophore studied, making it difficult to estimate the exact concentration (Hudson et al., 2007). The background of natural organic matter (NOM) is always present in natural surface waters. It refers to the complex mixture of organic compounds such us humic acids, fulvic acids, 4 low molecular weight organic acids, carbohydrates, proteins, and other compound classes. Fluorescence spectroscopy is a widely report technique to track NOM change and behavior (Bridgeman et al., 2011; Murphy et al., 2014a). High dimensional fluorescence excitation-emission matrices (EEMs) measured at iterated excitation and emission wavelengths can be used to identify distinct types of organic matter. Compared with information provided by ultraviolet (UV) light, the EEMs contains more dimensional information and has a more sensitive performance in detecting low-concentration organic matter (Anumol et al., 2015; Sgroi et al., 2018). Many previous studies have reported the varying degrees of success of EEM-based models for observing the behavior of organic matter in natural, waste, or drinking waters. Detection of pollutants in natural surface waters is challenging since many contaminants fluoresce in similar spectral regions and overlap with background signals from NOM fluorophores such as humic or fulvic acids that are present in relatively high concentrations (Korak et al. 2014). The quantity and composition of these overlapping NOM fluorophores changes over short and long timescales and is affected by high seasonal variability. As a result, the variability in background fluorescence could result in overestimation or underestimation of contaminant concentrations. Furthermore, toxic compounds relevant to OSPW (e.g., NAs and phenol) fluoresce in highly similar spectral regions, making them highly convoluted with each other and difficult to distinguish. Previous studies have investigated the use of fluorescence for organic pollutant detection including polycyclic aromatic hydrocarbons, pesticides, and phenol using a variety of data analysis methods (Yang et al. 2016, 2019; Driskill et al. 2018; Mirnaghi et al. 2018). A few studies have investigated fluorescence-based detection of NAs in pure water (Mohamed et al. 2008; Lu et al. 2013) or directly in OSPW (Kavanagh et al. 2009). While fluorescence may not be able to resolve the specific composition of NAs, results indicate it could serve as a rapid screening tool to assess overall concentrations (Lu et al. 2013; Headley et al. 2013). However previous studies have not investigated the viability of fluorescence-based 5 measures applied to natural waters, and significant challenges pertaining the interference of background natural organic matter (NOM) signals and other organic pollutants remain. 1.2.2.1 Fluorescence spectroscopy for rapid quantification of toxic contaminants Conventional methods to quantify fluoranthene, pyrene, NAs, and phenol include liquid chromatography or gas chromatography coupled to mass spectrometry (Hsu et al., 2000; Lu et al., 2013; Mohamed et al., 2008). However, these methods require several processes of sample treatment, which are costly and time-consuming (Vuckovic, 2012; Yang et al., 2019). Fluorescence spectroscopy combined with dimensionality reduction techniques such as parallel factors analysis (PARAFAC), principal component analysis (PCA) and peak-picking analysis have also been implemented for quantification and screening purposes by Mirnaghi et al. (2018), Yang et al. (2016), Yang et al. (2021), Wasswa et al. (2019), Li et al. (2020), and Li and Peleato (2021). EEMs consist of thousands of individual points, so dimensionality reduction techniques are implemented to separate fluorophores from the NOM background. PARAFAC analysis uses the alternating least squares (ALS) for trilinear decomposition (Bro, 1997), to separate the real underlying chemical spectra. Different from PARAFAC, PCA is a two-way method, which requires data to be unfolded prior to analysis (Bro, 1997). PCA reduces the data to a set of linear uncorrelated features using orthogonal transformations, which are useful for statistical modelling (Murphy, 2012). Peak picking analysis is the most straightforward method for real-time fluorescence monitoring. However, overlapping signals from NOM background, can affect the linear relationship between the peak fluorescence intensities and the concentration levels (Yu et al., 2015). Improved quantification accuracy of polycyclic aromatic hydrocarbons and pesticides has been found when using PARAFAC or PCA, particularly to account for changes in background NOM fluorescence (Ferretto et al. 2014; Mirnaghi et al. 2018; Yang et al. 2019). However, PARAFAC can be cumbersome to implement and identified components that are source specific, limiting the flexibility of this approach for routine contaminant monitoring 6 and requires source-specific calibration (Li and Peleato 2021). Furthermore, potential interactions between contaminants and NOM, such as charge-transfer, or fluorescence dependency on pH may break PARAFAC’s underlying assumption of tri-linear data (Bridgeman et al. 2011; Sharpless and Blough 2014). In the case of peak-picking, this method only focuses on the key wavelengths and neglects the possible overlapping with background NOM or distinct organic compounds with similar fluorescence structures (Korak et al. 2014; Yu et al. 2015). Additionally, traditional modelling approaches that utilize peak signals, such as linear regression, are based on the assumptions that fluorescence intensities change linearly across the range of concentrations, may also have limited accuracy in specific contexts (Carstea et al. 2010). 1.2.2.2 Fluorescence data pre-processing Pre-processing of fluorescence data is recommended to eliminate bias and error from concentration and matrix effects, different instruments, or measurement settings (Murphy et al., 2010). Generally, data pre-processing involves, inner filter effect correction, scattering masking, and intensity normalization. The inner filter effect (IFE) results from the absorption of excitation and emission light by the molecules in the detection system (Chen et al., 2018). The primary inner filtering refers to a decrease in the fluorescence intensity, caused by the attenuation of excitation beam, and the secondary inner filtering refers to the reabsorption of emitted radiation by the absorber (Valeur & Berberan-Santos, 2012). IFE is always present in fluorescence spectroscopy and affects the linearity between fluorescence intensity and concentration (Lakowicz, 2013). At first, fluorescence intensity increases until it reaches a maximum, and then starts decreasing with progressive increase of sample concentration. However, it can be corrected using mathematical or instrumental procedures. The most common method for IFE correction is the absorbance-based correction by Lakowicz (2013). It assumes that the emission radiation is observed at the 7 center of the 1 cm path-length cuvette cell, and uses the absorbance at the fluorescence excitation wavelength, and the absorbance at the selected fluorescence emission wavelength, to calculate the matrix of correction factors. The normalization process consists of transforming the fluorescence EEMs to a standard for easier comparison. It is an essential pre-processing step in which the input features re transformed into a common range so that greater numeric feature values cannot dominate the smaller (García et al., 2015). The main purpose to apply normalization is to minimize the bias of those features whose numerical contribution is higher and make them all equally important for predicting the output class. It has been widely studied the importance of data normalization for improvement in machine learning algorithms predictions such as convolutional neural networks (CNN) (Azizjon et al., 2020; Botalb et al., 2018; Taenzer., 2019), and the multilayer perceptron (MLP) (Bhanja & Das, 2018; Dzierżak, 2019, Sola & Sevilla, 1997). Machine learning methods can be implemented to analyze fluorescence spectra. Regarding fluorescence EEMs, it consists of normalizing the fluorescence signals, with respect to each excitation/emission pair across all samples. Normalization can be reversed after validating the models, by multiplying the scores by the same values. Rayleigh scattering is caused by particles or interaction between an incident photon and molecules smaller than the wavelength of the light (Hudson et al., 2007). In the EEMs, the Rayleigh scattering appears as diagonal lines of intensity at points where the emission wavelength is equal to the excitation wavelength or is twice the excitation wavelength. Figure 1 shows an example of the scattering effect in an EEM. A common practice to improve the statistical analysis of the EEMs, is to remove the Rayleigh scattering lines to limit interference. The spectral bandpass is approximately 5 nm, hence, to eliminate the diagonal Rayleigh lines, 10 to 15 nm above and below the peak emission would be removed from EEMs. 8 Figure 1. A sketch of the Rayleigh scattering occurring in an EEM. 1.2.3 Field measurements for contaminant detection Optical field sensors have significant value for environmental analysis and monitoring (Hedley et al., 2012; Joe et al., 2018; Ammenberg et al., 2002) and several other engineering applications (Barrias et al., 2016; Rivero et al. 2018). In particular, fluorescence measures have shown promise as rapid tools in water quality analysis, including tracking organic matter composition (Shutova et al., 2014) and contamination by wastewater and other pollutants (Mirnaghi et al., 2018; Stedmon et al., 2011; Yang et al., 2019a). Shutova et al., 2014 used PARAFAC analysis and fluorescence spectroscopy to identify key optical locations of single wavelength probes for online monitoring of organic matter (OM). They used EEMs from several treatment plants to find the link between these wavelengths and OM character and concentration changes. To validate their method, they compared the information with more conventional DOC and SUVA monitoring with respect to OM removal. Mirnaghi et al., 2018 development of a rapid screening method to deliver a preliminary evaluation of the petroleum products within hours after a spill. They used PARAFAC analysis and fluorescence spectroscopy to establishing a fingerprinting model based on the composition of polycyclic and heterocyclic aromatic hydrocarbons of 130 petroleum Rayleigh Scatter 9 products at different states of evaporative weathering. The identification of unknown and new spilled oils is done by matching the spilled product with the products of the developed model. Several manufacturers offer sensors to measure fluorescence at a limited number of specific or pre-specified ranges of wavelengths. The limited number of wavelengths that can be monitored by field units can limit the accuracy and ability to distinguish pollutants in a natural water matrix. Fluorescence signatures from natural organic matter (NOM) often overlap with pollutants of interest and leads to ambiguity in interpreting the significance of signal changes (Li and Peleato, 2021). The use of excitation emission matrices (EEMs), where fluorescence is measured over numerous iterated excitation and emission wavelengths, has been shown to provide better separation of signals from background noise and increases accuracy of pollutant detection (Alostaz et al., 2008; Ferretto et al., 2014; Yang et al., 2019b). Instrumentation that collects full EEMs are not amenable to deployment in the field due to cost and size. As such, improvements to field sensors and interpretation of the data produced is required to enable widespread environmental monitoring using these methods. For in situ fluorescence intensity measurements, there are available a variety of instruments that are portable and able to measure fluorescence at different intensities. Instruments such as the Cyclops Submersible Sensors from Turner designs, the YSI, and the Fluo Sens Integrated from Dialunox, can hold different filters to measure fluorescence at different excitation and emission ranges. Typically, the lowest excitation that can be measured is 255 nm and can be paired with the lowest emission filter of 275 nm. The upper end of wavelength ranges is commonly 850 nm. 1.2.4 Machine learning for contaminant detection Machine learning is a subfield of artificial intelligence, in which statistical methods are used to train algorithms to make classifications or predictions. Machine learning algorithms have been implemented in almost every field such as pattern recognition, object detection, text interpretation and different research areas. Two of the primary machine learning categories are 10 supervised learning and unsupervised learning (Lee & Shin, 2020). Supervised learning requires the use of labeled datasets to train algorithms to classify data or predict outcomes accurately. Artificial neural networks (ANNs) are a subfield of supervised machine learning, and deep learning is a subfield of ANNs. ANNs are made of an input layer, one or more hidden layers, and an output layer. Each layer contains one or more nodes that connect to other nodes and have associated weights and thresholds. Deep learning refers to ANNs with more than three hidden layers (i.e. not input or output). A review of many important applications of deep learning in the industry is given by Le et al. (2020), where it was shown that deep learning approaches have produced impressive improvements in accuracy compared to traditional machine learning methods. The industry applications were classified according to 4 tasks: recognition; generation; decision-making; and forecasting. They also showed that despite all the benefits from deep neural networks, they require large amounts of training data, there are hidden biases in training data, and there is difficulty in understanding the logic behind the decision made by networks because of their black box essence. A multilayer perceptron (MLP) is a fully connected class of feedforward of ANN design to approximate any continuous function and solve problems which are not linearly separable. A convolutional neural network (CNN) is a Deep Learning algorithm which takes as input an image and can identify complex features of the image. CNNs consist of three different types of hidden layers: convolutional layers, pooling layers, and a fully connected layer at the end of the network. Convolutional layers are the core of the CNN, they involve a filter that moves across the receptive fields of the image. After each iteration, the dot product between the input pixels and the filter is calculated. The final output from the series of dots is known as a feature map. The pooling layer also sweeps a filter across the input image to reduce the number of parameters in the input, to reduce complexity and improve the efficiency of the CNN. The fully connected layer is where the classification or regression happens based on the feature map 11 from the previous layers. Several authors have implemented machine learning techniques to reduce potential loss of information and limit the degree of manual supervision. For example, Sanchooli et al. (2013) applied a multilayer perceptron to successfully predict the pKa values of 28 phenol derivatives in 11 different compositions of methanol/water solvent mixtures. Yu et al. (2021) successfully categorized drinking water samples with and without low levels of phenol using convolutional autoencoders, a type of neural network designed to reduce dimensionality. Although they have seen limited use for improving contaminant detection, convolutional neural networks are well known to be effective for image processing (LeCun et al. 2015) and are likely to be well suited for interpreting chemical spectra. Convolutional networks identify recurring spatial patterns in input data (e.g., features in images) and therefore explicitly account for spatial dependencies that are prolific in spectroscopy (Goodfellow et al. 2016; Yu et al. 2021). Furthermore, convolutional networks include pooling layers where outputs from spatial areas are merged, providing a degree of built-in dimensionality reduction (Goodfellow et al. 2016). Acquarelli et al. (2017) used CNN to classify vibrational spectroscopic data and identify important spectral regions. They showed that CNNs are less dependent on data preprocessing compared to standard classification approaches used in chemometrics (e.g., Partial least squares and logistic regression), for vibrational spectroscopic data classification. Li et al. (2021) gave an overview of ANNs, including CNNs, applied to various categories of chemometrics for laser-induced breakdown spectroscopy (LIBS), involving material identification/classification, component concentration quantification, among others. They showed that using CNN for LIBS is advantageous due to their outstanding architecture and feature learning ability to exploit the full spectrum, while the major limitations are related to overfitting and interpretability. This thesis contributes several new ideas to improve rapid quantification of two major toxic compound groups present in oil sands tailings, naphthenic acids and phenol, in natural waters. Using convolutional neural networks (CNNs) to interpret fluorescence spectra for contaminant 12 quantification directly has not been previously reported. Furthermore, it presents an approach to validating that CNNs rely on chemically logical areas of the fluorescence spectra for quantification. Overall, the developed approach can be utilized to improve the management of oil sand tailings ponds and ensure the surrounding environment is not impacted. Unsupervised learning is used to analyze unlabeled datasets and perform tasks such as clustering and dimensionality reduction without needing expert supervision. Clustering algorithms are used to classify raw data according to structures or patterns. An example of a clustering algorithm is K-means. It classifies data into k groups by assigning each data point to the nearest centroid of all groups. Dimensionality reduction algorithms are usually used as data preprocessing when the number of features is too high to be analyzed, while preserving the important information of the dataset. Liu et al., (2003) used factor analysis, an unsupervised multivariate technique, to extract the latent factors that dominate the spatial distribution of heavy metals in the water environment from large monitoring datasets by plotting a factor-score map. Principal component analysis (PCA) and autoencoders are other examples of dimensionality reduction algorithms. PCA uses a linear transformation to create a new data representation based on the principal components. The first principal component is the direction which maximizes the variance of the dataset, and the second and the rest of principal components are calculated as the direction orthogonal to the prior component with the most variance. Autoencoders are a type of ANN that compress the input data (encoder) and then use the encoded data to reconstruct again the original input data (decoder), such that the reconstructed output is as similar as possible as the original. Autoencoders are usually implemented for reducing noise, classification, anomaly detection, recommendation systems, dimensionality reduction, and clustering (Bank et al., 2020). Different than conventional autoencoders, variational autoencoder (VAEs) can learn latent representations in a probabilistic way. Conventional autoencoders are only trained to minimize reconstruction loss, hence they 13 lack continuity in their latent representation, preventing their generative ability (Lo et al., 2023; Varolgüneş et al., 2020). VAE overcome this issue by defining a probability distribution and adding a regularization term, in the latent space (Kingma & Welling 2019). Additionally, different than PCA, VAE can identify nonlinear relationships within high-dimensional data (Lee et al., 2019). A convolutional variational autoencoder (CVAE) has the same purpose as a VAE but used convolutional layers in de autoencoder structure. VAEs have been successfully implemented by various authors to reduce high dimensional data, detect anomalies, and make predictions. Lo et al., (2023) implemented a VAE to successfully predict the embankment settlement and pore water pressure based on monitoring data. He et al., (2022) used a VAE to successfully downscale high-dimensional Raman spectral data for three subtypes of non-small lung cancer cells and two subtypes of kidney cancer tissues. Data fusion refers to integrating data from different sources to achieve improved accuracy (Castanedo, 2013). The idea behind data fusion is to combine information from multiple sensors to obtained less expensive, higher quality and more relevant information. Traditional data fusion techniques can include probabilistic fusion (e.g., Bayesian fusion), evidential belief reasoning fusion (e.g., Dempster-Shafer theory), and rough set-based fusion (Meng et al., 2020). Recently, machine learning has also been applied as a technique to do data fusion to obtained faster and improved performance in fusion results. In this thesis, machine learning is used to combine data from field and lab measurements to improve contaminant quantification. Field data refers to single fluorescence measurements, and lab measurements refers to the full EEM. 1.3 Research gaps Conventional techniques for interpreting fluorescence excitation-emission matrices are time consuming, require expert supervision, and there is potential information loss during the analysis process. Despite demonstrated improvements to quantification accuracy using 14 dimensionality reduction techniques such as PARAFAC and PCA, particularly to account for changes in background NOM fluorescence (Ferretto et al. 2014; Mirnaghi et al. 2018; Yang et al. 2019), they still require the supervision of an expert and are time consuming. It can be cumbersome to implement PARAFAC since identified components are source specific, and potential interactions between contaminants and NOM may break PARAFAC’s underlying assumption of tri-linear data (Bridgeman et al. 2011; Sharpless and Blough 2014). In the case of peak-picking, where only specific wavelengths are considered, the possible overlap of signals of interest with background NOM or distinct organic compounds with similar fluorescence structures is problematic (Korak et al. 2014; Yu et al. 2015). Additionally, traditional modelling approaches that utilize peak signals, such as linear regression, are based on the assumptions that fluorescence intensities change linearly across the range of concentrations and therefore, may also have limited accuracy for quantifying toxic contaminants in natural waters (Carstea et al. 2010). As such, flexible machine learning approaches could improve the quantification of toxic contaminants from the full EEM without requiring dimensionality reduction. Machine learning models can also reduce potential loss of information and limit the degree of manual supervision. Ultimately it would be most desirable to have methods that can detect contamination in situ or in the field, to enable widespread monitoring. However, available instrumentation for field fluorescence measurements is limited to measuring one excitation/emission wavelength pair (or over a small range) and are limited to only certain ranges of excitation and emission wavelengths. Additionally, single fluorescence measurements cannot give complete information about how background signals can affect the contaminant’s signals. The data fusion method proposed in this thesis could help to improve field measurements by adding information about background signals that interfere with the pollutants. 15 Finally, labelled and source-specific data is likely not readily available to train supervised models. As such, unsupervised approaches that do not require labelled data to approximate if water quality is potentially contaminated are needed. Since there is likely to be a high degree of uncertainty in any predictions, it would be particularly important for the unsupervised method to report the magnitude of uncertainty and better inform water management responses to model results. Unsupervised methods that can report and account for uncertainty, such as convolutional variational autoencoders (CVAEs) could better inform management responses compared to default methods, such as principal component analysis (PCA). It is preferred to have a probability as the prediction since probabilities are more objective and probabilistic models do not require model specific thresholds for judging anomalies (An & Cho, 2015). 1.4 Objectives The overarching aim of this thesis was to apply machine learning techniques and fluorescence spectroscopy to rapidly detect and quantify toxic contaminants in natural surface waters. Several challenges related to the application of fluorescence-based methods, such as dimensionality reduction or expert supervision, for contaminant detection in natural water are addressed in this thesis, as described below. Objective 1: Improve the accuracy of prediction of the concentration of toxic compounds in natural water with variable background water quality, by applying machine learning techniques to process fluorescence data. The common method to implement fluorescence monitoring for contaminant detection is to apply dimensionality reduction algorithms, such as PCA, PARAFAC, or peak picking analysis, to separate signals of interest (contaminants) from background interference, for example humic-like fluorophores in natural organic matter. It would be advantageous not to require data pre-processing by a dimensionality reduction technique to reduce analysis time, potentially limit 16 information loss, and eliminate the need for expert supervision of the process. The main objective for chapter 3 consists of evaluating the novel application of two powerful machine learning algorithms, the multilayer perceptron (MLP) and convolutional neural networks (CNN), to improve rapid quantification of NAs and phenol in natural surface waters. Both models correspond to supervised learning and were trained with known concentrations of NAs and phenol. To find the optimal structure of the MLP and the CNN, different structures were evaluated by adding extra hidden layers and nodes. The hypothesis is that the machine learning algorithms will result in improved results compared to traditional dimensionality reduction methods, because the neural networks (NN) will work with the complete information of the EEM. It is also expected that CNN will results in the most accurate results since they are well known to be effective for image processing since, they explicitly consider spatial patterns in input data, include hierarchical feature representation (i.e., dimensionality reduction) with increasing network depth, and therefore will account for hierarchical spatial dependencies in the EEMs. To understand the areas of the EEM that account for the NNs to make predictions, an occlusion method will be implemented by randomly occluding a spatial area of the inputs. From this method it is expected to see that the NNs make their predictions based on the spectral areas related to the specific fluorescence peak of each contaminant, and some additional background information to separate the contaminant’s signals. Objective 2: Improve the accuracy in the prediction of the concentration of toxic contaminants in field, by applying a data fusion method that combines field and lab measurements. The challenge when using single fluorescence peaks measured in field to quantify the contaminant’s concentrations is these signals are limited in resolution and background 17 interference that in natural environments is difficult to account for. The limited number of wavelengths that can be monitored by field units can limit the accuracy and ability to distinguish pollutants in a natural water. Fluorescence signatures from natural organic matter (NOM) often overlap with pollutants of interest and leads to ambiguity in interpreting the significance of signal changes. Chapter 4 to aims to improve the interpretation of data acquired with field fluorescence measurements at a few select wavelengths through data fusion with lab acquired full EEMs. EEMs are measured over numerous iterated excitation and emission wavelengths and are accounted to provide better separation of signals from background noise, and therefore to increase accuracy of pollutant detection. For this, an augmentation neural network takes as input few fluorescence measurements and predicts the full EEM. Then, the generated EEM is used as input in a NN that predicts the contaminant’s concentrations. Both NNs correspond to supervised learning and are trained with known EEMs and contaminants concentrations, respectively. It is expected that this data fusion approach will improve contaminant’s quantification compared to default methods using single wavelengths probes. Objective 3: Propose an unsupervised learning method for rapid contaminant detection in natural surface water when labelled data is not available. When labelled data is unavailable, unsupervised learning could be used to rapidly screen for anomalies in the EEM and identify when natural waters are being affected by a toxic contaminant. Chapter 5 aims to evaluate using a convolutional variational autoencoder (CVAE) to reduce the data from the EEM in a probabilistic way. CVAEs are unsupervised probabilistic models that can directly report the uncertainty in the results predicted. After the data is reduced, K-means, an unsupervised classification algorithm, will be applied to identify water samples contaminated with NAs and phenol. The variational autoencoder is expected to improve results in identifying water samples contaminated with NAs and phenol, compared to a regular autoencoder or principal component analysis (PCA). 18 Chapter 2: Methods 2.1 Samples and mixing experiments Natural water samples used in this study were collected from three different water sources. Water samples from Lake Okanagan (Kelowna, Canada) and Mission Creek (Kelowna, Canada) were collected over five months from October 2020 to February 2021 and were spiked with NA and phenol. Water samples from the Otonabee River (Peterborough, Ontario, Canada) were collected from February to May 2018 and were spiked with fluoranthene and pyrene. Chapters 3 and 5 were studied based on the data collected from Lake Okanagan and Mission Creek, and chapter 4 from data collected from Lake Okanagan and Otonabee River. High-density polyethylene containers were used for sampling and were triple rinsed using the respective natural water before sampling. All the raw samples were stored in the dark at 4 °C for a maximum of 20 days. NAs stock solution of 10,000 mg/L and phenol stock solution of 10 mg/L were prepared by dissolving a NA standard mixture (CAS-no 1338-24-5, Sigma-Aldrich) and phenol (Sigma-Aldrich) in methanol (HPLC grade, Sigma-Aldrich) and Milli-Q® pure water, respectively. Figure 2 shows fluorescence spectra of NA standard and phenol in Milli-Q® pure water. Afterward, NAs and phenol were spiked in the range from 0 – 50 mg/L and 0 – 100 µg/L, for a total of 180 mixing experiments. The concentration range was chosen based on the studies from Holowenko et al. (2002), and Giesy et al. (2010) to explore using fluorescence techniques to detect target contaminants. NA standard (CAS-no 1338-24-5, Sigma-Aldrich) was dissolved in methanol (HPLC grade, Sigma-Aldrich) to prepare a NAs stock solution of 10,000 mg/L. Phenol (Sigma-Aldrich) was dissolved in Milli-Q® pure water to prepare a phenol stock solution of 10 mg/L. The concentrations chosen for fluoranthene, and pyrene were in the range from 0 to 7 µg/L, resulting in a total of 536 mixing experiments. The concentrations range was chosen based on 19 the studies from Struger et al. (2016) and Baldwin et al. (2016) that reported their presence at low µg/L ranges in Great Lake tributaries. Fluoranthene and pyrene were purchased from Sigma-Aldrich (98%). Contaminants were used to prepare 100 mg /L stock solutions in methanol (HPLC grade, Sigma-Aldrich) without further purification. From those stock solutions, a further diluted solution of 25 mg/L were prepared daily in Milli-Q water. Figure 2. a) NA standard and b) phenol Milli-Q® pure water. 2.2 Fluorescence For fluoranthene and pyrene in the Otonabee River, the excitation wavelengths ranged from 220–360 nm in steps of 5 nm and emission wavelengths ranged from 280–500 nm in steps of 2 nm. events. Each mixing sample was automatically measured by a modified Agilent Cary Eclipse fluorescence spectrophotometer. Absorbance correction for inner-filter effects was not applied during continuous measurement, due to limitations associated with an additional UV analyzer for on-line implementation. For NAs and phenol in Lake Okanagan and Mission Creek, fluorescence spectra were collected using an Aqualog spectrometer (Aqualog, HORIBA, Japan). The excitation and emission wavelengths ranged from 240–400 nm in steps of 2 nm and 250–600 nm in steps of 2 nm. The blank of pure Milli-Q® water was subtracted from each sample to eliminate the fluorescence impacts from the background solvent. Inner-filter corrections based on absorbance spectra were automatically applied using Aqualog® package 20 software. First and second-order Rayleigh and Raman scattering lines were also removed (intensity set to 0) to avoid non-trilinear features for PARAFAC analysis. These non-trilinear features were also removed for all other analysis methods to ensure comparability. Fluorescence EEMs were then normalized and converted into Raman Units (R.U.) using the integrated area under Raman peak (ex=350) measured from the blank Milli-Q® pure water (Lawaetz and Stedmon 2009). 2.3 Artificial Neural Networks The methods described in this section were implemented in chapter 3 of this thesis. 2.3.1 Multilayer perceptron (MLP) Ten different models were designed to evaluate the impact of network depth on prediction performance. Each model was trained and tested 8 times to account for possible variability in performance due to randomized initial network weights and the learning process. Overall prediction performance was reported as the average and standard deviation of the mean absolute error for a test set of data not used for training. The first model consisted of a single hidden layer with half nodes of the input layer. The following models were built by adding an extra layer with half the nodes of the previous layer. The last model used included ten hidden layers with 2400-1200-600-300-150-75-37-19-10-5 nodes each layer, respectively. For the activation function, the exponential linear units (ELU) resulted in more accurate estimation of the contaminants concentrations than other functions. ELU networks are well known for speeding up learning in deep neural networks and improving prediction accuracy. ELUs have negative values, allowing them to push mean unit activations closer to zero like batch normalization but with lower computational complexity (Clevert et al., 2015). The equation for ELU is shown below. 21 𝐸𝐿𝑈 = 𝑓(𝑥) = {𝑥 𝑖𝑓 𝑥 > 0𝛼 (exp(𝑥) − 1 𝑖𝑓 𝑥 ≤ 0 (1) The cost function was the mean squared error (MSE), and its equation is shown below where m is the number of the training samples, 𝑦?̂? is the reconstructed input 𝑖, and 𝑦𝑖 is the original input. 𝑀𝑆𝐸 =12𝑚∑(𝑦?̂? − 𝑦𝑖)2 𝑚𝑖=1→ 𝑀𝐼𝑁 (2) Layers were fully connected, where each node in any given layer is connected to all nodes in the subsequent and previous layers. Networks were trained using the Keras library (TensorFlow backend) in Python 3.7. Over 500 training epochs with a batch size of 32 was used, although the number of training epochs was adjusted to ensure training error was minimized. Figure 3 shows the general structure of the MLP. Figure 3. General schematic of MLP. The number of hidden layers vary with every model. 2.3.2 Convolutional neural networks (CNNs) CNNs involve training filters (or kernels) that are multiplied over a spatial area of inputs. The filters act as spatial weighting functions that process small areas of the input spectra, and individual filters are applied over the whole spectra. The output of multiplying an individual filter 22 over the entire input space is referred to as a feature map and can be used as the input to a subsequent layer. All convolutional layers had a filter size of 7 by 7 with 32 filters trained per layer. The final hidden layers consisted of a flattening step, where CNN filters are transformed into a fully connected layer, followed by a layer with 10 nodes and a single node output layer. Figure 4 shows the general structure of the convolutional neural networks. Similar to MLPs, the impact of network depth on CNNs performance was also determined. Ten CNNs were generated with multiple hidden layers (convolutional and max-pooling layers). The first model consisted of a single convolutional layer, and depth was increased by sequentially adding convolutional layers (max 10 convolutional layers). For every 3 consecutive convolutional layers, a max-pooling layer of size (2, 2) was included. Each model was trained and tested 8 times to get the average and standard deviation of the mean absolute error between the measured and the predicted concentrations. Figure 4. General schematic of convolutional neural network structure. The number of convolutional layers as well as the number of layers (convolution + max pooling) vary with every model. 2.4 Data fusion between field and lab measurements The methods described in this section were implemented in chapter 5. 2.4.1 Generation of the EEMs and estimating pollutant concentrations The first step consisted of building an augmentation neural network to generate EEMs using a few ex/em pairs (single fluorescence intensities) as input. The network input is a few key 23 fluorescence intensities, and the output is the generated EEM. The structure of the augmentation network was determined based on trial and error, were nodes and hidden layers were added until there was no significant change (<1% change) in the mean squared error. The augmentation network used for the Otonabee River was three layers with 10-20-100 nodes in each layer, respectively. The hyperparameters of the activation function, number of iterations, kernel, pooling, and batch size were determined based on trial and error, and the ones that produced the most accurate results were chosen. Nodes were activated using rectified linear units (ReLU) for the three hidden layers. For the output layer, nodes were activated using the sigmoid function to represent the input data that was normalized between 0 and 1. Fluorescence spectra in Okanagan Lake was higher dimensional compared to the Otonabee River (4853 compared to 2602 spectral variables, respectively). For Okanagan Lake, best results were found when adding an extra layer, the augmentation network was 4 layers with 20-100-500-1000 nodes in each layer, respectively. Nodes were active using exponential linear units (elu) since it produced better results than ReLU and the sigmoid function. The cost function for both water samples was the mean squared error and the optimizer was the Adam optimization algorithm. Batch normalization was used to speed up training, and the networks were trained over 500 epochs and a batch size of 32. The augmentation networks were trained using Keras (TensorFlow backend), an open-source library written in Python for developing neural networks. To determine the quantity and the location of the ex/em pairs needed to train the augmentation network to generate the most accurate EEMs, several trials were done varying between the number of inputs and their distribution. Trials were made by dividing the EEMs into regions and making all the possible combinations between the regions. The middle points of each region (with some exceptions such us the specific fluorescence of the contaminants) were used to represent each region. Trials started by combining 3 ex/em pairs up to 9 ex/em pairs to 24 evaluate how adding more pairs could improve the accuracy in the predictions. The generated EEMs were compared to the original EEMs using the mean absolute error (MAE), coefficient of determination (R2) and congruence coefficient (rc). Each model was trained and tested 8 times to get the average and standard deviation of each metric between the original and the generated EEMs. R2 is a robust method to measure if the prediction of the dependent variable from the independent variables is successful (Nagelkerke, 1991), MAE is commonly used to evaluate the average performance of a model (Willmott and Matsuura, 2005), and rc is used to evaluate the similarity between factors (Korth and Tucker, 1975). The equations are shown below, where Xi id the true fluorescence intensity value of measured sample i, and Yi is the generated fluorescence intensity value. MAE, R2, and rc were calculated for each variable and then averaged to evaluate the predictive performance of the models. To ensure the models were not overfitting, the performance metrics were applied to the test dataset that had not been used in the model training. 𝑅2 = 1 −∑ (𝑁𝑖=1 𝑋𝑖 − 𝑌𝑖)2∑ (𝑋𝑖 − 𝑋?̅?)2𝑁𝑖=1 (3) 𝑀𝐴𝐸 =1𝑁∑|𝑋𝑖 − 𝑌𝑖|𝑁𝑖=1 (4) 𝑟𝑐 = ∑ 𝑋𝑖𝑌𝑖𝑁𝑖=1√∑ 𝑋𝑖2𝑁𝑖=1 ∑ 𝑌𝑖2𝑁𝑖=1𝑀𝑆𝐸 =12𝑚∑(𝑦?̂? − 𝑦𝑖)2 𝑚𝑖=1→ 𝑀𝐼𝑁 (5) Finally, the generated EEMs were used to estimate the concentrations of the contaminants. The estimations were done by building a multilayer perceptron network for each contaminant (input: generated EEMs, output: contaminant’s concentration). Same as for the augmentation network, the structures of the concentration prediction networks were determined by adding nodes and hidden layers until there was no significant change (<1% change). For the 25 Otonabee River (fluoranthene and pyrene), the concentration prediction network was three layers with 100-20-10 nodes in each layer, respectively. For Okanagan Lake, the concentration prediction network was 1 layer with 2400 nodes. The cost function for both water samples was the mean squared error, the optimizer was the Adam optimization algorithm, and all nodes were activated using the ELU function. The networks were trained over 500 epochs and a batch size of 32. Each network was trained and tested 8 times to get the average and standard deviation of the mean absolute error between the measured and the predicted concentrations. Same as the augmentation networks, the concentration prediction networks were trained using Keras (TensorFlow backend). MAE and R2 were implemented to evaluate the performance of the models to predict the concentration of the contaminants. Figure 5 shows the flowchart followed during the experiment. 26 Figure 5. Flowchart of the generation of the augmentation networks and the estimation of the contaminants. Fluorescence spectra dataset is divided into training and testing. Few key fluorescence intensities are used to build an augmentation neural network (NN) that generates EEMs. The generated EEMs are compared with the original EEMs. The generated EEMs are used to build a NN that predicts the contaminant’s concentration. The predicted concentrations are evaluated with the originals. 2.4.2 Comparison with other methods Results of the estimation of the contaminants’ concentrations from the generated EEMs were compared to the results obtained by using the peak picking method. Peak picking is the simplest method to detect contaminants concentration from fluorescence EEMs (Li and Peleato, 2021, where the intensity of the peak position of the fluorophore is assumed to have a linear relationship with its concentration. To evaluate this, a linear model was built for each 27 contaminant to predict their concentration using the intensities of their corresponding peak. Additionally, results were compared to a linear model using the specific peak of each contaminant, and two extra intensities from humic like compounds to add information about background signals. The humic like compounds were chosen based on observing their fluorescence in raw water. Values from the peak picking method are shown in Table 1 for Otonabee River and Okanagan Lake. Table 1. ex/em pairs from the peak picking method in Otonabee River and Okanagan Lake Otonabee River Fluorophores Excitation wavelength (nm) Emission wavelength (nm) Reference Fluoranthene 285 464 Maie et al. (2012) Pyrene 235 392 Ferretto et al. (2014) Humic-like 245 400 Determined from samples Humic-like 285 464 Determined from samples Okanagan Lake Naphthenic acids 275 325 Podgorski et al. (2018) Phenol 265 310 D'Andrilli et al. (2017) Humic-like 245 360 Determined from samples Humic-like 250 445 Determined from samples Results from peak-picking and augmentation were also compared to those obtained using the same contaminant prediction network structure of each water source with the original EEMs. Each network was trained and tested 8 times, each time resulting in new randomized starting weights, to report the average and expected variance between training processes. 28 2.5 Unsupervised classification The methods described in this section were implemented in chapter 5 of this thesis. 2.5.1 Convolutional variational autoencoder A variational autoencoder is a probabilistic unsupervised method used for dimensionality reduction. For this study, it was chosen over a regular autoencoder and a PCA, because it provides a probability measure rather than a deterministic or fixed representation of the encoded EEM, and it is well suited for high dimensional data with highly nonlinear dependencies among its elements (Wiewel & Yang, 2019 May). A CVAE encodes the input into a latent vector z, and then the latent vector z is decoded back to the input ?̅?. For this, it is needed to maximize the marginal log-likelihood of each pixel in x, and the CVAE reconstruction loss (𝐿𝑟𝑒𝑐) is the negative expected log-likelihood of the pixels in x. A CVAE also needs to control the distribution of the latent vector z. The latent vector z is characterized for being independent unit Gaussian random variables. Additionally, the difference between the distribution of q(z|x) and the distribution of a Gaussian distribution (KL Divergence) is minimized by a gradient descent algorithm. CVAE are trained by optimizing the sum of the reconstruction loss (𝐿𝑟𝑒𝑐) and KL divergence loss (𝐿𝐾𝐿) by gradient descent (Hou et al., 2017). 𝑧 = 𝑒𝑛𝑐𝑜𝑑𝑒𝑟(𝑥)~𝑞(𝑧|𝑥) (6) ?̅? = 𝑑𝑒𝑐𝑜𝑑𝑒𝑟(𝑥)~𝑝(𝑥|𝑧) (7) 𝐿𝑟𝑒𝑐 = −𝐸𝑞(𝑧|𝑥)𝑙𝑜𝑔𝑝(𝑥|𝑧) (8) 𝐿𝐾𝐿 = 𝐷𝐾𝐿(𝑞(𝑧|𝑥)‖𝑝(𝑧)) (9) 𝐿 = 𝐿𝑟𝑒𝑐 + 𝐿𝐾𝐿 (10) 29 2.5.2 Reduction of the EEM The first step consisted of building a convolutional variational autoencoder (CVAE) to encode the EEMs into simpler representations. The structure of the CVAE was determined based on trial and error, where nodes and hidden layers were added until there was no significant change (<1% change) in the loss function. The encoder part of the CVAE was 5 convolutional layers with 32 filters and kernel size of 7. Nodes were activated using exponential linear units (ELU). Max Pooling layers with pool size of 2 were added after the second and fourth convolutional layers. The last layer was a dense layer with 10 nodes. The latent dimension was reduced to a vector with 2 dimensions. The decoder part of the CVAE was the transposed version of the encoder. Batch normalization was used to speed up training, and the networks were trained over 1000 epochs with a batch size of 32. To balance the loss function between the reconstruction error and the KL divergence, 6 different models were trained multiplying the KL divergence by a β value between 0.01 and 100. Dropout between 0 to 40% was added in the input layer to discourage overfitting. The CVAE was trained using Keras (TensorFlow backend), an open-source library written in Python for developing neural networks. Figure 6 shows the structure of the CVAE. Figure 6. Structure of the Convolutional Variational Autoencoder (CVAE). 30 The encoded lower dimensional vector for each sample (mean vector) was used as the input to a K-means clustering method for unsupervised classification of water samples. Initially the encodings were used to predict membership to 4 classes: samples contaminated with NAs, phenol, both NAs and phenol, or not contaminated. K-means clustering is the most used clustering method for unsupervised learning, used for clustering groups of equal variances (Sinaga & Yang, 2020). The K-means clustering model was trained using scikit-learn, an open-source library written in Python for predictive data analysis. Figure 7 shows the process of the flowchart of the method proposed. The Rand score was used to evaluate the classification performance of the K-means method. It is used in unsupervised classification since it computes a similarity measure between the predicted and true classifications. The Rand score considers all pairs of samples and counts pairs that are assigned in the same or different clusters in the two classifications (Pedregosa et al., 2011). It handles two partition matrices (R and Q) of the same data set. The R partitions encodes the class labels into k known classes. Partition Q encodes the data into v clusters and is the one to be evaluated. The Rand score is calculated as the number of concordant pairs, divided by the total number of pairs. The equation of the Rand index is showed below, where a corresponds to the sum of number of pairs of data objects belonging to the same class in R and to the same cluster in Q, b to the number of pairs of data objects belonging to the same class in R and to different clusters in Q, c to the number of pairs of data objects belonging to different classes in R and to the same cluster in Q, and d to the number of pairs of data objects belonging to different classes in R and to different clusters in Q (Campello, 2007). The Rand score was calculated using scikit-learn metrics. The classes were NAs, phenol, both NAs and phenol, and clear water. The disentanglement of the CVAE was measured using the Mutual Information Gap (MIG) metric. MIG is used to evaluate the degree of disentanglement of a latent vector regarding a particular semantic attribute. MIG is bounded between 0 and 1, where 1 31 means the best performance. It considers the gap in mutual information between the attribute and its most informative latent dimension, and between the attribute and its second-most informative latent dimension (Watcharasupat et al., 2022). The equation for the MIG is showed below, where 𝑗(𝑘) = 𝑎𝑟𝑔𝑚𝑎𝑥𝑗𝐼𝑛(𝑧𝑗; 𝑣𝑘) and K is the number of known factors. The Brier Score was used to calculate the accuracy of the precision of the probabilistic predictions. It ranges between 0 and 1, where 0 represents total accuracy, and 1 represents complete inaccuracy. The Brier Score was calculated as mean square error (MSE), where N is the number of samples, f is the forecast probability, and o is the outcome. The forecast probability was calculated by making 100 predictions of the encoder part of the CVAE. Then, the K-means model was used to classify the 100 predictions made by encoder, and the forecast probability was the probability that the water samples were classified as contaminated with NA. 𝑅𝑎𝑛𝑑 𝑠𝑐𝑜𝑟𝑒 = 𝑎 + 𝑑𝑎 + 𝑏 + 𝑐 + 𝑑 (11) 𝑀𝐼𝐺 = 1𝐾∑1𝐻𝑣𝑘(𝐼𝑛(𝑧𝑗(𝑘); 𝑣𝑘) − 𝑚𝑎𝑥𝑗≠𝑗(𝑘)𝐼𝑛(𝑧𝑗; 𝑣𝑘))𝐾𝑘=1 (12) 𝐵𝑟𝑖𝑒𝑟 𝑠𝑐𝑜𝑟𝑒 =1𝑁∑(𝑓𝑡 − 𝑜𝑡)2𝑁𝑡=1 (13) 32 Figure 7. Flowchart of the CVAE and classification of the EEM according to the water samples contaminated with NAs or phenol. 2.5.3 Comparison with other methods Results of the classification accuracy of the CVAE were compared to the results obtained using Principal component analysis (PCA) and a standard convolutional autoencoder with the same structure as the CVAE. PCA is a simple method commonly used as a preprocessing technique for classification, that reduces multidimensional data to lower dimensions while retaining most of the information (Karamizadeh et al., 2020). To evaluate this, the EEMs were reduced to 2 components, and K-means was used to classify between water samples contaminated with NAs, phenol, both NAs and phenol, and not contaminated. It was necessary to reduce the latent space to 2 components since the data available to evaluate the MIG was 2 dimensions (concentration of NAs and phenol). Finally, the Rand score was calculated for each model. 33 Chapter 3: Application of Machine Learning Methods for Rapid Fluorescence-based Detection of Naphthenic Acids and Phenol in Natural Surface Waters Approximately 1.4 billion m 3 of fluid tailings produced from oil sands mining operations are currently being held in Alberta, Canada and pose a significant risk to the environment if not properly treated and managed. The ability to quantify levels of toxic compounds accurately and rapidly, such as naphthenic acids (NAs) and phenol in the produced oil sands process-affected water (OSPW) is required to ensure the protection of the surrounding aquatic environment. This chapter investigates the novel use of the full spectrum, without dimensionality reduction, as input to a multilayer perceptron and convolutional neural network. It was hypothesized that these techniques would reduce information loss by eliminating the need for dimensionality reduction prior to regression. As such, they would increase accuracy and provide a way to directly use fluorescence spectra for NA and phenol monitoring in natural surface waters at environmentally relevant concentrations (NAs and phenol in the range from 0 – 50 mg/L and 0 – 100 µg/L). Furthermore, natural surface waters were used to explicitly address the influence of background water quality on observed signals, such as from NOM. The approaches developed in this work contribute to increasing the feasibility of rapid and in-situ contaminant monitoring by optical methods. Visualization of spectral areas of importance revealed that deep CNNs utilized logical areas of the fluorescence spectra associated with NAs and phenol signals. Results suggest machine learning approaches to interpreting fluorescence data can accurately predict individual toxic components of OSPW in natural waters at environmentally relevant concentrations. 3.1 Deep and convolutional networks Initial prediction accuracy results (Table 2) suggested that simple black box or data-driven regression methods, such as shallow NNs, improved performance for hard to detect contaminants. Significant improvement to NN performance in many fields has resulted from 34 increasing network depth or adding several additional hidden layers of neurons (Simonyan and Zisserman 2015; LeCun et al. 2015; Goodfellow et al. 2016). Increasing network depth is thought to provide opportunities for the network to learn hierarchies of representations to build complex features from simple ones (Goodfellow et al. 2016). As such, a greater degree of abstraction can be achieved, and the need for carefully pre-constructing relevant features (e.g. through peak picking, PCA, or PARAFAC analysis) can be avoided (LeCun et al. 2015). It was hypothesized that deep networks could be used to derive relevant features using a full fluorescence spectrum, eliminating the need for pre-processing. An iterative process of adding hidden layers was employed to identify the potential improvements of adding network depth for fluorescence-based detection of contaminants in complex water matrices. Ten different models were proposed to predict the concentrations of the contaminants, with the number of hidden layers sequentially increasing from 1 to 10. Figure 8 shows the average mean absolute error (MAE) of NAs and phenol with respect to the number of hidden layers, with error bars representing the standard deviation of the 8 random initializations of the network. Figure 8. Mean absolute error for NAs and Phenol, according to the number of layers in Okanagan Lake and Mission Creek. 35 A network with a single hidden layer produced the best results for predicting NA concentrations in Okanagan Lake (Figure 8; MAE 1.64 ± 0.21 mg/L). Training the models using 8 or 9 layers gave the same results as a single layer (two-tailed t-test p = 0.84 and 0.44, respectively). For NA prediction in Mission Creek water, training the model using 8 layers predicted the most accurate NAs concentrations (MAE = 1.22 ± 0.05 mg/L). However, the absolute change in MAE was small compared to using only 1 hidden layer (MAE = 1.37 ± 0.13 mg/L with 1 layer or a difference of 0.15 mg/L). The most accurate predictions of phenol concentrations were also obtained using a single layer. The average MAE were 8.89 ± 0.39 μg/L and 6.82 ± 0.14 μg/L for Okanagan Lake and Mission Creek, respectively. When using between 4 and 10 layers, the average MAEs were the same as using a single layer (p > 0.1 for all cases). Interestingly, training the model using between 2 and 4 layers resulted in the worst averaged performance for both water types and contaminants. For some random initializations, the model with a few hidden layers became stuck or failed to learn any meaningful representation and predicted constant outputs, leading to high error. Efforts to prevent the training process from becoming stuck were put in place, such as adjusting learning rates, applying batch normalization prior to activation, and using activation functions that produce smooth responses to negative inputs. However, a combination of learning parameters and network structure was not found to prevent the network from performing poorly on test data for 2 – 4 layers. It is possible that the double descent phenomena associated with neural networks are being observed, where performance on test data can initially worsen in an under-parameterized regime and then improve when sufficient model complexity is sufficiently large (Nakkiran et al. 2019). However, the deep networks with > 4 layers had similar or worse performance than 1 layer, implying that network depth is unnecessary for this context. Furthermore, as shown in Figure 8, increasing the number of layers increased the variability in 36 performance for both NAs and phenol. The increased variability is also likely due to the increased number of learnable parameters and the small sample size available in this study (144 samples for training). As such, it is unlikely that deep networks are necessary for this context and when training set sizes are small. Unlike MLP, prediction accuracy improved with increasing CNN network depth (Figure 9). Network depth was evaluated by increasing the number of convolutional layers and the number of max pooling layers. For NAs, best results were obtained when the model was trained using 9 convolutional layers, with an average MAE of 1.81 ± 0.43 mg/L and 1.78 ± 0.17 mg/L, for Okanagan Lake and Mission Creek, respectively. For phenol, the best results were obtained when training the models with 5 convolutional layers, with an average MAE of 4.68 ± 0.93 μg/L and 5.41 ± 0.77 μg/L for Okanagan Lake and Mission Creek, respectively. Results show a limitation for the contaminants detection when the concentrations levels go below the Canadian Council of Ministers of the Environmental (CCME) guidelines (1 mg/L and 4 µg/L for NAs and phenol in surface waters, respectively). However, the models showed a novel method for detecting NAs and phenol, and could be implemented on tailings ponds where concentrations are considerably higher (NAs: 3 – 120 mg/L, phenol: 1 – 1,800 µg/L) (Giesy et al. 2010). The application of deep CNNs reduced NA prediction accuracy compared to both PCA-NN and MLPs. However, the absolute change was small (ΔMAE =0.38 and 0.59 mg/L, for Mission Creek and Okanagan Lake, respectively) in the context of NA concentrations spiked between 0 and 50 mg/L. For phenol, the more challenging to quantify contaminant, deep CNNs resulted in more significant performance increases compared to either PCA-NN or MLPs. CNNs typically perform well with image processing tasks, or input data where spatial dependencies are important, by learning hierarchical features representation from the input image (Hatami et al. 2018). Results indicate that these characteristics of spatial data are essential to consider for this task. The observed results also follow from expectations of fluorescence spectrum characteristics, where 37 only a few underlying signals in natural water and contaminant signals with varying proportionality result in the full observed spectrum (Coble et al. 2014). This implies there should be an underlying lower-dimensional representation, which is considered through the pooling layers incorporated within the CNN structure that sequentially reduce the dimensionality of the feature maps. Furthermore, fluorescence absorption and emission spectra are expected to be broad and smooth (Lakowicz 2013), implying strong spatial dependencies since all intensities in a small excitation/emission window are likely to be due to common causes. Figure 9. Mean absolute error of NAs and phenol with respect to the number of convolutional layers used in Okanagan Lake and Mission Creek. A max pooling layer was included after every 3 convolutional layers. 3.2 Visualizing network attention Data-driven models, such as NNs, were observed to optimally predict the presence of NAs and phenols in all cases (i.e., PCA-NN, multilayer perceptron, deep CNNs). However, a common limitation of this type of approach is the lack of transparency on the underlying learned logic of the networks (Guidotti et al. 2019). To build trust in black box approaches and ensure proper functioning, approaches to probe the models' underlying assumptions must be applied (Gilpin et al. 2018). 38 In the context of contaminant detection, the goal was to identify the spectral areas that the network determined were the most influential on prediction accuracy. An occlusion method was applied using the most accurate models trained for NAs and phenol to achieve this. The occlusion method consisted of randomly occluding a spatial area of the inputs or setting an area of inputs to 0. The difference in performance between the non-occluded and the occluded predictions gave a view into spectral regions most important for prediction. Positive differences indicated that the model underestimated the contaminant concentration due to the occlusion, and negative differences indicated the model was overestimating the contaminant concentration. A total of 14,000 iterations of random patches per model were chosen to build a heat map of areas of importance for both CNNs and MLPs. For NAs, the occlusion method was applied for the CNN trained with 9 convolutional layers, and for phenol with the model trained with 5 convolutional layers. For the MLP, the occlusion method was applied to the model trained with one hidden layer. Figures 10 and 11 show the average heat maps identified from training the deep CNNs and MLPs. The heat maps of MLPs demonstrate that the models are looking at the regions related to both NAs and phenol. The models trained to estimate NA concentrations were sensitive to areas in the range of ex: 270-290 nm and em: 290-340 nm, which would be associated with NAs (C2 compounds, excitation: 250-350, emission: 300-375 nm). For the estimation of phenol concentrations, the areas that had the biggest impact were in the range of ex: 250-280 nm and em: 270-340 nm. The area of importance is associated with phenol (C4 compounds, excitation: 250-300, emission: 250-350 nm). The heat maps provide evidence that the NNs are utilizing signals from regions that are reasonable for NAs and Phenol concentration predictions. 39 Figure 10. Heat maps from random occlusion of variable importance for MLPs prediction of a) NAs in Okanagan Lake, b) Phenol in Okanagan Lake, c) NAs in Mission Creek, d) Phenol in Mission Creek. From occlusion heat maps of CNNs (Figure 11), it was observed that the models are looking at several areas in the fluorescence spectra to predict the concentrations of NAs, both in Okanagan Lake and in Mission Creek. While areas of importance are identified at low excitation/emission wavelengths that would correspond with the expected location of NAs, several other peaks in humic-like and protein-like regions are also present. It was considered that the addition of NAs could alter signals in the humic-like regions either through interactions of the two compounds or overlaps of signals. However, linear relationships between increasing NA concentrations and excitation/emission in the areas identified in Figure 11a and 11b were low (R2 < 0.3), suggesting any interactions were not highly impactful. It is worth noting that the error caused by occlusion has a maximum value of only 2.6 mg/L for NAs that were present at 40 concentrations between 0 and 50 mg/L, compared to the maximum error value of 63 μg/L for phenol present at concentrations between 0 and 100 μg/L. Based on low error due to occlusion in any region, the idea that NA prediction is relatively easy in this concentration range is further emphasized. However, this method is limited to the estimation of NA standard, in the environment NAs could have a different composition that would make them non fluorophore. For the prediction of phenol concentrations, the areas that had the biggest impact were in the range of ex: 250-300 nm and em: 275-325 nm, which corresponds with expectations of phenol fluorescence (C4 compounds, excitation: 250-300, emission: 250-350 nm). Figure 11. Heat maps from random occlusion of variable importance for CNN prediction of a) NAs in Okanagan Lake, b) Phenol in Okanagan Lake, c) NAs in Mission Creek, d) Phenol in Mission Creek. 41 3.3 Summary In this chapter, the performance of MLP and CNN was evaluated for rapid quantification of NA and phenol. For the MLP it was found that only 1 hidden layer was necessary for optimal results. For the CNN, 5 convolutional layers had the most accurate predictions. Ultimately, CNN had the best performance for estimating phenol’s concentration, the most difficult contaminant to detect since its signals were being overlapped by NA. It is likely that CNN had the best performance compared to the MLP due to improved consideration of spatial dependence in the spectra, hierarchical feature representation with increasing network depth, and decreasing dimensionality of feature maps from pooling layers. The heat map from the occlusion method showed that the MLP and CNN were looking at areas in the fluorescence spectra related to NA and phenol signals to make predictions in both Okanagan Lake and in Mission Creek. Additionally, CNN produced smoother and more realistic heat maps of spectral area importance compared to MLP, which could have resulted in superior performance. As such, this technology could be utilized to rapidly identify impacts of OSPW on the environment or to assure OSPW is treated to the degree acceptable for discharge. 42 Chapter 4: Augmentation of field fluorescence measures for improved in-situ contaminant detection Chapter 4 of this thesis aims to improve the interpretation of data acquired with field fluorescence measures at a few select wavelengths through data fusion with lab acquired full EEMs. Chapter 2 showed that use of a full EEM combined with powerful machine learning models such as the multilayer perceptron and convolutional neural networks could be used for screening purposes at environmentally relevant concentrations. The general approach is to build an augmentation neural network to estimate a full resolution fluorescence spectrum from only a few fluorescence intensities at specific wavelengths. Once trained with high-quality lab data, the augmentation network provides a means to fill in parts of the background signal. The EEMs generated by the augmentation network can then be used to build a model that estimates pollutant concentrations from full EEMs. This data augmentation approach is related to several studies that investigated filling in missing data for different environmental applications. Data gaps or missing values in mass spectroscopy is a major limitation for peak detection algorithm. Müller et al. (2020) presented a new gap filling algorithm based on the symbolic aggregation approximation for liquid chromatography high-resolution mass spectroscopy nontarget screening to support the detection of missing peaks in aligned mass spectral data sets. Missing data is also a common problem that affects hydrological studies. In daily streamflow datasets, missing data could impact statistical analysis results, and variability in the data would not be anticipated. Accordingly, Hamzah et al. (2021) compared the performance of the robust random regression imputation, k-nearest neighbors, and classification and regression tree, in predicting recurrence in streamflow datasets. In this chapter, we studied the number of single wavelengths needed to replicate the full fluorescence spectra, and to estimate the concentration of toxic NAs, phenol, and the PAHs fluoranthene and pyrene. We also studied the location of the excitation and emission 43 wavelengths of these single wavelengths. Results were compared with the default methods using single wavelengths probes. The proposed approach would help address common challenges with field measurements that are limited in resolution and background interference in natural environments is difficult to account for. The methodology focuses on better utilizing available probes and suggests that data fusion with lab acquired data can improve field data 4.1 Peak picking and full EEMs The performance of peak picking and the use of the full EEM for predicting all contaminants is presented in Table 2. Linear models based on the specific peak of each contaminant showed less accurate results. Additional linear models with 4 peaks were built, which included the specific peak of the two contaminants in each water source, and 2 extra peaks corresponding to humic-like values to account for background interference. Linear models built with 4 peaks reduced error for fluoranthene, pyrene and NAs by 60%, 39%, and 76%. There was not a significant improvement for phenol, and the error was reduced by less than 3%. Multilayer perceptron models with the full original EEMs showed better performance than the linear models with the peak values of the contaminants. For the Otonabee River, fluoranthene and pyrene had the best accuracy prediction with MAE of 0.03 ± 0.014 μg/L and 0.02 ± 0.004 μg/L, respectively. In Okanagan Lake, naphthenic acids (NAs) and phenol were the more difficult to quantify with a MAE of 1.55 ± 0.142 mg/L and 8.90 ± 0.394 μg/, respectively. Results showed that using the full data with a powerful model such as the multilayer perceptron predicts more accurate estimations of contaminants’ concentrations. These results were in part the motivation for building an augmentation network based on few fluorescence intensities for contaminant detection in situ. 44 Table 2. Mean absolute error according to the number of intensities chosen and the type of model used between linear regression (LR) and multilayer perceptron (MLP). Contaminant MAE 1 peak (LR) MAE 4 peaks (LR) MAE 4 peaks (MLP) MAE Full EEM (MLP) Fluoranthene (µg/L) 0.45 0.18 0.09 ± 0.02 0.03 ± 0.01 Pyrene (µg/L) 0.13 0.08 0.07 ± 0.03 0.02 ± 0.00 NAs (mg/L) 12.75 3.01 2.62 ± 0.20 1.55 ± 0.14 Phenol (µg/L) 31.37 30.48 16.10 ± 0.54 8.90 ± 0.39 4.2 Analysis of the regions For the Otonabee River, regions were divided uniformly every 50 nm in the excitation range, and every 40 nm in the emission range. The middle point of each region was chosen as the representative wavelength pair, except for regions 2 and 10, which correspond to the fluorescence of pyrene and fluoranthene, respectively. For Okanagan Lake, EEMs were initially divided uniformly but models were not able to estimate phenol. It was noticed that results improved when using values near the expected phenol peak, and therefore it was necessary to include additional peaks near phenol. It was noticed that intensities more than 350 nm in the emission range and less than 280 nm in the excitation range were not adding valuable information to phenol estimations, so these regions were simplified into two and the ex/em chosen were located close to phenol’s peak. Regions 4 and 5 correspond to the values from the peak picking method for phenol and NAs, respectively. Regions were added and removed until the models were able to predict phenol concentrations 45 with MAE less 10 µg/L, for a total of 13 regions. Figure 12 shows the final division of the 13 regions of the EEM for the Otonabee River and Okanagan Lake. Figure 12. Division of the EEMs and ex/em pairs chosen in each region in (left) Otonabee River and (right) Okanagan Lake. For both water sources, models were built choosing all the possible combinations of the regions starting at using only 1 intensity to using 9 intensities. The intention was to identify the number of peaks needed to sufficiently augment the EEM for prediction of contaminants. All models were trained and tested 8 times with random initialization of network weights to get the mean MAE and standard deviation. To ensure the models were not overfitting, the MAEs were calculated on the test dataset that was not used during the training process. Results from all the combinations were sorted by accuracy and a two-tailed t test was applied between the best result and the following best result to identify the grouping of possible combinations that produce a statistically similar and optimal performance (p > 0.05). The optimal combinations were then evaluated to see which regions had the biggest influence for predicting the most accurate models. Figure 13 shows the frequency each region was chosen to result in optimal performance for models with increasing number of inputs or peaks. The number of times each region was chosen was normalized by dividing it by the total combinations chosen for each model type. 46 Figure 13. Frequency each region was chosen for the detection of a) NAs, b) phenol, c) fluoranthene, and d) pyrene. The different groups of bars correspond to the number of intensities used to generate the EEMs. The series number (3, 4, 5, 6, 7, or 9) identifies the number of peaks or intensities used as inputs to the augmentation NN. Phenol was the most difficult contaminant to detect. Intensity #4, which corresponds to the location of phenol’s peak, was needed in all cases despite the number of inputs used to generate the EEMs (Figure 13 b). For NAs, when using only 3 intensities, none of the regions were chosen in all the cases to generate good results, possibly indicating that NAs impact several regions (Figure 13 a). When using 9 inputs it was noticed that regions 5, 6, 10, 12 were necessary in all cases for NAs detection. Region 5 corresponds to the specific intensity of NAs according to Podgorski et al. (2018), which shows that the model with a high number of inputs needs to have as input a region related with NAs for its detection. Regions 6, 10 and 12 in humic-like regions provided additional information on background organic signals, which likely assisted in distinguishing the NA signal. 47 Fluoranthene and pyrene were the easiest contaminants to be detected and resulted in the lowest detection error given the concentrations analyzed in this dataset. For both contaminants, regions #2 and #6 were mostly used in both cases (> 60% of models used these regions), which are associated to the primary and secondary peaks of pyrene (Yang et al., 2019). Pyrene’s planar structure results in a high quantum efficiency, making pyrene’s fluorescence intensities stronger than fluoranthene’s (Liu et al., 2021). The dominant signals of pyrene were overshadowing fluoranthene signals, resulting in fluoranthene models relying on background signals for its detection. Region #9 was most used background signal, which corresponds to a humic-like zone. 4.3 Estimation of contaminant concentration For NAs and phenol, it was observed that the number of optimal combinations was proportional to overall detection performance. When the model was more accurate (lower MAE on test data), a smaller number of combinations produced optimal results. For NAs, the best combinations when using 5 inputs only represented 0.4% of the total possible combinations. When using 3, 6, and 9 intensities, 8.4%, 1.3% and 1.1% of the total possible combinations produced the same best results, respectively. For phenol, when using 3 inputs, only 2 out of 286 possible combinations (0.7%) produced the same best results, being more difficult to detect than NAs. In both cases intensities #5 and #7 were needed. When using 5, 6, and 9 intensities, the percentage of combinations that produced the same results were related to the value of the MAE. Same as NAs, more accurate models (smaller MAE) had less percentage of possible combinations that produced the same best results. From 5, 6 and 9 intensities, the 1.6%, 4.5% and 2.8% produced the same best results, respectively. For NAs, best results were obtained when using 5 intensities to generate the EEMs, however there was no difference between using 3 or 5 inputs (p > 0.05). For phenol, best results were obtained using 5 inputs, and again there was no difference between using 3 or 5 48 inputs (p > 0.5) This means that the same accuracy in the estimation of the contaminant’s concentration can be obtained using just 3 single wavelengths and adding extra inputs did not improve the accuracy. Using a smaller number of intensities to predict the concentration of the contaminants would result in a more economical method that can be more easily and widely implemented. Fluoranthene and pyrene were easier to detect than NAs and phenol and when adding more intensities to generate the EEMs, a greater percentage of the total possible combinations would predict the same best results. Different than NAs and phenol, it was not necessary to have the same specific regions to detect the contaminants. For fluoranthene, when using 3 intensities to train the models, 6% of the total possible combinations produced the same best results (p > 0.05 between the MAEs of the estimation of the contaminant’s concentration). When using 4, 6, and 9 intensities, 7%, 10% and 17% of the total possible combinations produced the same best results, respectively. For pyrene, when using 3, 4, 6, and 9 intensities, 3%, 5%, 7% and 23% of the total possible combinations produced the same best results, respectively. When including more fluorescence wavelengths, the augmentation network received greater information about background signals and was able to fill in missing areas, which helped the network to separate the contaminant’s signals from the background and estimate its concentration. The greater number of wavelengths used also resulted in less sensitivity to the chosen wavelength locations, with a significant number of combinations resulting in optimal performance. Figure 14 shows the MAE of the estimation of NAs and phenol in Okanagan Lake and of fluoranthene and pyrene in Otonabee River, according to the number of intensities used 49 to generate the EEMs. Figure 14. Mean absolute error for contaminant detection according to the number of inputs used to generate the EEMs for naphthenic acids and phenol (left) and fluoranthene and pyrene (right). Each model was trained and tested 8 times and the error bars correspond to the standard deviation. For fluoranthene and pyrene, best results were obtained when using 7 and 5 intensities, respectively. However, there was no significant difference (two-tailed t test p > 0.05) when using 3 to 9 intensities to predict the EEMs. Compared to the linear models with the peak intensities of each contaminant, the method proposed in this project improved fluoranthene results by more than 64.4%. Pyrene, NAs, and phenol were improved by 40.4%, 47.2%, and 71.5%, respectively. Results were as accurate as using the full EEM, for fluoranthene and pyrene, the difference between then MAEs was approximately of 0.020 µg/L. for NAs and phenol, there was no statistical difference between the results obtained with original and the generated EEMs (p > 0.05). The MAE works as a direct representation of the expected error, so it could be interpreted that for NAs, the MAE of 1.59 mg/L indicates the ability to distinguish samples that are different by approximately the same magnitude. In the case of phenol, fluoranthene, and pyrene, a soft representation of the detection limit would be 8.7 µg/L, 0.057 mg/L, and 0.042 mg/L, respectively. The data used were from studies not explicitly designed to test detection limits, or lowest levels of contaminants that could be detected, but rather to cover concentrations ranges 50 that are environmentally relevant. Results showed that the method proposed is able to improve linear models based on few key fluorescence intensities for rapid quantification of fluorescence contaminants and can estimate the concentration of the contaminants as accurate as using the original full EEM. The method proposed could be implemented for rapid quantification of the PAHs pyrene and fluoranthene in natural surface waters contaminated with fuels and fluorescing NAs and phenol in tailings ponds were concentrations considerably high to be detected. The limitations of these methods are determined by the fluorescence signals of the contaminants. If the fluorescence signals of the contaminant are overshadowed by other signals, it results in less accurate models. For high NOM, we would expect the model to recognize these background signals to a certain degree, and to detect when a different signal (contaminant) is in the water. However, for contaminants like phenol where signals are too small to be detected, the model could be limited to differentiate between the high NOM background and the contaminant’s signals. 4.4 Relationship between concentration accuracy and generated EEMs accuracy All models were trained 8 times with random initializations of network weights to get the mean MAE, R2, rc and the standard deviation of reconstructing the original matrix. The metrics were used to compare the results between all the reconstructed EEMs obtained with the different combinations of the single wavelengths chosen as input. In Okanagan Lake, when using 3 inputs to generate the EEMs, no significant difference (p > 0.05) between the mean of the MAE, R2, or rc for all combinations. For the results of the EEMs generated with 9 inputs, the same comparison was made between the mean of the best and worst mean MAE, R2, and rc, and again it was not found any statistical difference (p > 0.05). Also, there was no significant difference (p > 0.05) between the best average MAE R2, and rc when 3 intensities to generate the EEMs, and the best average MAE R2, and rc when using 9 intensities. For Okanagan Lake, the best average MAE was 0.045 with a standard deviation (SD) of 0.0021, R2 was 0.921 with 51 SD of 0.0036, and rc was 0.99 with SD 0.0005. For Otonabee River there was a significant difference (p > 0.005) when using 3 or 4 inputs to generate the EEMs, but not significant difference when between 4 and 9 inputs (p < 0.005). When using 3 intensities, best average MAE was 0.041 ± 0.0007, R2 was 0.863 ± 0.0196, and rc was 0.988 ± 0.0004. When using 4 intensities, best average MAE was 0.040 ± 0.0019, R2 was 0.872 ± 0.0062, and rc was 0.989 ± 0.0009. For 9 inputs, best average MAE was 0.038 ± 0.0009, R2 was 0.879 ± 0.0032, and rc was 0.99 ± 0.0005. It was found that the correct way for getting more accurate contaminant concentrations was not about how well the full EEM was replicated, but how well are replicated the regions near the contaminants. Figure 15 shows a sample of the predicted intensities compared to the original data. Figure 15. Original vs predicted EEMs for Otonabee River. It was necessary to select the appropriate intensities that were related to the contaminants’ peaks, and to get extra details of the EEMs for the accurate estimation of the contaminant concentrations. Regarding phenol, the most difficult contaminant to detect, the difference was found when looking closely at how the predicted intensities compared to the original in the region related to phenol’s fluorescence peak. Lower MAEs in the estimation of the contaminant’s concentration were obtained when the generated EEMs were more similar to the original in this specific zone. Having the most similar generated EEMs to the originals was not 52 necessarily related to having the most accurate estimation of the contaminant’s concentration. Lower reconstruction error could be associated with overfitting, and the observed results indicate it may be worthwhile to consider specific training objectives that focus on fitting key areas rather than focusing on fitting the overall EEM. Figure 16 compares the predicted vs the original EEM, and the MAE obtained for pyrene and phenol, in the regions where the fluorescence peak of each contaminant was located (intensity #2 and #4, respectively). Figure 16. Graphics at the top correspond to the fluorescence spectra at ex=235 nm in Otonabee River of the original and predicted EEMs using a) 3 inputs, b) 4 inputs, and c) 9 inputs to generate the EEMs. Region #2 corresponds to the peak for pyrene detection. Graphics at the bottom are for Okanagan Lake at ex=264 nm using d) 3 inputs, e) 5 inputs and f) 9 inputs to generate the EEMs. Region #4 corresponds to the peak for phenol detection. 4.5 Summary In this chapter, a new method that fuses data from field and lab measurements was implemented to improve in situ predictions of contaminants concentrations based on single fluorescence measurements. Single fluorescence intensities were used as input for an augmentation network to recreate the original EEM and make predictions of contaminants 53 concentration with the generated EEM. Compared to default methods using single wavelength probes, results indicate there are significant improvements using the augmentation network proposed. For NA, phenol, and pyrene, it was possible to estimate their concentrations measuring only 3 fluorescence intensities. Fluoranthene was overshadowed by pyrene and needed at least 4 measurements of fluorescence intensities for its detection. As such, the method proposed could be used to improve the default methods using field measurements, by simply adding a few lab measurements of the full fluorescence spectra. However, the method has some limitation when multiple contaminants fluoresce in similar regions. It was also showed that the most accurate estimations of the concentrations of the contaminants were obtained when the EEMs were generated using the intensities related to the peak of the specific contaminant and some extra fluorescence intensities related to humic-like zones to consider the background behavior. Finally, it was shown that it is not as important how well the full EEM was replicated, but the specific regions near the contaminant’s fluorescence peaks. 54 Chapter 5: Unsupervised classification of toxic contaminants in natural surface waters This chapter proposes a new method for the unsupervised detection of toxic contaminants in natural surface waters. An unsupervised approach was investigated to address the significant challenges associated with acquiring labelled data for environmental monitoring. The method consists of training a convolutional variational autoencoder (CVAE) to reduce the dimensionality of the fluorescence EEMs. The encoded representation of the EEM is then classified with the K-means clustering method. A CVAE was preferred over a regular convolutional autoencoder due to the probabilistic representation manner for describing an observation in latent space. The presented approach is implemented on water samples contaminated with naphthenic acids and phenol. The spills or loss of containment of these contaminants represent a significant risk to the environment and public health, requiring accurate and rapid detection methods to protect the surrounding aquatic environment. Results were compared with models based on principal component analysis and a regular autoencoder, showing that the CVAE had improved performance due to the smooth latent representations of the input data. Water samples contaminated with only NAs had the highest accuracy scores. The model classified water samples contaminated with NAs and phenol as if they were only contaminated with NAs, since NAs signals overshadowed phenol signals. Results suggested that unsupervised learning can rapidly detect toxic contaminants in the aquatic environment at environmentally relevant concentrations. 55 5.1 Variational autoencoder The first step consisted of training the CVAE to encode the EEM into a latent vector of 2 dimensions, and from it reconstruct the EEM. The encoded part of the CVAE was used to train the K-means model to classify the encoded vector into the 4 classes expected to be detected (water contaminated with NAs, phenol, both NAs and phenol, not contaminated). The mutual information gap (MIG) was used to evaluate the disentanglement of the different CVAEs. The disentanglement metric, MIG, for NAs and phenol concentrations was less than 0.4 for both vectors, meaning that the encoded representation of the CVAE did not represent the concentrations of either contaminant individually. The Rand score for the 4 classes was 0.591. β-CVAEs consist of adding an extra hyperparameter β to the KL loss of a CVAE. It constricts the encoding capacity of the latent bottleneck and helps the latent representation to be more factorized (Burgess et al., 2018). To improve the MIG and Rand score results, different experiments were conducted by modifying the β value of the KL loss between 0.001 to 100, and the dropout between 0 to 40% in the first layer. Contrary as expected for a Beta CVAE, best results on the classification accuracy were obtained when small values of β were used to encode the EEM. Values of β > 1 are expected to result in more disentangled latent representations z, however, they often lead to a trade-off between the fidelity of β-CVAE reconstructions and the disentangled nature of its latent code z. This is due to the loss of information as it passes through the restricted capacity latent bottleneck z (Burgess et al., 2018). In none of the cases, the MIG was higher than 0.5, which means that the CVAE was not able to disentangle between the 4 classes proposed (not contaminated, contaminated with just NAs, contaminated with just phenol, and contaminated with both NAs and phenol). The reason that the CVAE was not able to disentangle between those 4 classes, could be that NAs were overshading phenol signals. NAs were spiked at relatively higher concentrations between 0 to 50 mg/L, while phenol between 0 to 100 µg/L, making phenol signals harder to detect. For high 56 values of β, the total loss of the CVAE returned high values and low Rand score. The models were trained until both the KL and reconstruction loss were stable. It was also observed that including a 10% dropout rate to the first layer of the CVAE encoder improved the Rand score compared to not adding dropout or adding more than 10%. The dropout consisted of randomly setting input units to 0 to prevent overfitting. A low level of dropout helped to include some regularization and improved results. It is recommended to keep a low rate of dropout because high rates can slow the convergence rate of the model and hurt the final performance. Srivastava et al. (2014) showed that dropout improved the performance of neural networks on supervised learning tasks in vision, speech recognition, document classification and computational biology. The highest Rand score was obtained when a combination of 10% dropout and β of 0.01 were used to build the encoder. The performance of β and dropout on according to the Rand score and the total loss are presented in Figure 17. Figure 17. Total loss and Rand score according to the B value implemented, and the dropout rate. Varying detection thresholds were applied to phenol and NAs concentrations (concentrations below the threshold were classified as non-contaminated) to improve performance. Furthermore, varying detection thresholds were used to investigate at what level 00.010.020.030.040.050.060.070.080.001 0.01 0.1 1 10 100Total lossβNo dropoutDropout 10%Dropout 20%Dropout 40%0.520.540.560.580.60.620.640.660.001 0.01 0.1 1 10 100Classification accuracyβNo dropoutDropout 10%Dropout 20%Dropout 40%57 the model would be able to distinguish between impacted and non-impacted samples or establish a pseudo-detection threshold. Figure 18 shows the center of the clusters obtained by the K-mean clustering according to the different thresholds in NAs and phenol’s concentrations. Figure 18.a shows that water samples contaminated with just NAs, or both NAs and phenol, were not differentiable. Water samples not contaminated or just contaminated with phenol could also not be differentiated as there was not a clear difference between any of these groups. Phenol concentrations lower than 10 µg/L were counted as not contaminated to identify if higher concentrations could be detectable. However, there was no significant improvement in the Rand score (<1%). As such, initial iterations of the unsupervised approach did not show the capability to detect and differentiate samples with and without phenol. The problem was also formulated only to consider samples impacted or not impacted by NAs. Figure 18.b shows water samples contaminated with only NAs, or not contaminated. In this case, the Rand score improved to 0.672. From Figure 18.b there was a division between water samples contaminated with NAs / not contaminated; however, water samples with low concentrations of NAs were mixed with the water samples not contaminated. To establish NA detection limits, the threshold of NAs to be counted as contaminated was increased every 1 mg/L. The Rand score results determined that the highest accuracy was obtained at a threshold of 16 mg/L. Figure18.c shows results at a threshold of 16 mg/L, with a Rand score of 0.935, Figure 18.d shows the change in the Rand score according to the threshold in the concentration of NAs. The model was not able to detect phenol, however, it was able to detect NAs at relevant environmental concentrations. Figure 18.d shows a decrease in Rand score to 0.925 when the threshold is 16 mg/L - 19 mg/L, and at 20 mg/L the rand score decreases again to 0.885. The observed decrease is likely because for concentrations higher than 20 mg/L, the model classified them as contaminated with NAs, instead of not contaminated. Threshold moving results imply that for NA concentrations higher than 16 mg/L, the model will identify water 58 samples contaminated with NAs with a Rand score of 0.935, F score of 0.97, and Brier score of 0.02. The Brier score was calculated to evaluate the accuracy of the probabilistic predictions. The Brier score range from 0 to 1 and low values of the Brier score indicate a greater accuracy. The value obtained indicates high accuracy in the probability predictions. Figure 18. Encoded representation of the CVAE, and the centers obtained by the K-means method to classify the data. Figure a) corresponds to the K-means method trained to classify the data between 4 classes (not contaminated, contaminated with NAs, contaminated with phenol, and both NAs and phenol). Figure b) corresponds to the K-means trained to classify between not contaminated and contaminated with NAs. Figure C) corresponds to K-means trained to classify between not contaminated and contaminated with NAs > 12 mg/L. And Figure d) corresponds to the Rand score obtained according to the Threshold set for NAs concentration. 0.70.750.80.850.90.950 5 10 15 20Rand scoreThreshold mg/Lb) Classes Not contaminated Just NAs Just phenol Both NAs and phenol a) Classes Not contaminated NAs dd) c) Classes Not contaminated NAs 59 Figure 19 shows a continuous distribution of the different EEMs by interpolating across the latent space. The images were generated using the decoder model to reconstruct the latent space representation into 2D images with the exact dimensions as the original EEMs. The latent space corresponds to a simple representation of compressed data in which similar data points are closer together in space. From the latent space visualization, it can be noticed that the EEMs with background of negatives values (dark blue background) correspond to higher concentrations of NAs. EEMs of water samples not contaminated with NAs can be recognized with background values between 0 and 40 (light blue colors). On the background with negative values (NA contaminated), NAs can be observed in the EEMs with values between 0 to 40 (light blue colors) on the left-bottom part of the EEM. Phenol signals were overshadowed by NAs, which could be why the autoencoder could not differentiate between water samples contaminated with NAs or phenol. Moving through the x-axis in the continuous distributions of the EEMs, the left side of the distribution corresponds to water samples not contaminated with NA. The right side of the distribution corresponds with water samples contaminated with NA, and over the y-axis the concentration of NA increases from the bottom to top. From Figure 19 we can also see that the CVAE ignored NOM signals. The generated EEMs show that the CVAE did not focus on recreating the background information but was looking for the contaminant. The absence of NOM signals in the reduced dimensions could indicate that either NOM did not greatly impact the model, or that NOM signals were effectively ignored. This could be partly due to the dataset used, and background waters with higher variability in background signals may be interpreted differently by a CVAE. 60 Figure 19. Matrix of the continuous distribution of the EEMs produced by the decoder part of the CVAE. 5.2 PCA and conventional autoencoder PCA and a conventional autoencoder with the same structure proposed for the CVAE were used to compare the results. Figure 20 shows the center of the K-means clusters and the different classes to be detected for the PCA model. Figure 20 shows that there was no clear separation between water samples contaminated with both NAs and phenol, and just NAs. It also shows that water samples not contaminated or contaminated with phenol could not be separated. The Rand score for the classification of the 4 classes (not contaminated, contaminated with just NAs, contaminated with just phenol, and contaminated with both NAs and phenol) was 0.513. The problem was simplified to detect between not contaminated and 61 contaminated with NAs, with the threshold of 12 mg/L. Figure 20.b shows a clear division between the 2 classes, with a Rand score of 0.837. Similar results were obtained in classifying the 4 classes for the regular autoencoder. Figure 20.c shows the separation of the 4 classes for the regular autoencoder, with a Rand score of 0.571. Figure 20.d shows the division between not contaminated and contaminated with NAs > 12 mg/L. The Rand score was 0.573, which indicated that for the regular autoencoder, the threshold for the model to detect between not contaminated and contaminated with NAs was higher than for the PCA and the CVAE models. Table 3 summarizes the Rand scores of the PCA and regular autoencoder according to the different classifications. Table 3. Summary of the Rand score obtained according to each reduction dimensionality technique. Model Rand score: 4 classes (not contaminated, NAs, phenol, both) Rand score: 2 classes (not contaminated and NAs > 12 mg/L) PCA 0.513 0.837 Regular autoencoder 0.571 0.573 62 Figure 20. Visualization of the encoded representation of the EEMs according to the dimensionality reduction technique implemented. Figure a) corresponds to the representation of the 2 principal components obtained by the PCA method, and the centers obtained by the K-means algorithm trained to return 4 classes (not contaminated, contaminated with NAs, contaminated with phenol, contaminated with both NAs and phenol). Figure b) corresponds to the 2 principal components obtained by the PCA method, and the centers obtained by the K-means method trained to classify the data between 2 classes (not contaminated or contaminated with NAs > 12mg/L). Figure c) corresponds to the encoded representation of a regular autoencoder, and the centers obtained by the K-means algorithm trained to return 4 classes. And figure d) corresponds to the encoded representation of a regular autoencoder, and the centers obtained by the K-means algorithm trained to return 2 classes. + Classes Not contaminated Just NAs Just phenol Both NAs and phenol Classes Not contaminated NAs Classes Not contaminated NAs Classes Not contaminated Just NAs Just phenol Both NAs and phenol 63 5.3 Summary This chapter proposed a new method for unsupervised detection of NA and phenol using full EMM. A CVAE was used to reduce the EEM dimensionality, and K-means algorithm was used to classify the water samples. Water samples contaminated with phenol could not be distinguished from any of the other water samples not contaminated, or contaminated with NA. This could be due to phenol signals were overshadowed by NA signals. Compared to the default methods using PCA and a regular autoencoder, CVAE improved in detecting water samples contaminated with NAs, by learning a smooth latent state representation of the EEMs. One of the proposed method's limitations is to separate fluorescence signals when multiple contaminants fluoresce in similar regions, as in the case of phenol. 64 Chapter 6: Conclusions 6.1 Summary of contributions Results showed that several approaches to interpreting fluorescence excitation-emission matrices could accurately quantify NA standard, phenol, pyrene, and fluoranthene concentrations in natural surface waters. As such, this technology could be utilized to rapidly identify the impacts of OSPW on the environment or natural waters contaminated by the production of petroleum products. The summary of contributions of this thesis can be summarized as follows. Multilayer perceptrons and convolutional neural networks can be implemented to interpret EEMs without other dimensionality reduction techniques. A standard method to implement fluorescence monitoring methods for contaminant detection is to apply dimensionality reduction algorithms to separate signals of interest (contaminants) from background interference, such as humic-like fluorophores in natural organic matter. It would be advantageous not to require data pre-processing by a dimensionality reduction technique like PCA or PARAFAC to reduce analysis time, potentially limit information loss, and eliminate the need for expert supervision of the process. This work investigated the novel application of machine learning techniques to interpret the entire fluorescence spectra for contaminant detection directly. When using the full EEM and MLPs and CNNs to quantify contaminants concentrations, results showed that depth is not advantageous for MLPs, however CNNs responded well to increasing depth and optimized accuracy with > 5 hidden layers. CNNs ultimately resulted in the best performance for predicting phenol, the more difficult and lower concentration contaminant. In the context of spiked NA concentrations and concentrations expected in the environment, variation in NA prediction accuracy was low (changes in error < 1 mg/L when spiked between 0 and 50 mg/L). Overall, CNNs were well suited for fluorescence 65 spectral analysis, likely due to improved consideration of spatial dependence in the spectra, hierarchical feature representation with increasing network depth, and decreasing dimensionality of feature maps from pooling layers. According to the occlusion method, CNNs produced smooth and realistic heat maps of spectral area importance compared to MLPs, which could have resulted in superior performance. However, both CNNs and MLPs looked at reasonable spectral areas for both NAs and phenol detection, indicating that these ‘black box’ or data-driven methods are appropriate for contaminant detection using spectroscopy data. Models are limited to NA standards, and any non-fluorescence NAs would not be detected. Furthermore, it is suggested that it is unnecessary to apply dimensionality reduction before using fluorescence spectra for contaminant detection if appropriately powerful models, such as CNNs, are used. The models proposed work as a screening tool to know whether there is an impact or not of NA standard and phenol. Data fusion between field and lab measurements can improve rapid quantification of NAs, phenol, pyrene and fluoranthene in natural surface waters. In-situ measurements of fluorescence intensities, where the data is often limited to single wavelength probes provided a more limited capacity for accurate contaminant detection. Study results showed that field-acquired data and singular wavelength pairs can be augmented to improve the quantification of fluorescing contaminants in natural surface waters. Compared to the default methods using single wavelength probes, results indicate significant improvements to data fusion with lab-based data. Therefore, the proposed method could improve the default methods using field measurements by adding a few lab measurements of the full fluorescence spectra. For NAs, phenol, and pyrene, it is possible to estimate contaminant concentrations by measuring only 3 fluorescence intensities to generate the synthetic fluorescence spectra. Fluoranthene was overshadowed by pyrene and needed at least 4 measurements of fluorescence intensities for its detection. As such, the proposed method can be limited when 66 multiple contaminants fluoresce in similar regions. While it may be expected that a sufficiently powerful regression method could separate individual signals, this would likely require significant data where the two contaminants varied independently. Overshadowed signals also suggest that indicator contaminants, such as pyrene that may be more soluble and have relatively high quantum yields, could indicate the potential presence of other often concurrent contaminants such as fluoranthene. It was also shown that how well the full EEM was replicated is not as important, but the specific regions near the contaminant’s fluorescence peaks are not as important. The most accurate estimations of the concentrations of the contaminants were obtained when the EEMs were generated using the intensities related to the peak of the specific contaminant and some extra fluorescence intensities related to humic-like zones to consider the background behavior. This implies that some knowledge of the potential pollutant and background water signals would be needed for optimal results. However, in many environmental monitoring applications, the compounds of interest are known, such as identifying potential loss of containment from storage. The data fusion or augmentation approach could be utilized to identify environmental impacts accurately and rapidly. The next step could be to test in real life the method proposed for field quantification of the contaminants studied. For more accurate results, it could be implemented on tailing ponds where concentrations are higher. It could also be implemented to detect many other contaminants that are fluorophore. A variational autoencoder combined with k-means algorithm can be implement for rapid detection of contaminants in natural surface waters. For rapid detection of contaminants in natural surface waters, were labelled data is not available with the contaminants concentrations, results suggest that unsupervised learning can be implemented as a screening method to detect water contaminated with NAs in natural surface 67 waters. Compared to the default methods using PCA and a regular autoencoder, CVAE results indicate an improvement in detecting water samples contaminated with NAs. Therefore, the CVAE proposed could be used to rapidly detect toxic contaminants in natural water and improve the default methods by learning a smooth latent state representation of the EEMs. Phenol was overshadowed by NAs and was not able to be detected by the unsupervised models. This implies that for optimal results, signals of toxic contaminants should be easy to separate, for the unsupervised model to be able to detect them. In many environmental monitoring applications, there is a lack of labelled data for supervised training. As such, unsupervised models such as CVAE and K-means clustering could be utilized as a rapidly screening method to detect an anomaly in the natural surface water. The next step could be to put into practice the unsupervised method proposed for anomaly detection in natural surface waters. For better results It would be necessary to implement new methods to balance the classes, or to implement a different classification model that does not required classes to be balanced. It would be also necessary to have data large enough to train the model and to have enough data related to a contaminant event in the natural water source. 6.2 Limitations About chapter 3, The major limitations when using machine learning algorithms such as the MLP and CNN are related to overfitting and interpretability. It is important to make sure the models are not overfitting to ensure predictions are trustworthy. For this, the models were tested on a test dataset that was not used during the training. About the interpretability, an occlusion method was implemented to identify if the models were making predictions based on reasonable regions of the data. From the occlusion method it was shown that both the MLP and the CNN were making prediction based on the peak intensities of NA and phenol. 68 Regarding chapter 4, the biggest limitation for in situ detection was related to the fluorescence peak of the contaminant. The contaminants that had their peak intensities overlapped with organic matter or another contaminant, had the highest MAE. For example, in the case of phenol, its fluorescence peak was being overlapped by NA. NA’s fluorescence peak was located near phenol’s, and NA’s concentrations (0-50 mg/L) were much higher than phenol’s (0-100 µg/L). The same case occurred for pyrene, its signals were being overshadowed by fluoranthene’s, which resulted in less accurate predictions. In chapter 5, the limitations were also related to the peak signals of the contaminants. It was not possible to separate water samples contaminated with phenol from water samples contaminated with NA, due to low concentrations of phenol compared to NA. K-means is also limited to balanced classes to make clusters. For better predictions, it would be necessary to make efforts, like data augmentation, to balance the classes. 6.3 Future Research For future research, it would be interesting to test in real life the method proposed in chapter 4 for field quantification of the contaminants studied. For more accurate results, it could be implemented on tailing ponds where concentrations are higher. For this, it can be used an instrument for field fluorescence measurements such as Cyclops Submersible Sensors from Turner designs, YSI, or Fluo Sens Integrated from Dialunox, to measure the fluorescence ex/em pairs selected according to the peak intensity of the contaminant, and background information related to NOM. The fluorescence intensities measured in site can be used as input for the augmentation network, and from them make the predictions on the contaminant’s concentration. It would also be interesting to put into practice in real life the unsupervised method proposed in chapter 5 for anomaly detection in natural surface waters. For this it could be necessary to implement new methods for the unbalanced class, such as data augmentation. It would also be 69 necessary to have available a data large enough to train the model and to have enough data related to a contaminant event in the natural water source. 70 Bibliography Abdel-Shafy, H. I., & Mansour, M. S. (2016). A review on polycyclic aromatic hydrocarbons: source, environmental impact, effect on human health and remediation. Egyptian journal of petroleum, 25(1), 107-123. Acquarelli, Jacopo, et al. "Convolutional neural networks for vibrational spectroscopic data analysis." Analytica chimica acta 954 (2017): 22-31. Alberta Energy Regulator (2021) State of Fluid Tailings Management for Mineable Oil Sands, 2020. Alberta Energy Regulator. Allen EW (2008) Process water treatment in Canada’s oil sands industry: I. Target pollutants and treatment objectives. Journal of Environmental Engineering and Science 7:123–138. https://doi.org/10.1139/S07-038. Almeda, R., Wambaugh, Z., Wang, Z., Hyatt, C., Liu, Z., & Buskey, E. J. (2013). Interactions between zooplankton and crude oil: toxic effects and bioaccumulation of polycyclic aromatic hydrocarbons. PloS one, 8(6), e67212. Alostaz, M. D., Biggar, K., Donahue, R., & Hall, G. (2008). Petroleum contamination characterization and quantification using fluorescence emission-excitation matrices (EEMs) and parallel factor analysis (PARAFAC). Journal of environmental engineering and science, 7(3), 183-197. Ammenberg, P., Flink, P., Lindell, T., Pierson, D., & Strombeck, N. (2002). Bio-optical modelling combined with remote sensing to assess water quality. International Journal of Remote Sensing, 23(8), 1621-1638. An, J., & Cho, S. (2015). Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1), 1-18. 71 Anderson J, Wiseman SB, Moustafa A, et al (2012) Effects of exposure to oil sands process-affected water from experimental reclamation ponds on Chironomus dilutus. Water Research 46:1662–1672. https://doi.org/10.1016/j.watres.2011.12.007. Anumol, T., Sgroi, M., Park, M., Roccaro, P., & Snyder, S. A. (2015). Predicting trace organic compound breakthrough in granular activated carbon using fluorescence and UV absorbance as surrogates. Water research, 76, 76-87. Azizjon, M., Jumabek, A., & Kim, W. (2020, February). 1D CNN based network intrusion detection with normalization on imbalanced data. In 2020 International Conference on Artificial Intelligence in Information and Communication (ICAIIC) (pp. 218-224). IEEE. Bank, D., Koenigstein, N., & Giryes, R. (2020). Autoencoders. arXiv preprint arXiv:2003.05991. Barrias, A., Casas, J. R., & Villalba, S. (2016). A review of distributed optical fiber sensors for civil engineering applications. Sensors, 16(5), 748. Barrow, M. P., Headley, J. V., Peru, K. M., & Derrick, P. J. (2009). Data visualization for the characterization of naphthenic acids within petroleum samples. Energy & Fuels, 23(5), 2592-2599. Bhanja, S., & Das, A. (2018). Impact of data normalization on deep neural network for time series forecasting. arXiv preprint arXiv:1812.05519. Bieroza M, Baker A, Bridgeman J (2011) Classification and calibration of organic matter fluorescence data with multiway analysis methods and artificial neural networks: an operational tool for improved drinking water treatment. Environmetrics 22:256–270. https://doi.org/10.1002/env.1045. 72 Botalb, A., Moinuddin, M., Al-Saggaf, U. M., & Ali, S. S. (2018, August). Contrasting convolutional neural network (CNN) with multi-layer perceptron (MLP) for big data analysis. In 2018 International conference on intelligent and advanced system (ICIAS) (pp. 1-5). IEEE. Bridgeman J, Bieroza M, Baker A (2011) The application of fluorescence spectroscopy to organic matter characterisation in drinking water treatment. Rev Environ Sci Biotechnol 10:277. https://doi.org/10.1007/s11157-011-9243-x. Bro, R. 1997. PARAFAC. Tutorial and applications. Chemometrics and Intelligent Laboratory Systems. 38(2), 149-171. Brook, J. R., Cober, S. G., Freemark, M., Harner, T., Li, S. M., Liggio, J., ... & Pauli, B. (2019). Advances in science and applications of air pollution monitoring: A case study on oil sands monitoring targeting ecosystem protection. Journal of the Air & Waste Management Association, 69(6), 661-709. Burgess, C. P., Higgins, I., Pal, A., Matthey, L., Watters, N., Desjardins, G., & Lerchner, A. (2018). Understanding disentangling in $\beta $-VAE. arXiv preprint arXiv:1804.03599. Campello, R. J. (2007). A fuzzy extension of the Rand index and other related indexes for clustering and classification assessment. Pattern Recognition Letters, 28(7), 833-841. Canet, R., Birnstingl, J. G., Malcolm, D. G., Lopez-Real, J. M., & Beck, A. J. (2001). Biodegradation of polycyclic aromatic hydrocarbons (PAHs) by native microflora and combinations of white-rot fungi in a coal-tar contaminated soil. Bioresource technology, 76(2), 113-117. 73 Carstea EM, Baker A, Bieroza M, Reynolds D (2010) Continuous fluorescence excitation–emission matrix monitoring of river organic matter. Water Research 44:5356–5366. https://doi.org/10.1016/j.watres.2010.06.036. Castanedo, F. (2013). A review of data fusion techniques. The scientific world journal, 2013. Chen, M., S. H. Kim, H. J. Jung, J. H. Hyun, J. H. Choi, H. J. Lee, I. A. Huh, and J. Hur. 2017. "Dynamics of dissolved organic matter in riverine sediments affected by weir impoundments: Production, benthic flux, and environmental implications." Water Res 121:150-161. doi: 10.1016/j.watres.2017.05.022. Chen, S., Yu, Y. L., & Wang, J. H. (2018). Inner filter effect-based fluorescent sensing systems: a review. Analytica chimica acta, 999, 13-26. Clevert, D. A., Unterthiner, T., & Hochreiter, S. (2015). Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289. Coble PG, Lead J, Baker A, et al (eds) (2014) Aquatic Organic Matter Fluorescence. Cambridge University Press, Cambridge. D'Andrilli, Juliana, Christine M. Foreman, Michael Sigl, John C. Priscu, and Joseph R. McConnell. 2017. "A 21 000-year record of fluorescent organic matter markers in the WAIS Divide ice core." Climate of the Past 13 (5):533-544. doi: 10.5194/cp-13-533-2017. Deng, W., Guo, Y., Liu, J., Li, Y., Liu, D., & Zhu, L. (2019). A missing power data filling method based on improved random forest algorithm. Chinese Journal of Electrical Engineering, 5(4), 33-39. 74 Driskill AK, Alvey J, Dotson AD, Tomco PL (2018) Monitoring polycyclic aromatic hydrocarbon (PAH) attenuation in Arctic waters using fluorescence spectroscopy. Cold Regions Science and Technology 145:76–85. https://doi.org/10.1016/j.coldregions.2017.09.014. Dzierżak, R. (2019). Comparison of the influence of standardization and normalization of data on the effectiveness of spongy tissue texture classification. Informatyka, Automatyka, Pomiary w Gospodarce i Ochronie Środowiska, 9. Ferretto N, Tedetti M, Guigue C, et al (2014) Identification and quantification of known polycyclic aromatic hydrocarbons and pesticides in complex mixtures using fluorescence excitation–emission matrices and parallel factor analysis. Chemosphere 107:344–353. https://doi.org/10.1016/j.chemosphere.2013.12.087. Foo, K. Y., & Hameed, B. H. (2010). Detoxification of pesticide waste via activated carbon adsorption process. Journal of hazardous materials, 175(1-3), 1-11. Frank RA, Roy JW, Bickerton G, et al (2014) Profiling Oil Sands Mixtures from Industrial Developments and Natural Groundwaters for Source Identification. Environ Sci Technol 48:2660–2670. https://doi.org/10.1021/es500131k. Fränti, P., & Sieranoja, S. (2018). K-means properties on six clustering benchmark datasets. Applied intelligence, 48(12), 4743-4759. Gamal El-Din M, Fu H, Wang N, et al (2011) Naphthenic acids speciation and removal during petroleum-coke adsorption and ozonation of oil sands process-affected water. Science of The Total Environment 409:5119–5125. https://doi.org/10.1016/j.scitotenv.2011.08.033. García, S., Luengo, J., & Herrera, F. (2015). Data preprocessing in data mining (Vol. 72, pp. 59-139). Cham, Switzerland: Springer International Publishing. 75 Giesy JP, Anderson JC, Wiseman SB (2010) Alberta oil sands development. Proceedings of the National Academy of Sciences 107:951–952. https://doi.org/10.1073/pnas.0912880107. Gilpin LH, Bau D, Yuan BZ, et al (2018) Explaining Explanations: An Overview of Interpretability of Machine Learning. In: 2018 IEEE 5th International Conference on Data Science and Advanced Analytics (DSAA). pp 80–89. Goodfellow I, Bengio Y, Courville A (2016) Deep Learning. MIT Press. Grewer DM, Young RF, Whittal RM, Fedorak PM (2010) Naphthenic acids and other acid-extractables in water samples from Alberta: What is being measured? Science of The Total Environment 408:5997–6010. https://doi.org/10.1016/j.scitotenv.2010.08.013. Guidotti R, Monreale A, Ruggieri S, et al (2019) A Survey of Methods for Explaining Black Box Models. ACM Comput Surv 51:1–42. https://doi.org/10.1145/3236009. Hatami N, Gavet Y, Debayle J (2018) Classification of time-series images using deep convolutional neural networks. In: Tenth International Conference on Machine Vision (ICMV 2017). SPIE, pp 242–249. Hamzah, F. B., Hamzah, F. M., Razali, S. F. M., & Samad, H. (2021). A comparison of multiple imputation methods for recovering missing data in hydrological studies. Civil Engineering Journal, 7(9), 1608-1619. He, C., Zhu, S., Wu, X., Zhou, J., Chen, Y., Qian, X., & Ye, J. (2022). Accurate Tumor Subtype Detection with Raman Spectroscopy via Variational Autoencoder and Machine Learning. ACS omega, 7(12), 10458-10468. 76 Hedley, J. D., Roelfsema, C. M., Phinn, S. R., & Mumby, P. J. (2012). Environmental and sensor limitations in optical remote sensing of coral reefs: Implications for monitoring and sensor design. Remote Sensing, 4(1), 271-302. Headley JV, Peru KM, Mohamed MH, et al (2013) Chemical fingerprinting of naphthenic acids and oil sands process waters—A review of analytical methods for environmental samples. Journal of Environmental Science and Health, Part A 48:1145–1163. https://doi.org/10.1080/10934529.2013.776332. Holowenko FM, MacKinnon MD, Fedorak PM (2002) Characterization of naphthenic acids in oil sands wastewaters by gas chromatography-mass spectrometry. Water Research 36:2843–2855. https://doi.org/10.1016/S0043-1354(01)00492-4. Hou, X., Shen, L., Sun, K., & Qiu, G. (2017, March). Deep feature consistent variational autoencoder. In 2017 IEEE winter conference on applications of computer vision (WACV) (pp. 1133-1141). IEEE. Huang, R., Chen, Y., Meshref, M. N., Chelme-Ayala, P., Dong, S., Ibrahim, M. D., ... & El-Din, M. G. (2018). Monitoring of classical, oxidized, and heteroatomic naphthenic acids species in oil sands process water and groundwater from the active oil sands operation area. Science of the Total Environment, 645, 277-285. Hudson, N., Baker, A., & Reynolds, D. (2007). Fluorescence analysis of dissolved organic matter in natural, waste and polluted waters—a review. River research and applications, 23(6), 631-649. Joe, H. E., Yun, H., Jo, S. H., Jun, M. B., & Min, B. K. (2018). A review on optical fiber sensors for environmental monitoring. International journal of precision engineering and manufacturing-green technology, 5(1), 173-191. 77 Jørgensen, Linda, Colin A. Stedmon, Theis Kragh, Stiig Markager, Mathias Middelboe, and Morten Søndergaard. 2011. "Global trends in the fluorescence characteristics and distribution of marine dissolved organic matter." Marine Chemistry 126 (1-4):139-148. doi: 10.1016/j.marchem.2011.05.002. Karamizadeh, S., Abdullah, S. M., Manaf, A. A., Zamani, M., & Hooman, A. (2020). An overview of principal component analysis. Journal of Signal and Information Processing, 4. Kavanagh RJ, Burnison BK, Frank RA, et al (2009) Detecting oil sands process-affected waters in the Alberta oil sands region using synchronous fluorescence spectroscopy. Chemosphere 76:120–126. https://doi.org/10.1016/j.chemosphere.2009.02.007. Kavanagh RJ, Frank RA, Burnison BK, et al (2012) Fathead minnow (Pimephales promelas) reproduction is impaired when exposed to a naphthenic acid extract. Aquatic Toxicology 116–117:34–42. https://doi.org/10.1016/j.aquatox.2012.03.002. Keith, L. H. (2015). The source of US EPA's sixteen PAH priority pollutants. Polycyclic Aromatic Compounds, 35(2-4), 147-160. Kingma, D. P., & Welling, M. (2019). An introduction to variational autoencoders. Foundations and Trends® in Machine Learning, 12(4), 307-392. Korak JA, Dotson AD, Summers RS, Rosario-Ortiz FL (2014) Critical analysis of commonly used fluorescence metrics to characterize dissolved organic matter. Water Research 49:327–338. https://doi.org/10.1016/j.watres.2013.11.025. Korth, B., & Tucker, L. R. (1975). The distribution of chance congruence coefficients from simulated data. Psychometrika, 40(3), 361-372. 78 Lakowicz, J. R. (Ed.). (2006). Principles of fluorescence spectroscopy. Boston, MA: springer US. Lakowicz, J.R. (2013) Principles of fluorescence spectroscopy, Springer science & business media. Lambert, T., Bouillon, S., Darchambeau, F., Massicotte, P., & Borges, A. V. (2016). Shift in the chemical composition of dissolved organic matter in the Congo River network. Biogeosciences, 13(18), 5405-5420. Lawaetz AJ, Stedmon CA (2009) Fluorescence Intensity Calibration Using the Raman Scatter Peak of Water. Appl Spectrosc, AS 63:936–940. LeCun Y, Bengio Y, Hinton G (2015) Deep learning. Nature 521:436–444. https://doi.org/10.1038/nature14539. Le, Q., Miralles-Pechuán, L., Kulkarni, S., Su, J., & Boydell, O. (2020). An overview of deep learning in industry. Data Analytics and AI, 65-98. Lee, S., Kwak, M., Tsui, K. L., & Kim, S. B. (2019). Process monitoring using variational autoencoder for high-dimensional nonlinear processes. Engineering Applications of Artificial Intelligence, 83, 13-27. Lee, I., & Shin, Y. J. (2020). Machine learning for enterprises: Applications, algorithm selection, and challenges. Business Horizons, 63(2), 157-170. Lei, Z., Wang, B., Wang, K., Pei, Y., & Huang, Z. (2021). Photovoltaic power missing data filling based on multiple matching and long‐and short‐term memory network. International Transactions on Electrical Energy Systems, 31(4), e12829. 79 Li C, Fu L, Stafford J, et al (2017) The toxicity of oil sands process-affected water (OSPW): A critical review. Science of The Total Environment 601–602:1785–1802. https://doi.org/10.1016/j.scitotenv.2017.06.024 Li C, Singh A, Klamerth N, et al (2014) Synthesis of Toxicological Behavior of Oil Sands Process-Affected Water Constituents. Oil Sands Research and Information Network, University of Alberta, School of Energy and the Environment, Edmonton, Alberta. Li L, Wang Y, Zhang W, et al (2020) New advances in fluorescence excitation-emission matrix spectroscopy for the characterization of dissolved organic matter in drinking water treatment: A review. Chemical Engineering Journal 381:122676. https://doi.org/10.1016/j.cej.2019.122676 Li Z, Peleato NM (2021) Comparison of Dimensionality Reduction Techniques for Cross-Source Transfer of Fluorescence Contaminant Detection Models. Chemosphere 130064. https://doi.org/10.1016/j.chemosphere.2021.130064 Lin, H., and L. Guo. 2020. "Variations in Colloidal DOM Composition with Molecular Weight within Individual Water Samples as Characterized by Flow Field-Flow Fractionation and EEM-PARAFAC Analysis." Environ Sci Technol 54 (3):1657-1667. doi: 10.1021/acs.est.9b07123. Liu, C. W., Lin, K. H., & Kuo, Y. M. (2003). Application of factor analysis in the assessment of groundwater quality in a blackfoot disease area in Taiwan. Science of the total environment, 313(1-3), 77-89. Liu, X., & Wang, M. (2018). Gap filling of missing data for VIIRS global ocean color products using the DINEOF method. IEEE Transactions on Geoscience and Remote Sensing, 56(8), 4464-4476. 80 Liu, Y., Yang, L., Bai, Q., Li, W., Zhang, Y., Fu, Y., & Ye, F. (2021). Highly efficient nondoped blue electroluminescence based on hybridized local and charge-transfer emitter bearing pyrene-imidazole and pyrene. Chemical Engineering Journal, 420, 129939. Lo, M. K., Loh, D. R., Chian, S. C., & Ku, T. (2023). Probabilistic Prediction of Consolidation Settlement and Pore Water Pressure Using Variational Autoencoder Neural Network. Journal of Geotechnical and Geoenvironmental Engineering, 149(1), 04022119. Lu W, Ewanchuk A, Perez-Estrada L, et al (2013) Limitation of fluorescence spectrophotometry in the measurement of naphthenic acids in oil sands process water. Journal of Environmental Science and Health, Part A 48:429–436. https://doi.org/10.1080/10934529.2013.729802 Madison, B. N., Reynolds, J., Halliwell, L., Leshuk, T., Gu, F., Peru, K. M., ... & Orihel, D. M. (2020). Can the toxicity of naphthenic acids in oil sands process-affected water be mitigated by a green photocatalytic method? Facets, 5(1), 474-487. Mahaffey A, Dubé M (2017) Review of the composition and toxicity of oil sands process-affected water. Environ Rev 25:97–114. https://doi.org/10.1139/er-2015-0060 Maie, N., Yamashita, Y., Cory, R.M., Boyer, J.N., Jaffe, R., 2012. Application of excitation emission matrix fluorescence monitoring in the assessment of spatial and seasonal drivers of dissolved organic matter composition: sources and physical disturbance controls. Appl. Geochem. 27, 917e929. Masliyah J, Zhou ZJ, Xu Z, et al (2004) Understanding Water-Based Bitumen Extraction from Athabasca Oil Sands. The Canadian Journal of Chemical Engineering 82:628–654. https://doi.org/10.1002/cjce.5450820403. 81 Meng, T., Jing, X., Yan, Z., & Pedrycz, W. (2020). A survey on machine learning for data fusion. Information Fusion, 57, 115-129. Mirnaghi FS, Soucy N, Hollebone BP, Brown CE (2018) Rapid fingerprinting of spilled petroleum products using fluorescence spectroscopy coupled with parallel factor and principal component analysis. Chemosphere 208:185–195. https://doi.org/10.1016/j.chemosphere.2018.05.111 Mohamed MH, Wilson LD, Headley JV, Peru KM (2008) Screening of oil sands naphthenic acids by UV-Vis absorption and fluorescence emission spectrophotometry. Journal of Environmental Science and Health, Part A 43:1700–1705. https://doi.org/10.1080/10934520802330255 Müller, E., Huber, C. E., Brack, W., Krauss, M., & Schulze, T. (2020). Symbolic Aggregate Approximation Improves Gap Filling in High-Resolution Mass Spectrometry Data Processing. Analytical chemistry, 92(15), 10425-10432. Murphy K, Stedmon C, Wenig P, Bro R (2014a) OpenFluor– an online spectral library of auto-fluorescence by organic compounds in the environment. Analytical Methods 6:658–661. https://doi.org/10.1039/C3AY41935E Murphy KR, Bro R, Stedmon CA (2014b) Chemometric Analysis of Organic Matter Fluorescence. In: Coble P, Lead J, Baker A, et al. (eds) Aquatic Organic Matter Fluorescence. Cambridge University Press, Cambridge, pp 339–375 Murphy KR, Stedmon CA, Graeber D, Bro R (2013) Fluorescence spectroscopy and multi-way techniques. PARAFAC. Anal Methods 5:6557–6566. https://doi.org/10.1039/C3AY41160E 82 Nagelkerke, N. J. (1991). A note on a general definition of the coefficient of determination. Biometrika, 78(3), 691-692. Nakkiran P, Kaplun G, Bansal Y, et al (2019) Deep Double Descent: Where Bigger Models and More Data Hurt. arXiv:191202292 [cs, stat] Panel, O. S. A. (2010). A foundation for the future: building an environmental monitoring system for the oil sands. Environment Canada, Ottawa, Ontario, Canada. Osburn, C.L., Oviedo-Vargas, D., Barnett, E., Dierick, D., Oberbauer, S.F., Genereux, D.P., 2018. Regional groundwater and storms are hydrologic controls on the quality and export of dissolved organic matter in two tropical rainforest streams, Costa Rica. J. Geophys. Res.: Biogeosci. 123, 850e866. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., ... & Duchesnay, E. (2011). Scikit-learn: Machine learning in Python. the Journal of machine Learning research, 12, 2825-2830. Phillips NAI, Lillico DME, Qin R, et al (2020) Inorganic fraction of oil sands process-affected water induces mammalian macrophage stress gene expression and acutely modulates immune cell functional markers at both the gene and protein levels. Toxicology in Vitro 66:104875. https://doi.org/10.1016/j.tiv.2020.104875 Podgorski, D. C., P. Zito, J. T. McGuire, D. Martinovic-Weigelt, I. M. Cozzarelli, B. A. Bekins, and R. G. M. Spencer. 2018. "Examining Natural Attenuation and Acute Toxicity of Petroleum-Derived Dissolved Organic Matter with Optical Spectroscopy." Environ Sci Technol 52 (11):6157-6166. doi: 10.1021/acs.est.8b00016. 83 Remolina, M. C. R., Li, Z., & Peleato, N. M. (2022). Application of Machine Learning Methods for Rapid Fluorescence-based Detection of Naphthenic Acids and Phenol in Natural Surface Waters. Journal of Hazardous Materials, 128491. Rivero, P. J., Goicoechea, J., & Arregui, F. J. (2018). Optical fiber sensors based on polymeric sensitive coatings. Polymers, 10(3), 280. Rogers, Vincent V, Mark Wickstrom, Karsten Liber, and Michael D MacKinnon. 2002. "Acute and subchronic mammalian toxicity of naphthenic acids from oil sands tailings." Toxicological Sciences 66 (2):347-355. Ross, M. S., Pereira, A. D. S., Fennell, J., Davies, M., Johnson, J., Sliva, L., & Martin, J. W. (2012). Quantitative and qualitative analysis of naphthenic acids in natural waters surrounding the Canadian oil sands industry. Environmental science & technology, 46(23), 12796-12805. Samanipour S, Reid MJ, Rundberget JT, et al (2020) Concentration and Distribution of Naphthenic Acids in the Produced Water from Offshore Norwegian North Sea Oilfields. Environ Sci Technol 54:2707–2714. https://doi.org/10.1021/acs.est.9b05784 Sanchooli, M., Ghaffari Moghaddam, M., & Zangeneh, M. (2013). Application of Artificial Neural Network for Evaluation of pKa Values and exploring the Solvation Mechanism of Phenol Derivatives in Solvent of Methanol/Water Mixture. Research Journal of Chemistry and Environment Vol, 17, 5. in the current document. Sinaga, K. P., & Yang, M. S. (2020). Unsupervised K-means clustering algorithm. IEEE access, 8, 80716-80727. Sgroi, M., Anumol, T., Roccaro, P., Vagliasindi, F. G., & Snyder, S. A. (2018). Modeling emerging contaminants breakthrough in packed bed adsorption columns by UV 84 absorbance and fluorescing components of dissolved organic matter. Water research, 145, 667-677. Sharpless CM, Blough NV (2014) The importance of charge-transfer interactions in determining chromophoric dissolved organic matter (CDOM) optical and photochemical properties. Environ Sci: Processes Impacts 16:654–671. https://doi.org/10.1039/C3EM00573A Shutova Y, Baker A, Bridgeman J, Henderson RK (2014) Spectroscopic characterisation of dissolved organic matter changes in drinking water treatment: From PARAFAC analysis to online monitoring wavelengths. Water Research 54:159–169. https://doi.org/10.1016/j.watres.2014.01.053 Simonyan K, Zisserman A (2015) Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv:14091556 [cs] Sola, J., & Sevilla, J. (1997). Importance of input data normalization for the application of neural networks to complex industrial problems. IEEE Transactions on nuclear science, 44(3), 1464-1468. Søndergaard, M., Stedmon, C.A., Borch, N.H., 2003. Fate of terrigenous dissolved organic matter (DOM) in estuaries: aggregation and bioavailability. Ophelia 57, 161e176. Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I., & Salakhutdinov, R. (2014). Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1), 1929-1958. Stedmon, C. A., Seredyńska-Sobecka, B., Boe-Hansen, R., Le Tallec, N., Waul, C. K., & Arvin, E. (2011). A potential approach for monitoring drinking water quality from groundwater systems using organic matter fluorescence as an early warning for contamination events. Water Research, 45(18), 6030-6038. 85 Sun, C., Shotyk, W., Cuss, C. W., Donner, M. W., Fennell, J., Javed, M., ... & Martin, J. W. (2017). Characterization of naphthenic acids and other dissolved organics in natural water from the Athabasca oil sands region, Canada. Environmental science & technology, 51(17), 9524-9532. Taenzer, M., Abeßer, J., Mimilakis, S. I., Weiß, C., Müller, M., Lukashevich, H., & Fraunhofer, I. D. M. T. (2019, November). Investigating CNN-based Instrument Family Recognition for Western Classical Music Recordings. In ISMIR (pp. 612-619). Tang, L., Tang, X. Y., Zhu, Y. G., Zheng, M. H., & Miao, Q. L. (2005). Contamination of polycyclic aromatic hydrocarbons (PAHs) in urban soils in Beijing, China. Environment international, 31(6), 822-828. Valeur, B., & Berberan-Santos, M. N. (2012). Molecular fluorescence: principles and applications. John Wiley & Sons. Varolgüneş, Y. B., Bereau, T., & Rudzinski, J. F. (2020). Interpretable embeddings from molecular simulations using Gaussian mixture variational autoencoders. Machine Learning: Science and Technology, 1(1), 015012. Wasswa J, Mladenov N, Pearce W (2019) Assessing the potential of fluorescence spectroscopy to monitor contaminants in source waters and water reuse systems. Environ Sci: Water Res Technol 5:370–382. https://doi.org/10.1039/C8EW00472B Watcharasupat, K. N., Lee, J., & Lerch, A. (2022). Latte: Cross-framework Python package for evaluation of latent-based generative models. Software Impacts, 11, 100222. Wiewel, F., & Yang, B. (2019, May). Continual learning for anomaly detection with variational autoencoder. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (pp. 3837-3841). IEEE. 86 Willmott, C. J., & Matsuura, K. (2005). Advantages of the mean absolute error (MAE) over the root mean square error (RMSE) in assessing average model performance. Climate research, 30(1), 79-82. Yang, J., & Hu, M. (2018). Filling the missing data gaps of daily MODIS AOD using spatiotemporal interpolation. Science of the Total Environment, 633, 677-683. Yang, C., Zhang, G., Serhan, M., Koivu, G., Yang, Z., Hollebone, B., ... & Brown, C. E. (2019). Characterization of naphthenic acids in crude oils and refined petroleum products. Fuel, 255, 115849. Yang R, Zhao N, Xiao X, et al (2016) Quantifying PAHs in water by three-way fluorescence spectra and second-order calibration methods. Opt Express, OE 24:A1148–A1157. https://doi.org/10.1364/OE.24.0A1148 Yang, Y. Z., Peleato, N. M., Legge, R. L., & Andrews, R. C. (2019a). Towards real-time detection of wastewater in surface waters using fluorescence spectroscopy. Journal of Environmental Sciences, 86, 195-202. Yang, Y. Z., Peleato, N. M., Legge, R. L., & Andrews, R. C. (2019b). Fluorescence excitation emission matrices for rapid detection of polycyclic aromatic hydrocarbons and pesticides in surface waters. Environmental Science: Water Research & Technology, 5(2), 315-324. Yu H, Liang H, Qu F, et al (2015) Impact of dataset diversity on accuracy and sensitivity of parallel factor analysis model of dissolved organic matter fluorescence excitation-emission matrix. Sci Rep 5:10207. https://doi.org/10.1038/srep10207 87 Yu J, Cao Y, Shi F, et al (2021) Detection and Identification of Organic Pollutants in Drinking Water from Fluorescence Spectra Based on Deep Learning Using Convolutional Autoencoder. Water 13:2633. https://doi.org/10.3390/w13192633 Zakaria, N. A., & Noor, N. M. (2018). Imputation methods for filling missing data in urban air pollution data formalaysia. Urbanism. Arhitectura. Constructii, 9(2), 159. Zito, P., D. C. Podgorski, J. Johnson, H. Chen, R. P. Rodgers, F. Guillemette, A. M. Kellerman, R. G. M. Spencer, and M. A. Tarr. 2019. "Molecular-Level Composition and Acute Toxicity of Photosolubilized Petrogenic Carbon." Environ Sci Technol 53 (14):8235-8243. doi: 10.1021/acs.est.9b01894.
Thesis/Dissertation
eng
Civil Engineering
Vancouver : University of British Columbia Library
Attribution-NonCommercial-NoDerivatives 4.0 International
Graduate
Peleato, Nicolas M.
Machine learning applied for contaminant detection in natural surface water
Text