Mahout 是一个很强大的数据挖掘工具,是一个分布式机器学习算法的集合,包括:被称为Taste的分布式协同过滤的实现、分类、聚类等。Mahout最大的优点就是基于hadoop实现,把很多以前运行于单机上的算法,转化为了MapReduce模式,这样大大提升了算法可处理的数据量和处理性能。



一、Mahout安装、配置



1、下载并解压Mahout

http://archive.apache.org/dist/mahout/

tar -zxvf mahout-distribution-0.9.tar.gz



2、配置环境变量

# set mahout environment

export MAHOUT_HOME=/mnt/jediael/mahout/mahout-distribution-0.9

export MAHOUT_CONF_DIR=$MAHOUT_HOME/conf

export PATH=$MAHOUT_HOME/conf:$MAHOUT_HOME/bin:$PATH



3、安装mahout

[jediael@master mahout-distribution-0.9]$ pwd

/mnt/jediael/mahout/mahout-distribution-0.9

[jediael@master mahout-distribution-0.9]$ mvn install



4、验证Mahout是否安装成功

    执行命令mahout。若列出一些算法,则成功:

[jediael@master mahout-distribution-0.9]$ mahout
Running on hadoop, using /mnt/jediael/hadoop-1.2.1/bin/hadoop and HADOOP_CONF_DIR=
MAHOUT-JOB: /mnt/jediael/mahout/mahout-distribution-0.9/examples/target/mahout-examples-0.9-job.jar
An example program must be given as the first argument.
Valid program names are:
arff.vector: : Generate Vectors from an ARFF file or directory
baumwelch: : Baum-Welch algorithm for unsupervised HMM training
canopy: : Canopy clustering
cat: : Print a file or resource as the logistic regression models would see it
cleansvd: : Cleanup and verification of SVD output
clusterdump: : Dump cluster output to text
clusterpp: : Groups Clustering Output In Clusters
cmdump: : Dump confusion matrix in HTML or text formats
concatmatrices: : Concatenates 2 matrices of same cardinality into a single matrix
cvb: : LDA via Collapsed Variation Bayes (0th deriv. approx)
cvb0_local: : LDA via Collapsed Variation Bayes, in memory locally.
evaluateFactorization: : compute RMSE and MAE of a rating matrix factorization against probes
fkmeans: : Fuzzy K-means clustering
hmmpredict: : Generate random sequence of observations by given HMM
itemsimilarity: : Compute the item-item-similarities for item-based collaborative filtering
kmeans: : K-means clustering
lucene.vector: : Generate Vectors from a Lucene index
lucene2seq: : Generate Text SequenceFiles from a Lucene index
matrixdump: : Dump matrix in CSV format
matrixmult: : Take the product of two matrices
parallelALS: : ALS-WR factorization of a rating matrix
qualcluster: : Runs clustering experiments and summarizes results in a CSV
recommendfactorized: : Compute recommendations using the factorization of a rating matrix
recommenditembased: : Compute recommendations using item-based collaborative filtering
regexconverter: : Convert text files on a per line basis based on regular expressions
resplit: : Splits a set of SequenceFiles into a number of equal splits
rowid: : Map SequenceFile<Text,VectorWritable> to {SequenceFile<IntWritable,VectorWritable>, SequenceFile<IntWritable,Text>}
rowsimilarity: : Compute the pairwise similarities of the rows of a matrix
runAdaptiveLogistic: : Score new production data using a probably trained and validated AdaptivelogisticRegression model
runlogistic: : Run a logistic regression model against CSV data
seq2encoded: : Encoded Sparse Vector generation from Text sequence files
seq2sparse: : Sparse Vector generation from Text sequence files
seqdirectory: : Generate sequence files (of Text) from a directory
seqdumper: : Generic Sequence File dumper
seqmailarchives: : Creates SequenceFile from a directory containing gzipped mail archives
seqwiki: : Wikipedia xml dump to sequence file
spectralkmeans: : Spectral k-means clustering
split: : Split Input data into test and train sets
splitDataset: : split a rating dataset into training and probe parts
ssvd: : Stochastic SVD
streamingkmeans: : Streaming k-means clustering
svd: : Lanczos Singular Value Decomposition
testnb: : Test the Vector-based Bayes classifier
trainAdaptiveLogistic: : Train an AdaptivelogisticRegression model
trainlogistic: : Train a logistic regression using stochastic gradient descent
trainnb: : Train the Vector-based Bayes classifier
transpose: : Take the transpose of a matrix
validateAdaptiveLogistic: : Validate an AdaptivelogisticRegression model against hold-out data set
vecdist: : Compute the distances between a set of Vectors (or Cluster or Canopy, they must fit in memory) and a list of Vectors
vectordump: : Dump vectors from a sequence file to text
viterbi: : Viterbi decoding of hidden states from given output states sequence

二、使用简单示例验证mahout

1、启动Hadoop

2、下载测试数据

           http://archive.ics.uci.edu/ml/databases/synthetic_control/链接中的synthetic_control.data

或者百度一下也很容易找到这个示例数据。

3、上传测试数据

hadoop fs -put synthetic_control.data testdata

4、 使用Mahout中的kmeans聚类算法,执行命令:

mahout -core  org.apache.mahout.clustering.syntheticcontrol.kmeans.Job

花费9分钟左右完成聚类 。

5、查看聚类结果

    执行hadoop fs -ls /user/root/output,查看聚类结果。

