High performance classification of synaptic events using a deep neural network.

(A) Overview of the analysis workflow. Data segments from electrophysiological recordings are extracted and labeled to train an artificial neural network. The deep learning-based model is then applied to detect events in novel time-series data. (B) Schematic of the model design. Data is input to a convolutional network consisting of blocks of 1D convolutional, ReLU, and average pooling layers. The output of the convolutional layers is processed by a bidirectional LSTM block, followed by two fully connected layers. The final output is a label in the interval [0, 1]. (C) Loss (binary crossentropy) and accuracy of the model over training epochs for training and validation data. (D) Receiver operating characteristic of the best performing model. Area under the curve (AUC) is indicated; dashed line indicates performance of a random classifier. (E) UMAP representation of the training data as input to the final layer of the model, indicating linear separability of the two event classes after model training. Also see Figure S1.

Applying AI-based classification to robustly detect synaptic events in electrophysiological time-series data.

(A) Event detection workflow using a deep learning classifier. Time-series data are reshaped with a window size corresponding to length of the training data and a given stride. Peak detection of the model output allows event localization (orange dashed line indicates peak threshold) and subsequent quantification. (B) Example of event detection in a voltage-clamp recording from a cerebellar granule cell. Top: Prediction trace (top) and corresponding raw data with synaptic events (bottom). Dashed line indicates minimum peak height of 0.5, orange circles indicate event localizations. (C) Zoom in for different data segments. Detected events are highlighted by gray boxes. (D) Event analysis for the cell shown in (B) (total recording time, 120 s). Top: Detected events with average (light blue). Bottom: Event amplitude histogram.

Systematic benchmarking demonstrates that AI-based event detection is superior to previous methods.

(A) Scheme of event detection benchmarking. Six methods are compared using precision and recall metrics. (B) Event-free recordings were superimposed with generated events to create ground-truth data. Depicted example data have a signal-to-noise ratio (SNR) of 9 dB. (C) Left: Output of the detection methods for data in (B). Right: Improvement in SNR relative to the data. Note that MiniAnalysis is omitted from this analysis because the software does not provide output trace data. (D) SNR from mEPSC recordings at MF–GC synapses (n = 170, whiskers cover full range of data). (E–G) Recall, precision, and F1 score versus SNR for the six different methods. Data are averages of three independent runs for each SNR. (H) Average F1 score versus event kinetics. Detection methods relying on an event template (template-matching, deconvolution and Bayesian) are not very robust to changes in event kinetics. (I) Evaluating the threshold dependence of detection methods. Asterisk marks event close to detection threshold. (J) Number of detected events vs. threshold (in % of default threshold value, range 5–195) for different methods. Dashed line indicates true event number.

Application of miniML to electrophysiological recordings from diverse synaptic preparations.

(A) Schematic and example voltage-clamp recordings from mouse cerebellar GCs. Orange circles mark detected events. (B) Representative individual mEPSC events detected by miniML. (C) Left: All detected events from (A), aligned and overlaid with average (light blue). Right: Event amplitude histogram. (D–F) Same as in (A–C), but for recordings from mouse calyx of Held synapses. (G–I) Same as in (A–C), but for recordings from mouse cerebellar Golgi cells. (J–L) Same as in (A–C), but for recordings from cultured human induced pluripotent stem cell (iPSC)-derived neurons. miniML consistently retrieves spontaneous events in all four preparations.

Transfer learning allows analyzing different types of events with small amounts of training data.

(A) Illustration of the transfer learning (TL) approach. The convolutional layers of a trained miniML model are frozen before retraining with new, smaller datasets. (B) Comparison of TL and full training for MF–GC mEPSP data. Shown are loss and accuracy versus sample size for full training and TL. Indicated subsets of the dataset were split into training and validation sets; lines are averages of fivefold crossvalidation, shaded areas represent 95% CI. Note the log-scale of the abscissa. (C) Average AUC, accuracy, and training time of models trained with the full dataset or with TL on a reduced dataset. TL models yield comparable classification performance with reduced training time using only 12.5% of the samples. (D) Example recordings of synaptic events in voltage-clamp and current-clamp mode consecutively from the same neuron. (E) Average peak normalized mEPSC and mEPSP waveform from the example in (D). Note the different event kinetics depending on recording mode. (F) Event frequency for mEPSPs plotted against mEPSCs. Dashed line represents identity, solid line with shaded area represents linear regression.

Synaptic event detection for neurons in a full-brain explant preparation of adult zebrafish.

(A) Application of TL to facilitate event detection for EPSC recordings. (B) Extraction of amplitudes, event frequencies, decay times, and rise time for all neurons in the dataset (n = 34). (C) Typical (mean) event kinetics for the analyzed neurons, ordered by decay times. (D–E) Example recordings with slow (dark blue) and fast (light blue) event kinetics. (F) Examples of events taken from (D–E), illustrating the diversity of kinetics within and across neurons. (G) Distribution of event decay kinetics across single events for two example neurons (traces shown in (D–E)). (H) Distribution of event rise kinetics across single events for same two example neurons. (I) Mapping of decay times (color-coded as in (C)) onto the anatomical map of the recording subregion of the telencephalon. (J) Mean decay and rise times are correlated across neurons. (K) Decay time distributions are broader (SD of decay time distributions) when mean decay times are larger. (L) Input resistance as a proxy for cell size is negatively correlated with the decay time.

Event detection at Drosophila neuromuscular synapses upon altered glutamate receptor composition.

