def _stop_training(self): super(ShogunSVMClassifier, self)._stop_training() self.normalizer = _LabelNormalizer(self.labels) labels = self.normalizer.normalize(self.labels) # shogun expects float labels labels = sgFeatures.Labels(labels.astype(float)) features = sgFeatures.RealFeatures(self.data.transpose()) self.classifier.set_train_features(features, labels) self.classifier.train()
def _stop_training(self): super(LibSVMClassifier, self)._stop_training() self.normalizer = _LabelNormalizer(self.labels) labels = self.normalizer.normalize(self.labels.tolist()) features = self.data # Call svm training method. prob = libsvmutil.svm_problem(labels, features.tolist()) # Train self.model = libsvmutil.svm_train(prob, self.parameter)