def test_svm(self): print("SVMClassifier") print("---" * 45) print("Train num = %s" % self.train_num) print("Test num = %s" % self.test_num) print("C = %s" % self.C) from spa.classifiers import SVMClassifier svm = SVMClassifier(self.train_data, self.train_labels, self.best_words, self.C) classify_labels = [] print("SVMClassifier is testing ...") for data in self.test_data: classify_labels.append(svm.classify(data)) print("SVMClassifier tests over.") filepath = "f_runout/SVM-%s-train-%d-test-%d-f-%d-C-%d-%s-lin.xls" % \ (self.type, self.train_num, self.test_num, self.feature_num, self.C, datetime.datetime.now().strftime( "%Y-%m-%d-%H-%M-%S")) self.write(filepath, classify_labels, 2)