【甘道夫】通过Mahout构建推荐系统--通过IDRescorer扩展评分规则

本文介绍了如何利用Apache Mahout的IDRescorer接口来构建推荐系统并添加自定义的评分规则和过滤逻辑。通过实现rescore和isFiltered方法,可以对推荐结果进行重新评分和过滤,例如排除一年内创建的物品。
摘要由CSDN通过智能技术生成
通过Mahout构建推荐系统时,如果我们需要加入某些过滤规则(比如:item的创建时间在一年以内),则需要用到 IDRescorer 接口,该接口源码如下:

package org.apache.mahout.cf.taste.recommender;
/**
 * <p>
 * A {@link Rescorer} which operates on {@code long} primitive IDs, rather than arbitrary {@link Object}s.
 * This is provided since most uses of this interface in the framework take IDs (as {@code long}) as an
 * argument, and so this can be used to avoid unnecessary boxing/unboxing.
 * </p>
 */
public interface IDRescorer {
  
  /**
   * @param id
   *          ID of thing (user, item, etc.) to rescore
   * @param originalScore
   *          original score
   * @return modified score, or {@link Double#NaN} to indicate that this should be excluded entirely
   */
  double rescore(long id, double originalScore);
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值