Created
January 17, 2022 14:26
-
-
Save khaledadrani/2f86a5d64c5f3fd10b2ce931fa87a812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Evaluation of trained model | |
# Start remove 'O' labels | |
labels = list(crf.classes_) | |
labels.remove('O') | |
print("trained labels :",labels) | |
# start prediction and calculate f-score | |
y_pred = crf.predict(X_test) | |
print (metrics.flat_f1_score(y_test, y_pred, | |
average='weighted', labels=labels,zero_division=True)) | |
# Inspect evaluation per class | |
# group B and I results | |
sorted_labels = sorted( | |
labels, | |
key=lambda name: (name[1:], name[0]) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment