libcity.evaluator.eval_funcs

libcity.evaluator.eval_funcs.F1_Score_torch(preds, labels, topk)[source]
libcity.evaluator.eval_funcs.MAP_torch(preds, labels, topk)[source]
libcity.evaluator.eval_funcs.PCC_torch(preds, labels, topk)[source]
libcity.evaluator.eval_funcs.Precision_torch(preds, labels, topk)[source]
libcity.evaluator.eval_funcs.Recall_torch(preds, labels, topk)[source]
libcity.evaluator.eval_funcs.acc(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.mae(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.mape(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.mare(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.mse(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.rmse(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.smape(loc_pred, loc_true)[source]
libcity.evaluator.eval_funcs.top_k(loc_pred, loc_true, topk)[source]

count the hit numbers of loc_true in topK of loc_pred, used to calculate Precision, Recall and F1-score, calculate the reciprocal rank, used to calcualte MRR, calculate the sum of DCG@K of the batch, used to calculate NDCG

Parameters
  • loc_pred – (batch_size * output_dim)

  • loc_true – (batch_size * 1)

  • topk

Returns

tuple contains:

hit (int): the hit numbers

rank (float): the sum of the reciprocal rank of input batch

dcg (float): dcg

Return type

tuple