mahout使用

转自:http://hi.baidu.com/pakko/blog/item/3516fd6e34032bce80cb4afb.html

运行kmeans的简单的例子:

1:将样本数据集放到hdfs中指定文件下,应该在testdata文件夹下
$HADOOP_HOME/bin/hadoop fs -put <PATH TO DATA> testdata
例如:
bin/hadoop fs   -put /home/hadoopuser/mahout-0.3/test/synthetic_control.data  /user/hadoopuser/testdata/

2:使用kmeans算法
$HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.apache.mahout.clustering.syntheticcontrol.kmeans.Job
例如:
bin/hadoop jar /home/hadoopuser/mahout-0.3/mahout-examples-0.1.job org.apache.mahout.clustering.syntheticcontrol.kmeans.Job

3:使用canopy算法
$HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.apache.mahout.clustering.syntheticcontrol.canopy.Job
例如:
bin/hadoop jar /home/hadoopuser/mahout-0.3/mahout-examples-0.1.job org.apache.mahout.clustering.syntheticcontrol.canopy.Job

4:使用dirichlet 算法
$HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.apache.mahout.clustering.syntheticcontrol.dirichlet.Job

5:使用meanshift算法
meanshift : $HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.apache.mahout.clustering.syntheticcontrol.meanshift.Job

6:查看一下结果吧
bin/mahout vectordump --seqFile /user/hadoopuser/output/data/part-00000
这个直接把结果显示在控制台上。

Get the data out of HDFS  and have a look 
All example jobs use testdata as input and output to directory output
Use bin/hadoop fs -lsr output to view all outputs
Output:
KMeans is placed into output/points
Canopy and MeanShift results are placed into output/clustered-points

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值