Пример #1
0
def train_and_test(
    train_set,
    test_set,
    ontology,
    model,
    recreate_ontology,
    verbose,
):
    """ An aggregate command for both training and testing. """
    api.train(
        trainset_dir=os.path.abspath(train_set),
        ontology_path=os.path.abspath(ontology),
        model_path=os.path.abspath(model),
        recreate_ontology=recreate_ontology,
        verbose=verbose,
    )
    click.echo(u"Training completed successfully!")

    precision, recall, f1_score, accuracy = api.test(
        testset_path=os.path.abspath(test_set),
        ontology_path=os.path.abspath(ontology),
        model_path=os.path.abspath(model),
        recreate_ontology=recreate_ontology,
        verbose=verbose,
    )
    click.echo()
    click.echo(u"Precision: {0:.2f}%".format(precision * 100))
    click.echo(u"Recall: {0:.2f}%".format(recall * 100))
    click.echo(u"F1-score: {0:.2f}%".format(f1_score * 100))
    click.echo(u"Accuracy: {0:.2f}%".format(accuracy * 100))
Пример #2
0
def train_and_test(
    train_set,
    test_set,
    ontology,
    model,
    recreate_ontology,
    verbose,
):
    """ An aggregate command for both training and testing. """
    api.train(
        trainset_dir=os.path.abspath(train_set),
        ontology_path=os.path.abspath(ontology),
        model_path=os.path.abspath(model),
        recreate_ontology=recreate_ontology,
        verbose=verbose,
    )
    click.echo(u"Training completed successfully!")

    precision, recall, f1_score, accuracy = api.test(
        testset_path=os.path.abspath(test_set),
        ontology_path=os.path.abspath(ontology),
        model_path=os.path.abspath(model),
        recreate_ontology=recreate_ontology,
        verbose=verbose,
    )
    click.echo()
    click.echo(u"Precision: {0:.2f}%".format(precision * 100))
    click.echo(u"Recall: {0:.2f}%".format(recall * 100))
    click.echo(u"F1-score: {0:.2f}%".format(f1_score * 100))
    click.echo(u"Accuracy: {0:.2f}%".format(accuracy * 100))
Пример #3
0
def train(trainset_dir, ontology, model, recreate_ontology, verbose):
    """ Train a model on a given dataset """
    api.train(
        trainset_dir=os.path.abspath(trainset_dir),
        ontology_path=os.path.abspath(ontology),
        model_path=os.path.abspath(model),
        recreate_ontology=recreate_ontology,
        verbose=verbose,
    )
    click.echo(u"Training completed successfully!")
Пример #4
0
def train(trainset_dir, ontology, model, recreate_ontology, verbose):
    """ Train a model on a given dataset """
    api.train(
        trainset_dir=os.path.abspath(trainset_dir),
        ontology_path=os.path.abspath(ontology),
        model_path=os.path.abspath(model),
        recreate_ontology=recreate_ontology,
        verbose=verbose,
    )
    click.echo(u"Training completed successfully!")