## 2 Materials and Methods
### Biosignals and Spike Detection  
In this study, two distinct biosignals are utilized: the first, captured in vivo from a macaque monkey (Figure 1(a)), has a duration of 559 s, from which only 25 s were used in this work, and a sampling frequency of 40 kHz; the second type, acquired in vitro for 13 s from human pancreatic cells (Figure 1(b)), is characterized by a sampling frequency of 10 kHz. The acquisition of these signals was not carried out in this work. Spikes are identified within the signals illustrated in Figure 2, showcasing specific instances of the raw biosignals acquired in vivo from a macaque monkey and in vitro from a human pancreas (see Figure 24 for some of the spike shapes found in the macaque monkey and human pancreatic biosignals). The spike detection process employs an adaptive thresholding method [26], automating the procedure while dynamically adjusting the threshold to remain above the signal's background noise level. Initial spike detection was performed in a previous study [25]. Our primary emphasis in this current research lies in thoroughly analyzing these spikes and classifying them. Table 1 shows a subset of the statistical data extracted from 12 detected spikes within the monkey signal. A similar table exists for the spikes in the human pancreatic signal. In total, 327 spikes were identified within the monkey signals, while 386 spikes were detected in the human pancreatic signals. These data were subsequently utilized as inputs for clustering algorithms, enabling the aggregation of spikes exhibiting similar statistical characteristics. The table employs a color scale to indicate value intensity, revealing a notable level of variability within the dataset. This inherent variability has been addressed within this study through data normalization as follows:  
Figure 1: Methodology. Figure 2: Samples of raw biosignals: (**a**) macaque monkey signal, (**b**) human pancreatic signal\[z=\frac{x-\mu}{s} \tag{1}\]  
This normalization primarily involves extracting the mean and scaling the data based on the standard deviation. This process aims to center the features and align the standard deviations, thereby mitigating the potential dominance of features with larger amplitudes within the clustering algorithms. This precaution prevents any feature from overpowering the learning process, ensuring that the estimator effectively learns from all features. Upon normalizing the feature matrix presented in Table 1, the resulting data are illustrated in Table 2 for macaque monkey data and similarly for the human pancreatic data in Table 3. Unlike the former data, it is evident that the values are no longer widely separated, yet they maintain the same underlying distribution. Consequently, the clustering algorithms can effectively learn from all the features without the undue influence of any particular feature on the learning process. The datasets presented in Tables 1-3 constitute the feature matrices used in the subsequent description of the clustering algorithms. These algorithms have undergone validation for both feature matrices, and the outcomes of these validations are presented in the subsequent sections.