Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattiasostmar/42b0d846a2e3db6d8afa92e6f90d445b to your computer and use it in GitHub Desktop.
Save mattiasostmar/42b0d846a2e3db6d8afa92e6f90d445b to your computer and use it in GitHub Desktop.
Python code to compute accuracy and Cohens Kappa
[in:]
tot_accuracy = sum(test['func'] == test['predicted']) / len(test)
print("Accuracy all 8 classes together: {}".format(tot_accuracy))
# Total Cohens Kappa
tot_kappa = (fe_accuracy - 0.125) / 0.125
print("Cohens Kappa all 8 classes together: {}".format(tot_kappa))
[out:]
Accuracy all 8 classes together: 0.8285714285714286
Cohens Kappa all 8 classes together: 5.628571428571429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment