def classify(self): for i, x in enumerate(self.channel_decode): feature_obj = Features(self.data_raw[int(x) - 1], self.sampling_freq, self.features_id) features = feature_obj.extract_features() try: prediction = self.clf[i].predict([features]) - 1 if prediction != (self.prediction >> i & 1): # if prediction changes self.prediction = self.output(i, prediction, self.prediction) print('Prediction: %s' % format(self.prediction, 'b')) except ValueError: print('prediction failed...')