How to use the doccano.app.classifier.train_test_split function in doccano

To help you get started, we’ve selected a few doccano examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github doccano / doccano / app / classifier / task.py View on Github external
def run(filename):
    print('Loading dataset...')
    data = load_dataset(filename)
    x_train, x_test, y_train, ids = train_test_split(data)

    print('Building vectorizer and model...')
    vectorizer = build_vectorizer()
    clf = build_model()

    print('Vectorizing...')
    x_train = vectorizer.fit_transform(x_train)
    x_test = vectorizer.transform(x_test)

    print('Fitting...')
    clf.fit(x_train, y_train)

    print('Predicting...')
    y_pred = clf.predict(x_test)
    y_prob = clf.predict_proba(x_test)
    y_prob = np.max(y_prob, axis=-1)