Neuromorphic on-chip recognition of saliva samples of COPD and healthy controls using memristive devices

Chronic Obstructive Pulmonary Disease (COPD) is a life-threatening lung disease, affecting millions of people worldwide. Implementation of Machine Learning (ML) techniques is crucial for the effective management of COPD in home-care environments. However, shortcomings of cloud-based ML tools in terms of data safety and energy efficiency limit their integration with low-power medical devices. To address this, energy efficient neuromorphic platforms can be used for the hardware-based implementation of ML methods. Therefore, a memristive neuromorphic platform is presented in this paper for the on-chip recognition of saliva samples of COPD patients and healthy controls. Results of its performance evaluations showed that the digital neuromorphic chip is capable of recognizing unseen COPD samples with accuracy and sensitivity values of 89% and 86%, respectively. Integration of this technology into personalized healthcare devices will enable the better management of chronic diseases such as COPD.

www.nature.com/scientificreports/ and Healthy Controls (HC) using real clinical data and to implement the trained ANN on IHP's memristive hardware platform for on-chip recognition. The combination of the simulation-based training and hardwarebased recognition facilitates the better integration of neuromorphics with PoC medical devices, required for the management of chronic diseases such as COPD. Moreover, neuromorphic-equipped healthcare technologies provide the best platform for patients to take advantage of ML-based medicine, while having control over their medical data and privacy.

