Example #1
0
def pred(args):
    """
    dataset: tfidf
    model: MultinomialNB(alpha=0.05)
    cross validate f1-score: 0.1613
    test f1-score: 0.16181
    """
    X_train, y_train = load_train_tfidf(), load_target()
    X_test = load_test_tfidf()
    clf = MultinomialNB(alpha=args.alpha)
    train_and_test(clf, X_train, y_train, X_test, args.output)
Example #2
0
def pred(args):
    """
    dataset: tfidfdim
    model: LinearSVC(C=1.0), ovo
    cross validate f1-score: 0.1723
    test f1-score: 0.16922
    """
    X_train, y_train = load_train_tfidfdim(), load_target()
    X_test = load_test_tfidfdim()
    svm = LinearSVC(C=args.C)
    clf = OneVsOneClassifier(svm)
    train_and_test(clf, X_train, y_train, X_test, args.output)
Example #3
0
def cv(args):
    X_train, y_train = load_train_tfidfdim(), load_target()
    svm = LinearSVC(C=args.C, verbose=args.verbose)
    clf = OneVsOneClassifier(svm)
    cross_validate_model(clf, X_train, y_train, cv=args.fold)
Example #4
0
def cv(args):
    X_train, y_train = load_train_tfidf(), load_target()
    clf = MultinomialNB(alpha=args.alpha)
    cross_validate_model(clf, X_train, y_train, cv=args.fold)
Example #5
0
def val(args):
    X_train, y_train = load_train_tfidf(), load_target()
    clf = MultinomialNB(alpha=args.alpha)
    validate_model(clf, X_train, y_train)