(A) Two-electrode voltage-clamp recordings from wild-type (WT) Drosophila NMJs were analyzed using miniML with transfer learning. (B) Left: Example voltage-clamp recording with detected events highlighted. Right: Three individual mEPSCs on expanded time scale. (C) Left: All detected events from the example in (B) overlaid with average (blue line). Right: Event amplitude histogram. (D–F) Same as in (A–C), but for GluRIIA mutant flies. (G) Comparison of median event amplitude for WT and GluRIIA NMJs. Both groups are plotted on the left axes; Cohen’s d is plotted on a floating axis on the right as a bootstrap sampling distribution (red). The mean difference is depicted as a dot (black); the 95% confidence interval is indicated by the ends of the vertical error bar. (H) Event frequency is lower in GluRIIA mutant NMJs than in WT. (I) Knockout of GluRIIA speeds event decay time. (J) Faster event rise times in GluRIIA mutant NMJs.

miniML reliably detects optical minis across a wide range of signal-to-noise ratios.

(A) The miniML model was applied to recordings from rat primary culture neurons expressing iGluSnFR3. Data from (A. Aggarwal et al., 2023). (B) Example epifluorescence image of iGluSnFR3-expressing cultured neurons. Image shows a single frame with three example regions of interest (ROIs) indicated. (C) ΔF/F0 traces for the regions shown in (B). Orange circles indicate detected optical minis. Note the different signal-to-noise ratios of the examples. (D) Top: Heatmap showing average optical minis for all sites with detected events, sorted by amplitude. Bottom: Grand average optical mini. (E) Top: Histogram with kernel density estimate (solid line) of event amplitudes for n = 1524 ROIs of the example in (B). Note the log-scale of the abscissa. Bottom: Inferred event frequency.

Overview of model architecture

Visualization of model training.

(A) Saliency maps (Simonyan et al., 2013) for four example events of the training data. Darker regions indicate discriminative data segments. Data and saliency values are min-max scaled. (B) The miniML model transforms input to enhance separability. Shown is a Uniform Manifold Approximation and Projection (UMAP) dimensionality reduction of the original training dataset. (C) UMAP of the input to the final ML model layer. Examples of labeled training samples are illustrated. Model training greatly improves linear separability of the two labeled event classes.

Dependence of training performance on dataset size.

(A) To test how size of the training dataset impacts model training, we took random subsamples from the MF–GC dataset and trained miniML models using fivefold cross validation. (B–D) Comparison of loss (B), accuracy (C) and area under the ROC curve (AUC; D) across increasing dataset sizes. Data are means of model training sessions with k-fold cross-validation. Shaded areas represent SD.

Fast computation time for event detection using miniML.

(A) Detected events and analysis runtime plotted versus stride. Note that runtime can be minimized by using stride sizes up to 5% of the event window size without impacting detection performance. (B) Analysis runtime with different computer hardware for a 120-s long recording at 50 kHz sampling (total of 6,000,000 samples). Runtime is given as wall time including event analysis. GPU computing enables analysis runtimes shorter than 20 s.

miniML performance on event-free data.

(A) Probability (top) and raw data with detected events from a MF–GC recording. Dashed line indicates miniML minimum peak height. (B) Recording from the same cell after addition of blockers of synaptic transmission (NBQX, APV, Bicuculline, Strychnine). miniML does not detect any events under these conditions. Note that addition of Bicuculline blocks tonic inhibition in cerebellar GCs, causing a reduction in holding current and reduced noise (Kita et al., 2021).

Extended benchmarking and threshold dependence of event detection.

(A) Example event-free recording (Top) and power density spectrum of the data (Bottom). (B) Top: Data trace from (A) superimposed with simulated synaptic events. Bottom: Amplitude histogram of simulated events for a signal-to-noise ratio (SNR) of 10.8 dB. Solid line represents the log-normal distribution from which event amplitudes were drawn; Inset shows individual simulated events. (C) Recall, precision and F1 score for five detection methods with simulated events that have a 2× faster decay than in Figure 3. (D) Same as in (C), but for events with a 4.5× slower decay time constant. Note that we did not adjust detection hyperparameters for the comparisons in (C) and (D). (E) Runtime of five different synaptic event detection methods for a 120-s section of data recorded with 50 kHz sampling rate. Average wall-time of five runs. * miniML was run using a GPU, and data were downsampled to 20 kHz for the Bayesian analysis. (F) Normalized amplitude of the peaks in the different methods’ detection traces (”detection peak amplitude”) versus normalized event amplitude. A linear dependence indicates that detection traces contain implicit amplitude information, which will cause a strong threshold dependence of the detection result. Note that miniML’s output does not contain amplitude information. (G) F1 score versus threshold (in % of default threshold value, range 5–195) for different methods.

Recall depends on event kinetics.

(A) Recall versus event kinetics for the MF–GC model. Kinetics (i.e., rise and decay time constants) of simulated events were changed as indicated. miniML robustly detects events with up to ∼ 4-fold slower kinetics (dashed line indicates 80% recall). (B) Event kinetics for different preparations and/or recording modes. Data are normalized to MF–GC mEPSCs (dashed line).

Transfer learning facilitates model training across different datasets.

(A) Loss and accuracy versus number of training dataset samples for three different datasets (mouse MF–GC mEPSPs, Drosophila NMJ mEPSCs, zebrafish (ZF) spontaneous EPSCs). Dashed lines indicate transfer learning (TL), whereas solid lines depict results from full training. Points are averages of fivefold cross-validation and shaded areas represent 95% CI. (B) Average AUC, accuracy, and training time for TL using 500 samples, and full training using 4,000 samples. Error bars denote 95% CI.