威斯尼斯人官网 1

MapReduce实现推荐系统

Step1.java,按客商分组,计算有所物品现身的结缘列表,获得客户对货物的评分矩阵

Oracle Linux Enterprise 5.9

Step3.java,对同现矩阵和评分矩阵转型

    public static JobConf config() {
        JobConf conf = new JobConf(Recommend.class);
        conf.setJobName(“Recommand”);
        conf.addResource(“classpath:/hadoop/core-site.xml”);
        conf.addResource(“classpath:/hadoop/hdfs-site.xml”);
        conf.addResource(“classpath:/hadoop/mapred-site.xml”);
        //conf.set(“io.sort.mb”, “1024”);
        return conf;
    }

MyEclipse 6.5

        Map<String, String> path = new HashMap<String,
String>();
        path.put(“data”,
“C:\Users\licz\workspace\Mapreduce1\small2.csv”);
        path.put(“Step1Input”, HDFS + “/user/hdfs/recommend”);
        path.put(“Step1Output”, path.get(“Step1Input”) + “/step1”);
        path.put(“Step2Input”, path.get(“Step1Output”));
        path.put(“Step2Output”, path.get(“Step1Input”) + “/step2”);
        path.put(“Step3Input1”, path.get(“Step1Output”));
        path.put(“Step3Output1”, path.get(“Step1Input”) +
“/step3_1”);
        path.put(“Step3Input2”, path.get(“Step2Output”));
        path.put(“Step3Output2”, path.get(“Step1Input”) +
“/step3_2”);
        path.put(“Step4Input1”, path.get(“Step3Output1”));
        path.put(“Step4Input2”, path.get(“Step3Output2”));
        path.put(“Step4Output”, path.get(“Step1Input”) + “/step4”);

        Step1.run(path);
        Step2.run(path);
        Step3.run1(path);
        Step3.run2(path);
        Step4.run(path);
        System.exit(0);
    }

Java 1.6.0_18

威斯尼斯人官网 ,1.付出情状:

namenode:10.1.32.91

Step2.java,对货品组合列表举办计数,建构货色的同现矩阵

public class Recommend {
    public static final String HDFS = “hdfs://10.1.32.91:9000”;
    public static final Pattern DELIMITER =
Pattern.compile(“[t,]”);
    public static void main(String[] args) throws Exception {

意况布置见:

Hadoop:hadoop 1.2.1三节点

import org.apache.hadoop.mapred.JobConf;

datanode:10.1.32.95

条件安插见:

Step4.java,合併矩阵,并总计推荐结果列表

2.Hadoop集群遭逢:

datanode:10.1.32.93

4.施行代码和平运动作结果:

Windows 2008 64bit Java 1.6.0_30
MyEclipse 6.5 情形计划见: 2.Hadoop集群条件: Oracle Linux Enterprise
5.9 Java 1.6.0_18 Hadoop:hadoop 1.2.1三节点 n…

  • 1
  • 2
  • 3
  • 4
  • 5
  • 下一页

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

3.各java类功用介绍:

威斯尼斯人官网 1

Recommend.java,主任务运转程序

}

Recommend.java 代码:

Java 1.6.0_30

HdfsDAO.java,HDFS操作工具类

Windows 2008 64bit

发表评论

电子邮件地址不会被公开。 必填项已用*标注

相关文章