def __init__(self, texts, classes, nlpdictch=None): # TODO: add list of smileys to texts/classes self.svm = svm.LinearSVC(C=1, class_weight='auto') if nlpdictch: self.dictionary = nlpdictch else: self.dictionary = NLPDictCh(texts=texts) self._train(texts, classes)
def __init__(self, texts, classes, nlpdictch=None, scale=1, C=1.0): self.scale = scale self.l = LogisticRegression(penalty='l2', dual=True, C=C, \ class_weight='auto') if nlpdictch: self.dictionary = nlpdictch else: self.dictionary = NLPDictCh(texts=texts) vectors = self.dictionary.feature_vectors(texts) self.l.fit(vectors, classes)