Skip to content

Instantly share code, notes, and snippets.

@robotenique
Last active May 19, 2019 22:03
Show Gist options
  • Save robotenique/253e6df04b258864f62b9e4d867f9487 to your computer and use it in GitHub Desktop.
Save robotenique/253e6df04b258864f62b9e4d867f9487 to your computer and use it in GitHub Desktop.
Gist for tweet analysis using fklearn
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