[jediael@master mahout-distribution-0.9]$ hadoop fs -ls output
Found 15 items
-rw-r--r-- 2 jediael supergroup 194 2015-03-07 15:07 /user/jediael/output/_policy
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:07 /user/jediael/output/clusteredPoints
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:02 /user/jediael/output/clusters-0
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:02 /user/jediael/output/clusters-1
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:07 /user/jediael/output/clusters-10-final
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:03 /user/jediael/output/clusters-2
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:03 /user/jediael/output/clusters-3
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:04 /user/jediael/output/clusters-4
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:04 /user/jediael/output/clusters-5
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:05 /user/jediael/output/clusters-6
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:05 /user/jediael/output/clusters-7
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:06 /user/jediael/output/clusters-8
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:07 /user/jediael/output/clusters-9
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:02 /user/jediael/output/data
drwxr-xr-x - jediael supergroup 0 2015-03-07 15:02 /user/jediael/output/random-seeds

Mahout快速入门教程的更多相关文章

  1. Mahout快速入门教程 分类: B10_计算机基础 2015-03-07 16:20 508人阅读 评论(0) 收藏

    Mahout 是一个很强大的数据挖掘工具,是一个分布式机器学习算法的集合,包括:被称为Taste的分布式协同过滤的实现.分类.聚类等.Mahout最大的优点就是基于hadoop实现,把很多以前运行于单 ...

  2. 专为设计师而写的GitHub快速入门教程

    专为设计师而写的GitHub快速入门教程 来源: 伯乐在线 作者:Kevin Li     原文出处: Kevin Li 在互联网行业工作的想必都多多少少听说过GitHub的大名,除了是最大的开源项目 ...

  3. EntityFramework6 快速入门教程

    EntityFramework6 快速入门教程 不得不说EF在国内实在是太小众,相关的技术文章真实屈指可数,而且很多文章都很旧了,里面使用的版本跟如今的EF6差别还是比较大.我刚开始弄这个的时候真是绕 ...

  4. Apple Watch开发快速入门教程

     Apple Watch开发快速入门教程  试读下载地址:http://pan.baidu.com/s/1eQ8JdR0 介绍:苹果为Watch提供全新的开发框架WatchKit.本教程是国内第一本A ...

  5. 指示灯组与3个复位按钮的介绍Arduino Yun快速入门教程

    指示灯组与3个复位按钮的介绍Arduino Yun快速入门教程 1.4.2  指示灯组 指示灯组的放大图如图1.5所示. 图1.5  指示灯组 各个指示灯对应的功能如下: q  RX:对应于0号端口, ...

  6. 游戏控制杆OUYA游戏开发快速入门教程

    游戏控制杆OUYA游戏开发快速入门教程 1.2.2  游戏控制杆 游戏控制杆各个角度的视图,如图1-4所示,它的硬件规格是本文选自OUYA游戏开发快速入门教程大学霸: 图1-4  游戏控制杆各个角度的 ...

  7. Query 快速入门教程

    Query 快速入门教程 http://www.365mini.com/page/jquery-quickstart.htm#what_is_jquery jquery常用方法及使用示例汇总 http ...

  8. Realm for Android快速入门教程

    介绍 如果你关注安卓开发的最新趋势,你可能已经听说过Realm.Realm是一个可以替代SQLite以及ORMlibraries的轻量级数据库. 相比SQLite,Realm更快并且具有很多现代数据库 ...

  9. CMake快速入门教程-实战

    http://www.ibm.com/developerworks/cn/linux/l-cn-cmake/ http://blog.csdn.net/dbzhang800/article/detai ...

随机推荐

  1. DEDE数据库修改后台变量

    进行数据库之后找到 dede_sysconfig 这个数据表,然后查找到你要删除的dede教程变量名称. 这样就可以了

  2. LINUX VPS 查看系统信息命令

    系统# uname -a # 查看内核/操作系统/CPU信息# head -n 1 /etc/issue # 查看操作系统版本# cat /proc/cpuinfo # 查看CPU信息# hostna ...

  3. HTML&CSS基础学习笔记1.22-简单的注册页面

    一个简单的注册页面 表单提交是前后端数据交互的一种方式. 代码区是一个注册页面,其中包含了以下标签:<form>.<table>.<input>.<butto ...

  4. 容器 set

    SET 是个有序表!他会根据INSERT的数值自动排序! SET里面不可能出现相同的元素!SET在insert的时候会排重的! SET本质上是一种树结构,在检索上比链表快,插入比数组方便,但是不允许重 ...

  5. 移动端远程关闭PC端实现(一)需求设计

    公司有台半新不旧的电脑,因无甚大用,就拿来做了服务器,服务于民.服务器所提供的功能不是太多,无非是数据库以及svn服务. 公司每天下班会断电,我们吧会常常忘记关闭服务器,所以服务器非正常关机的次数约等 ...

  6. SSH登陆错误 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

    今天遇到问题,删除文件即搞定!! ~~~~~~~~~~~~~~ SSH登陆错误 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!   Connectio ...

  7. #if defined 的意思?

    在读s3c2440a的test程序,其中option.h文件中有段语句为: #define LCD_N35 //#define LCD_L80 //#define LCD_T35 //#define ...

  8. java集合经常出现空指针问题的解决方案

    我自己问自己这个问题的时候都把自己给雷住了,但是现实如此,经常写的程序就是出现空指针的错误. 如: public List add(){ List list=null; try { list=new ...

  9. perl 学习笔记

    一:基础 1:安装perl      centos: yum -y install perl       官网:https://www.perl.org/      升级到5.22:先下载,执行./i ...

  10. 代码高亮插件Codemirror使用方法及下载

    代码高亮插件Codemirror使用方法及下载 - 老男孩的日志 - 网易博客 代码高亮插件Codemirror使用方法及下载   2013-10-31 16:51:29|  分类: 默认分类 |   ...