Social neuroscience shows a growing interest for the study of social interaction. Investigating its neural underpinnings has been greatly facilitated through the development of hyperscanning, a neuroimaging technique allowing to record simultaneously the brain activity of multiple humans engaged in a social exchange. However, the analysis of spontaneous social interaction requires the indexing of the ongoing behavior. Since spontaneous exchanges are intrinsically unconstrained, only a manual indexing by frame-by-frame analysis has been used so far. Here we present an automatic measure of imitation during spontaneous social interaction. Participants gestures are characterized with Bag of Words and 1-Class SVM models. Then a measure of imitation is derived from the likelihood ratio between these models. We apply this method to hyperscanning EEG recordings of spontaneous imitation of bimanual hand movements. The comparison with manual indexing validates the method at both behavioral and neural levels, demonstrating its ability to discriminate significantly the periods of imitation and non-imitation during social interaction.