AbstractTo understand the mechanisms of information coding in single neurons, it is necessary to analyze subthreshold synaptic events, action potentials (APs), and the interrelation between these two forms of activity in different behavioral states. However, detecting excitatory postsynaptic potentials (EPSPs) or currents (EPSCs) in awake, behaving animals remains challenging, because of unfavorable signal-to-noise ratio, high frequency, fluctuating amplitude, and variable time course of synaptic events. Here, we developed a new method for synaptic event detection, termed MOD (Machine-learning Optimal-filtering Detection-procedure), which combines concepts of supervised machine learning and optimal Wiener filtering. First, experts were asked to manually score short epochs of data. Second, the algorithm was trained to obtain the optimal filter coefficients of a Wiener filter and the optimal detection threshold. Third, scored and unscored data were processed with the optimal filter, and events were detected as peaks above threshold. Finally, the area under the curve (AUC) of the receiver operating characteristics (ROC) curve was used to quantify accuracy and efficiency of detection. Additionally, cross-validation was performed to exclude overfitting of the scored data, a potential concern with machine-learning approaches. We then challenged the new detection method with EPSP traces in vivo in mice during spatial navigation and EPSC traces in vitro in slices under conditions of enhanced transmitter release. When benchmarked using a (1−AUC)−1 metric, MOD outperformed previous methods (template-fit and deconvolution) by a factor of up to 3. Thus, MOD may become an important tool for large-scale analysis of synaptic activity in vivo and in vitro.HighlightsA new method for detection of synaptic events, termed MOD, is describedThe method combines the concepts of supervised machine learning and optimal filteringThe method is useful for analysis of both in vitro and in vivo data setsMOD outperforms previously published methods for synaptic event detection by a factor of up to 3