一. 评测指标
用户满意度、预测准确度、覆盖率、多样性、 新颖性、惊喜度、信任度、实时性、健壮性、商业指标
1. 用户满意度
满意度是评测举荐零碎的最重要指标,只能通过用户考察或者在线试验取得,次要是通过考察问卷的模式,须要从不同的侧面询问用户对后果的不同感触
2. 预测准确度
标是最重要的举荐零碎离线评测指标,通过离线试验计算
def Recall(train, test, N): hit = 0 all = 0 for user in train.keys(): tu = test[user] rank = GetRecommendation(user, N) for item, pui in rank: if item in tu: hit += 1 all += len(tu) return hit / (all * 1.0)def Precision(train, test, N): hit = 0 all = 0 for user in train.keys(): tu = test[user] rank = GetRecommendation(user, N) for item, pui in rank: if item in tu: hit += 1 all += N return hit / (all * 1.0)
1. 评分预测准确度
个别通过均方根误差(RMSE)和均匀绝对误差(MAE)计算,那么RMSE的定义为:
def RMSE(records): return math.sqrt(\ sum([(rui-pui)*(rui-pui) for u,i,rui,pui in records])\ / float(len(records)))def MAE(records): return sum([abs(rui-pui) for u,i,rui,pui in records])\ / float(len(records))
2. TopN举荐
TopN举荐的预测准确率个别通过准确率(precision)/召回率(recall)度量。
def PrecisionRecall(test, N): hit = 0 n_recall = 0 n_precision = 0 for user, items in test.items(): rank = Recommend(user, N) hit += len(rank & items) n_recall += len(items) n_precision += N return [hit / (1.0 * n_recall), hit / (1.0 * n_precision)]
为了全面评测TopN举荐的准确率和召回率,个别会选取不同的举荐列表长度N,
计算出一组准确率/召回率,而后画出准确率/召回率曲线(precision/recall curve)。
3. 覆盖率
覆盖率(coverage)形容一个举荐系统对物品长尾的挖掘能力
def Popularity(train, test, N): item_popularity = dict() for user, items in train.items(): for item in items.keys() if item not in item_popularity: item_popularity[item] = 0 item_popularity[item] += 1 ret = 0 n = 0 for user in train.keys(): rank = GetRecommendation(user, N) for item, pui in rank: ret += math.log(1 + item_popularity[item]) n += 1 ret /= n * 1.0 return ret
4. 多样性
为了满足用户宽泛的趣味,举荐列表须要可能笼罩用户不同的趣味畛域
而举荐零碎的整体多样性能够定义为所有用户举荐列表多样性的平均值
5. 新颖性
新鲜的举荐是指给用户举荐那些他们以前没有据说过的物品
6. 惊喜度
如果举荐后果和用户的历史趣味不类似,但却让用户感觉称心,那么就能够说举荐后果的惊喜度很高
7. 信任度
度量举荐零碎的信任度只能通过问卷调查的形式,询问用户是否信赖举荐零碎的举荐后果
8. 实时性
物品(新闻、微博等)具备很强的时效性,所以须要在物品还具备时效性时就将它们举荐给用户
9. 健壮性
如果攻打后的举荐列表绝对于攻打前没有产生大的变动,就阐明算法比拟强壮
10. 商业指标
网站评测举荐零碎更加重视网站的商业指标是否达成,而商业指标和网站的盈利模式是非亲非故的。