def run_classifier(self, method, classifier): if method == 'classifier': self.classifier = Classifier( self.prepro.severity.keys(), self.prepro.X_train, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size) self.classifier.classify(classifier) if method == 'pipeline': self.classifier = PipeLineClassifier( self.prepro.severity.keys(), self.prepro.train_corpus, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size) self.classifier.setVariables(classifier) self.classifier.benchmark()
def run_classifier(self, method, classifier): if method == 'classifier': self.classifier = Classifier( self.prepro.severity.keys(), self.prepro.X_train, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size) self.classifier.classify(classifier) if method == 'pipeline': self.classifier = PipeLineClassifier( self.prepro.severity.keys(), self.prepro.train_corpus, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size ) self.classifier.setVariables(classifier) self.classifier.benchmark()
class Project: def __init__(self, num_rows, wrt_feature): self.db = DB(db='major_2') data = Data(self.db) self.data_set = data.getData(num_rows, wrt_feature) def preprocess(self, new, vector, chi2): self.prepro = Preprocess(self.data_set, new) if new == 'True': if vector == 'hashing': self.prepro.hashVector() if vector == 'tfidf': self.prepro.tfidfVector() # print self.preprocess.y_train else: self.prepro.vectorize(vector) if chi2: self.prepro.chisquare() def run_classifier(self, method, classifier): if method == 'classifier': self.classifier = Classifier( self.prepro.severity.keys(), self.prepro.X_train, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size) self.classifier.classify(classifier) if method == 'pipeline': self.classifier = PipeLineClassifier( self.prepro.severity.keys(), self.prepro.train_corpus, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size) self.classifier.setVariables(classifier) self.classifier.benchmark()
class Project: def __init__(self, num_rows, wrt_feature): self.db = DB(db='major_2') data = Data(self.db) self.data_set = data.getData(num_rows, wrt_feature) def preprocess(self, new, vector, chi2): self.prepro = Preprocess(self.data_set, new) if new == 'True': if vector == 'hashing': self.prepro.hashVector() if vector == 'tfidf': self.prepro.tfidfVector() # print self.preprocess.y_train else: self.prepro.vectorize(vector) if chi2: self.prepro.chisquare() def run_classifier(self, method, classifier): if method == 'classifier': self.classifier = Classifier( self.prepro.severity.keys(), self.prepro.X_train, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size) self.classifier.classify(classifier) if method == 'pipeline': self.classifier = PipeLineClassifier( self.prepro.severity.keys(), self.prepro.train_corpus, self.prepro.y_train, self.prepro.X_test, self.prepro.y_test, self.prepro.train_size, self.prepro.test_size ) self.classifier.setVariables(classifier) self.classifier.benchmark()