Data preparation.
The open access Exasens dataset, available at the UCI machine learning repository (https ://archi ve.ics.uci.edu/ml/datas ets/Exase ns), was used in this study for training and evaluating the developed model for the classification and recognition of saliva samples of COPD patients and HC 10 . This novel dataset contains information on hundred saliva samples collected from four groups of respiratory patients including: COPD (40 samples), HC (40 samples), asthma (10 samples), and respiratory infected subjects without COPD or asthma (10 samples). Attributes of the dataset, used for the classification of subjects, include demographic information of patients (age, gender, and smoking status) as well as dielectric properties (Minimum value for the real part of permittivity) of the characterized saliva samples for every class. For computational purposes, non-quantitative attributes-diagnosis, gender, and smoking status-were converted into numerical values using following labels: diagnosis (COPD (1)-HC (0)), gender (male (1)-female (0)), smoking status (smoker (3)-ex-smoker (2)-non-smoker (1)). Subsequently, analog values of these four attributes were thresholded and converted into 23 binary bits (Gender (1), smoking status (3), age (9), dielectric permittivity (10)), as shown in Fig. 1. Binarization of attributes of this small-sized dataset has shown to reduce overfitting and noise, and to improve the performance of ML tools for the classification of COPD and HC samples 10,39 . In addition, considering the small size of the investigated dataset, 80 samples for two classes of COPD and HC, 5-fold cross-validation method was implemented for the evaluation of the ANN model, thus preventing overfitting and providing reliable and generalizable results. Therefore, for every cross-validation fold, the dataset was split into different test-train subsets with the ratio of 20-80%, respectively. The test-fraction, with unseen data points during model training, was considered as an external validation dataset for the evaluation of models. Data preparations and ML implementations were performed on the JupyterLab environment using Keras 2.2.5 and Scikit-learn 0.22 libraries of Python 40 .
Artificial neural network. After data preparations, a dense ANN with one hidden-layer and one read-out layer was developed for the classification of COPD and HC samples, as shown in Fig. 2. The input layer of the network consisted of 23 neurons, considering binarized attributes of the dataset. To replicate the intrinsic structure of the intended neuromorphic platform, a hidden layer with 4 neurons and a sigmoid activation function was modeled. The read-out layer, with a sigmoid activation function, consisted of two neurons for two possible classes of COPD and HC. A dropout with 20% probability was applied to the hidden-layer for the overfitting prevention. Adam optimization algorithm, with 0.0001 learning rate, and a cross entropy error function were used for training network in the backend using the Google Colab GPU platform 41 . The developed ANN model  www.nature.com/scientificreports/ was trained for 3000 epochs with a batch size of 10, using the train-subset of every cross-validation fold. Network parameters including weights and biases were computed and optimized during the training phase and their final analog values were recorded for every fold. Considering the fact that the intended neuromorphic chip consists of digital memristive devices, multilevel thresholding of network analog parameters into 10 levels was necessary for the deployment of the trained ANN onto the hardware platform. Therefore, calculated weights and biases of the trained ANN were thresholded into 10 levels to comply hardware requirements, as shown in Fig. 3. For this purpose, the absolute maximum value among calculated parameters was identified and divided by five to determine the resolution of thresholding levels. As shown in Fig. 3, the calculated threshold was used with positive and negative signs for the 10-level segmentation of network parameters with positive and negative values, respectively. After calculating thresholding steps, network parameters with analog values were shifted up to the nearest threshold value (for positive levels and equivalent for negative levels), representing one digital device per level. It is noteworthy that positive and negative levels are interpreted as devices with different current directions for the hardware implementation. Finally, converted weights and biases of the network with 10-level resolution were recorded and extracted for the deployment on the memristive neuromorphic platform, as shown in Fig. 3. www.nature.com/scientificreports/ configuration. The packaged chip is shown in Fig. 4a. Devices can be switched between two distinct states, i.e. low resistance state (LRS) and high resistance state (HRS), by the formation and dissolution of a conductive filament consisting of oxygen vacancies. Nominal read-out currents are 30 µA and 5 µA at 0.2 V for LRS and HRS, respectively. The evolution of mean read-out currents of 128 devices is shown in Fig. 4b. Here, two distinct states are clearly present for 1000 switching cycles. Mean read-out currents of 30.8 µA and 3.2 µA at 0.2 V for LRS and HRS, respectively, are changing marginally to 31.6 µA and 3.0 µA . Mean read-out currents for different read-out voltages V read ≤ 0.2 V are shown in Fig. 4c for 128 devices being in LRS and HRS, respectively. The resistance does not scale linearly with the voltage 42 . Using a sufficient high voltage of 1.3 V or higher leads to reliable switching to LRS while using a sufficient low voltage of −1.6 V or lower leads to reliable switching to HRS. An even better control on the switching event can be achieved by using the Incremental Step Pulse with Verify Algorithm (ISPVA), which was used in this work 45 . It should be noted that applying voltage pulses with lower absolute value of the amplitude leads to stochastic switching between resistance states, which can be exploited for stochastic learning of analog data 30,31 . The stochasticity in amorphous devices is lower than in polycrystalline devices. This can most probably be attributed to a more homogenous defect distribution in the amorphous devices 43 , which is why these devices are used for the work described here. A thorough characterization of the devices in terms of switching voltages, endurance, yield and retention is given in 31,43 .
For the deployment of the thresholded model with 10 levels, a mixed-signal neuromorphic circuit with software-based neurons and hardware synapses was used similar to those shown in 30 . The RRAM chip was connected via a standard 64 pin integrated circuit socket to a Printed Circuit Board (PCB). Visual Basic was used to simulate neurons on a conventional computer and to control the experimental setup. Furthermore, an Arduino Mega 2560 microcontroller board was used to serve the address pins of the RRAM chip. Read-out and switching pulses were applied using an Agilent E5263A Source Measurement Unit (SMU).
Considering the topology of the developed ANN model ( Fig. 2) with one hidden layer and one read-out layer as well as four and two neurons per layer, respectively, 106 parameters (i.e. synaptic weights and biases) were required for linking network layers. On the other hand, since every memristive device on the hardware represents one level of the thresholded parameters, 1060 memristive devices were required on the hardware for the implementation of the developed COPD recognition model with 10-level resolution. Resistance states of 1060 randomly chosen functional devices on a single chip were set to the HRS or LRS, respective to pre-trained weights. Every network parameter is represented by the combination of 10 devices so that the total value of the parameter is the sum of all 10 device currents read-out with voltages up to 0.2 V. Here, five devices are read-out Thus, a nominal current of 5 × 30 µA − 5 × 5 µA = 125 µA is flowing. In between, equidistant discrete states can be achieved (shown in Fig. 5). Devices connecting input layer and hidden layer are read-out with +0.2 V and −0.2 V , while devices connecting hidden layer and read-out layer are read-out with voltage amplitudes between -0.2 V and +0.2 V as it is explained below. This leads to a non-linear distortion of network parameters, because of the non-ohmic conduction mechanism depicted in Fig. 4c. After the successful implementation of pre-trained weights on the hardware, the test-subset of data was used to evaluate the performance of the neuromorphic model for the recognition of COPD and HC samples. For the recognition of COPD samples with the mixed-signal approach, 23 input bits of the test-subset data were applied to simulated neurons on the input layer, as shown in Fig. 6. Input bits with a value 1 were applied to the network by voltage pulses of ±0.2 V (i.e. +0.2 V or −0.2 V for devices assigned to a positive or negative contribution, respectively, as explained above), while no voltage was applied for a 0 value input bit. As shown in Fig. 6, output neurons of every subarray are perceptrons with a sigmoidal activation function, which receive the sum of current values passing through devices connected together with a specific bias value. The read-out of device currents is done serial and they are summed up in software. A parallel read-out would require an application specific chip design. Nevertheless, a proof-of-principle for using devices in a hardware neuromorphic circuit can be given using serial read-out. These current values are normalized by the factor n to the maximum value of the pre-trained analog network to guarantee the sigmoid function is activated with a reasonable range of values. Thus, the maximum current of 125 µA corresponds to the maximum pre-trained analog value. An activated perceptron i of the second layer is generating an analog output signals X i within the interval of [0, 1]. These are applied to devices connecting layer 2 and 3 as voltage pulses with amplitudes X i · ±0.2 V with a precision of 10 mV. Output values of the third layer (read-out layer) perceptrons are denoting whether a test sample belongs to COPD or HC categories. This realization is in agreement with the theory of neural networks that the weighted sum of inputs determine the value of a perceptron neuron in the subsequent layer, as demonstrated in Fig. 2. Therefore, applying test-subsets of COPD and HC with different input patterns generated two different current Performance assessment. While the train-subset of every cross-validation fold (64 data points out of overall 80) was used for training the ANN and computing the 10-level model topology, the test-subset, with 16 data points, was considered as an external validation dataset for the performance evaluation of models for the recognition of saliva samples of COPD patients and HC. Tables 1, 2, and 3 report the 5-fold cross-validation performance of following models, respectively: ANN with analog parameters, ANN model with 10-level resolution topology, and the HNN with 10-level resolution deployed on the memristive neurmorphic chip. The performance measures reported in these tables include accuracy, sensitivity, specificity, and precision for every crossvalidation fold as well as the average of all five folds. The reported accuracy measure in these tables indicates the performance of a model for correctly recognizing unseen test data, which was calculated as the percentage of true positives (correctly identified COPD) plus true negatives (correctly identified HC) out of all assessments.
The sensitivity of a model was calculated as the proportion of True Positives (TP) out of all diseased cases; while the specificity value shows the number of True Negatives (TN) over number of TNs and False Positives (FP). Precision criterion shows the ratio of true positives over true plus false positives (incorrectly identified COPD). It should be noted that the hardware realization experiments were repeated five times for every single cross-validation fold to investigate the repeatability of measurements considering undesired effects of device-todevice variability and failed switching events. Therefore, results reported in Table 3 represent the average of five repetition for every single cross-validation fold. In addition, Fig. 7 demonstrates confusion matrices for a single cross-validation fold (fold-5). www.nature.com/scientificreports/

Results
As reported in Table 1, the ANN simulation with analog parameters provided a high accuracy of 90% for the recognition of unseen saliva samples of COPD patients and HC. In addition, sensitivity, specificity, and precision values of 92.5%, 87.5%, and 89.3%, respectively, have been reported for its 5-fold cross-validation performance, making it a reliable model for the in-vitro diagnosis of COPD. On the other hand, Table 2 presents the   Table 2. Performance of the ANN with 10-level resolution. www.nature.com/scientificreports/ performance assessment of the ANN simulation with the 10-level resolution topology. Although a slight performance degradation compared to its original analog structure, the ANN model with 10-level resolution provided acceptable accuracy, sensitivity, specificity, and precision values of 87.5%, 85%, 90%, and 90.2%, respectively, for the recognition of unseen samples within the test-subset. These results are along with the fact that the multilevel thresholding of a network's parameters impairs its recognition performance with respect to its resolution. In a similar manner, deployment of the model with 10-level resolution on the memristive neuromorphic platform has led to an on-chip recognition accuracy of 89%, indicating the reliability of the approach for the management of COPD in real-world applications (Table 3). In addition, high sensitivity, specificity, and precision values of 86%, 92%, and 92% have been reported for the on-chip recognition of 16 unseen test samples using the RRAM neuromorphic platform, making it a suitable technology for the implementation of ML techniques on lowpower PoC medical devices. In particular, the network could reliably cope with the device-to-device variability of RRAM devices. Mean values of read-out currents were 3.9 ( ±1.0 ) µA and 35.5 ( ±3.7 ) µA for HRS and LRS devices, respectively. Additional to the device-to-device variability, failed switching events led to devices in the wrong resistance state. On average 2.68 of devices (i.e. 0.25%) were in the wrong state in each experimental run. Furthermore, the non-linear response of devices connecting layer 2 and 3 to voltage pulses with amplitudes between −0.2 V and +0.2 V (shown in Fig. 4c) did not strongly influence the accuracy. Even though all three mechanisms, i.e. device-to-device variability, failed switching events, and non-linear read-out may have affected the recognition performance of experiments, the overall average recognition rate was only slightly below the simulation with analog values. Nevertheless, in order to reduce the performance gap between the ANN simulation and its hardware-based replication on the chip, development of binary ANN models is necessary in the future 46,47 . Alternatively, analog neuromorphic platforms, capable of replication of analog parameters on-chip, can also be used to address this issue 48 . Figure 7 shows confusion matrices for the fifth cross-validation fold for the recognition of COPD and HC samples. The high accuracy, sensitivity, specificity, and precision for both simulation-and hardware-based ML models make them a promising tool for the recognition and management of COPD in PoC environments. Therefore, acquired results illustrate the practicality of using a memristive neuromorphic platform for the on-chip www.nature.com/scientificreports/ recognition and classification of saliva samples of COPD patients and HC using real clinical data, which was proposed as the objective of this work. Results reported in Tables 1, 2, and 3 present similar trends for all five cross-validation folds, indicating the reliability of the model performance in terms of overfitting. However, similar to any ML study on a small-sized dataset, generalizability of presented results to a larger population of samples is the main limitation of this work, necessitating the extensive collection of data for the management of COPD. Nonetheless, to the best of our knowledge, there is no other comprehensive dataset available up to date, which can be used for training and evaluating the proposed neuromorphic-oriented ML models for COPD detection in this work. Therefore, we consider our study as a stepping stone to future studies in the field.

K-fold Accuracy (%) Sensitivity (%) Specificity (%) Precision (%)
Neuromorphic platforms address the high energy consumption shortcoming of cloud-based ML techniques for edge-computing applications. The read-out of all synaptic weights throughout experiments consumed on average 614.2 ( ±60.3 ) nJ per sample with a read-out pulse duration of 500 µs (i.e. the shortest pulse duration of the used Agilent E5263A SMU). This could be significantly reduced to 12.3 ( ±1.2 ) nJ using 10 µs pulses, which also allows a reliable read-out for utilized devices 44 . The energy efficiency of neuromorphic systems makes them an adequate technology for the integration of ML tools with low-power PoC medical devices. Hence, additional circuitry for a complete hardware realization (e.g. perceptrons) have to be implemented in low power electronics in the future.

Discussion
It is noteworthy that the recognition accuracy of the neuromorphic HNN model improves with a greater number of thresholding levels, thus better replicating its original analog structure. However, a greater number of thresholding levels requires larger number of memristive devices on the hardware depending on the complexity of the original network and its number of parameters, thus restricting the resolution that can be chosen for the hardware deployment with respect to that specific neuromorphic hardware (e.g. 4096 devices for IHP's RRAM chip). In addition, greater number of devices on the hardware consume more energy, while requiring a larger chip size and a longer time span for training and executing models depending on the internal design of the chip. Therefore, the trade-off between the accuracy of models and their on-chip efficacy in terms of power consumption and chip size for various thresholding resolutions need to be taken into account for determining the most optimum resolution.
As previously highlighted, for the sake of time efficacy, no learning or training was performed on the neuromorphic chip in this work. This is due to the fact that training a simulation-based model for many thousand iterations in the backend is far more practical. For instance, training the ANN model, in this study, for the classification of COPD and HC samples required an average time span of 250 seconds for 3000 learning epochs. Therefore, this work illustrates promising results for the practicality of using pre-trained neuromorphic chips in complex real-world applications, such as imaging, with time-consuming training requirements. Nevertheless, RRAM neuromorphic systems can also be used for on-chip learning and adaptation to new input patterns by developing network structures and acquiring algorithms 30,37 . Adaptability of these chips to an individual patient data is significantly important for applications such as the epileptic seizure prediction, where developing a generalizable ML model is not possible 38 . Hence, by taking advantage of neuromorphic-based ML techniques, developing personalized solutions for the management and diagnosis of chronic diseases such as COPD is feasible.
Notable results of this work imply the feasibility of using neuromorphic-based ML techniques for the enhancement of PoC healthcare solutions for the management of COPD. Energy-efficient neuromorphic systems, used in this work, are expected to revolutionize the ML-based medicine in the future by bringing data post-processing from the backend onto the chip, thus providing accurate and real-time predictions on the health status of patients. Furthermore, neuromorphic-equipped medical devices will better protect users' sensitive medical data without cloud communication requirements. Moreover, implementation of novel meta learning algorithms, such as few-shot learning, on neuromorphic platforms will enable the rapid adaptation and real-time learning in these systems with a few data points and the least possible computation 39,49 . Example of such applications, where online learning and adaptation of a ML model is crucial, include autonomous driving, surgical robotics, personalized medicine, and precision diagnostic 39,[49][50][51][52] .
In conclusion, this work investigated the concept of on-chip recognition of saliva samples of COPD patients and HC using a memristive neuromorphic platform. A hardware-friendly artificial neural network simulation was developed and trained in the backend for the classification of COPD and HC samples using real clinical data. Subsequently, analog parameters of the trained model were thresholded into 10 levels and were deployed on a memristive neuromorphic platform for on-chip recognition purposes. The neuromorphic chip with 10-level resolution provided a remarkable accuracy of 89% for the on-chip recognition of COPD and HC samples, offering an alternative approach to cloud-based ML methods required for the management of COPD in PoC environments. As the next step, a binary ANN model for the prediction of epileptic seizure will be developed and deployed on the introduced memristive neuromorphic system for the on-chip forecasting of epilepsy scenarios using low-power healthcare wearables.

Data availability
Data used in this work are available publicly at the UCI machine learning repository under the open access Exasens dataset https ://archi ve.ics.uci.edu/ml/datas ets/Exase ns. All metrics and models of this work are accessible at https ://githu b.com/Pouya -SZ/Bione uromo rphic s.