Item-Based Recommendations with Hadoop

Mahout在MapReduce上实现了Item-Based Collaborative Filtering,这里我尝试运行一下。

  1. 安装Hadoop

  2. 从下载Mahout并解压

  3. 准备数据

    下载1 Million MovieLens Dataset,解压得到ratings.dat,用

    sed 's/:😦0-9{1,}):😦0-9{1})::0-9{1,}$/,\1,\2/' ratings.dat

    处理成需要的格式。

  4. 运行

    mahout recommenditembased -s SIMILARITY_LOGLIKELIHOOD -i /path/to/input/file -o /path/to/desired/output -n 25

    参数:

    MAHOUT-JOB: /home/laxe/apple/mahout/mahout-examples-0.11.0-job.jar
    Job-Specific Options:
    --input (-i) input Path to job input directory.
    --output (-o) output The directory pathname for output.
    --numRecommendations (-n) numRecommendations Number of recommendations per user.
    --usersFile usersFile File of users to recommend for.
    --itemsFile itemsFile File of items to recommend for.
    --filterFile (-f) filterFile File containing comma-separated userID,itemID pairs. Used to exclude the item from the recommendations for that user(optional).
    --userItemFile (-uif) userItemFile File containing comma-separated userID,itemID pairs(optional). Used to include only these items into recommendations. Cannot be used together with usersFile or itemsFile.
    --booleanData (-b) booleanData Treat input as without prefvalues.
    --maxPrefsPerUser (-mxp) maxPrefsPerUser Maximum number of preferences considered per user in final recommendation phase.
    --minPrefsPerUser (-mp) minPrefsPerUser Ignore users with less preferences than this in the similarity computation (default: 1).
    --maxSimilaritiesPerItem (-m) maxSimilaritiesPerItem Maximum number of similarities considered per item.
    --maxPrefsInItemSimilarity (-mpiis) maxPrefsInItemSimilarity Max number of preferences to consider per user or item in the item similarity computation phase, users or items with more preferences will be sampled down(default: 500).
    --similarityClassname (-s) similarityClassname Name of distributed similarity measures class to instantiate,
    alternatively use one of the predefined similarities([SIMILARITY_COOCCURRENCE, SIMILARITY_LOGLIKELIHOOD, SIMILARITY_TANIMOTO_COEFFICIENT, SIMILARITY_CITY_BLOCK, SIMILARITY_COSINE, SIMILARITY_PEARSON_CORRELATION, SIMILARITY_EUCLIDEAN_DISTANCE])
    --threshold (-tr) threshold Discard item pairs with a similarity value below this.
    --outputPathForSimilarityMatrix (-opfsm) outputPathForSimilarityMatrix Write the items imilarity matrix to this path(optional).
    --randomSeed randomSeed Use this seed for sampling.
    --sequencefileOutput Write the output into a Sequence File instead of a text file.
    --help (-h) Print out help.
    --tempDir tempDir Intermediate output directory.
    --startPhase startPhase First phase to run.
    --endPhase endPhase Last phase to run specify HDFS directories while running on hadoop; else specify local file system directories.

参考
Introduction to Item-Based Recommendations with Hadoop
mahout分布式:Item-based推荐

相关推荐
Zldaisy3d26 分钟前
增材制造医用惰性金属假体修复四肢骨缺损临床诊疗指南(2026)
大数据·人工智能·制造
DataY轻量数据平台1 小时前
从 Kafka 到数据库,只差一个“数据格式转换”组件
数据库·分布式·kafka
阿俊-全栈开发1 小时前
库存设计解析:LikeShop Go 版商城分布式秒杀库存的落地设计方案
开发语言·分布式·golang·likeshop开源商城·likeshop源码
西木莉1 小时前
我国大数据标准化研究现状与发展建议
大数据
starzy19901 小时前
Apache Flink 2.3 概述:一条流,两种边界,一套引擎
大数据·flink·apache
云老大-阿里云国际站代理商1 小时前
华为云国际站代理商:GaussDB分布式事务如何处理?跨节点事务对业务有什么影响?
分布式·华为云·gaussdb
Eric-Ln13 小时前
大数据在 AI 时代来临下的思考与感悟
大数据·ai·bigdata
互联网江湖14 小时前
逐际动力张巍:具身智能的瓶颈在“技能”,而非“智能”
大数据·人工智能
leijiwen15 小时前
链生之境・以数据要素确权驱动智能服务的本地生活服务平台
大数据·人工智能·生活
linweidong15 小时前
Headless BI 实战:指标语义层从设计到落地的完整过程
大数据·数据挖掘·flink·数据湖·finebi·bi·chat bi