Skip to content

Instantly share code, notes, and snippets.

@tokoroten
Created April 11, 2015 09:22
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 tokoroten/1eb8cf801d372b829aba to your computer and use it in GitHub Desktop.
Save tokoroten/1eb8cf801d372b829aba to your computer and use it in GitHub Desktop.
# https://www.kaggle.com/c/otto-group-product-classification-challenge/details/evaluation
def print_kaggle_score(label_list, proba_result):
label_index = sorted(list(set(label_list)))
score = - 1.0 / len(label_list) * sum(
[
math.log(
max(min(
proba_result[i][label_index.index(label_list[i])]
/ sum(proba_result[i])
,
1 - 1e-15
),
1e-15)
)
for i in xrange(len(label_list))
]
)
print "kaggle_score=", score
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment