mahout kmeans 例子

一、mahout 简单例子测试


mahout 安装配置可以参考:mahout安装配置

1、kmeans 聚类算法测试数据来源:

    地址:http://archive.ics.uci.edu/ml/databases/synthetic_control/synthetic_control.data

2、下载数据,把数据存放到hdfs上(hadoop2.6.1 已经启动)

       创建测试目录testdata,并把数据导入到这个tastdata目录中(这里的目录的名字只能是testdata)

  
  
  1. $ hdfs dfs -mkdir testdata
  2. $ hdfs dfs -put /home/lin/hadoop/mahout-distribution-0.10.0/test.data  testdata

3、执行kmeans算法,等待运行结果

  
  
  1. $ hadoop jar /home/lin/hadoop/mahout-distribution-0.10.0/mahout-examples-0.10.0-job.jar org.apache.mahout.clustering.syntheticcontrol.kmeans.Job

4、运行成功查看运行结果

  
  
  1. hdfs dfs -ls output

显示如下结果证明运行成功:

  
  
  1. lin@lin162:~/hadoop/hadoop-2.6.1/etc/hadoop$ hdfs dfs -ls output        
  2. Found 15 items
  3. -rw-r--r--   2 lin supergroup        194 2015-12-01 12:27 output/_policy
  4. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:27 output/clusteredPoints
  5. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:22 output/clusters-0
  6. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:23 output/clusters-1
  7. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:27 output/clusters-10-final
  8. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:23 output/clusters-2
  9. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:24 output/clusters-3
  10. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:24 output/clusters-4
  11. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:25 output/clusters-5
  12. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:25 output/clusters-6
  13. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:25 output/clusters-7
  14. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:26 output/clusters-8
  15. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:26 output/clusters-9
  16. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:22 output/data
  17. drwxr-xr-x   - lin supergroup          0 2015-12-01 12:22 output/random-seeds



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值