Skip to content

Instantly share code, notes, and snippets.

@robotenique
Created May 19, 2019 22:38
Show Gist options
  • Save robotenique/a892a1dc4e9465484189e9ed1481fa8d to your computer and use it in GitHub Desktop.
Save robotenique/a892a1dc4e9465484189e9ed1481fa8d to your computer and use it in GitHub Desktop.
from fklearn.validation.evaluators import auc_evaluator, logloss_evaluator, precision_evaluator, recall_evaluator, \
combined_evaluators, temporal_split_evaluator
def tweet_eval(target_column, prediction_column, time_column):
eval_args = dict(target_column=target_column, prediction_column=prediction_column)
basic_evaluator = combined_evaluators(evaluators=[
auc_evaluator(**eval_args),
logloss_evaluator(**eval_args),
precision_evaluator(**eval_args),
recall_evaluator(**eval_args)
])
final_evaluator = combined_evaluators(evaluators=[
basic_evaluator,
temporal_split_evaluator(eval_fn=basic_evaluator, time_col=time_column, time_format="%Y-%U") # Weekly
])
return final_evaluator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment