Work on models.md
This commit is contained in:
@@ -68,7 +68,9 @@ def finetune():
|
||||
@ucsinfer.command('evaluate')
|
||||
@click.option('--offset', type=int, default=0)
|
||||
@click.option('--limit', type=int, default=-1)
|
||||
@click.option('--no-foley', type=bool, default=False)
|
||||
@click.option('--no-foley', 'no_foley', flag_value=True, default=False,
|
||||
help="Ignore any data in the set with FOLYProp or FOLYFeet "
|
||||
"category")
|
||||
@click.option('--model', type=str,
|
||||
default="paraphrase-multilingual-mpnet-base-v2")
|
||||
@click.argument('dataset', type=click.File('r', encoding='utf8'),
|
||||
@@ -90,6 +92,9 @@ def evaluate(dataset, offset, limit, model, no_foley):
|
||||
break
|
||||
|
||||
cat_id, description = row
|
||||
if no_foley and cat_id in ['FOLYProp', 'FOLYFeet']:
|
||||
continue
|
||||
|
||||
guesses = ctx.classify_text_ranked(description, limit=10)
|
||||
if cat_id == guesses[0]:
|
||||
results.append({'catid': cat_id, 'result': "TOP"})
|
||||
@@ -116,8 +121,10 @@ def evaluate(dataset, offset, limit, model, no_foley):
|
||||
|
||||
miss_counts = sorted(miss_counts, key=lambda x: x[1])
|
||||
|
||||
print(f"Results for Model {model}")
|
||||
print("=====\n")
|
||||
print(f"## Results for Model {model} ##")
|
||||
|
||||
if no_foley:
|
||||
print("(FOLYProp and FOLYFeet have been omitted from the dataset.)\n")
|
||||
|
||||
table = [
|
||||
["Total records in sample:", f"{total}"],
|
||||
@@ -136,7 +143,7 @@ def evaluate(dataset, offset, limit, model, no_foley):
|
||||
f"{float(miss_counts[-1][1])/float(total):.2%}"]
|
||||
]
|
||||
|
||||
print(tabulate(table, headers=['', 'n', 'pct'], tablefmt='rst'))
|
||||
print(tabulate(table, headers=['', 'n', 'pct'], tablefmt='github'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user