Ejemplo n.º 1
0
print("EMP@5, EMR@5, EMF@5")
for em in example_based_measure_5:
    print(em, ",")

example_based_measure_10 = example_based_evaluation(test_mesh, top_10_mesh)
print("EMP@10, EMR@10, EMF@10")
for em in example_based_measure_10:
    print(em, ",")

example_based_measure_15 = example_based_evaluation(test_mesh, top_15_mesh)
print("EMP@15, EMR@15, EMF@15")
for em in example_based_measure_15:
    print(em, ",")

######## label-based evaluation #######
label_measure_5 = perf_measure(test_labels, top_5_pred)
print("MaP@5, MiP@5, MaF@5, MiF@5: ")
for measure in label_measure_5:
    print(measure, ",")

label_measure_10 = perf_measure(test_labels, top_10_pred)
print("MaP@10, MiP@10, MaF@10, MiF@10: ")
for measure in label_measure_10:
    print(measure, ",")

label_measure_15 = perf_measure(test_labels, top_15_pred)
print("MaP@15, MiP@15, MaF@15, MiF@15: ")
for measure in label_measure_15:
    print(measure, ",")

############ hierachy evaluation ################
Ejemplo n.º 2
0
print("Hamming Loss@20: ", Hamming_loss_20)

###### example-based evaluation
# convert binary label back to orginal ones
top_10_labels = mlb.inverse_transform(top_10_pred)
top_20_labels = mlb.inverse_transform(top_20_pred)

# calculate example-based evaluation
example_based_measure_10 = example_based_evaluation(test_mesh, top_10_labels)
print("EMP@10, EMR@10, EMF@10")
for em in example_based_measure_10:
    print(em, ",")

example_based_measure_20 = example_based_evaluation(test_mesh, top_20_labels)
print("EMP@20, EMR@20, EMF@20")
for em in example_based_measure_20:
    print(em, ",")

# label-based evaluation
label_measure_10 = perf_measure(test_labels, top_10_pred)
print("MaP@10, MiP@10, MaF@10, MiF@10: ")
for measure in label_measure_10:
    print(measure, ",")

label_measure_20 = perf_measure(test_labels, top_20_pred)
print("MaP@20, MiP@20, MaF@20, MiF@20: ")
for measure in label_measure_20:
    print(measure, ",")

print("Finish!")