The aim of this article is to develop an automatic algorithm for the classification of non stationary signals. The application context is to classify uterine electromyogram (EMG) events to prevent the onset of preterm birth. The idea is to discriminate between the events by allocating them to the physiological classes: contractions, foetus motions, Alvarez or Long Duration Low Frequency waves. Our method is based on the Wavelet Packet (WP) decomposition and the choice of a best basis for classification purpose. Before classification, there is a need to detect events in the recorded signals. The discrimination criterion is based on the calculation of the ratio between intra-class variance and total variance (sum of the intra-class and inter-class variances), calculated directly from the coefficients of the selected WP. We evaluated the performance of the algorithm on real signals by using the classification methods Neural Networks (NN) and Support Vector Machines (SVM). Subband energies of the best selected WP are used as effective features. The determined best basis is applicable to a wide range of uterine EMG signals from large range of patients. In most cases, more than 85% of events are well classified whatever the term of gestation.