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

时间:2022-09-11 08:21:39

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快速入门教程 分类: B10_计算机基础 2015-03-07 16:20 508人阅读 评论(0) 收藏的更多相关文章

  1. Json入门 分类: C&lowbar;OHTERS 2014-04-23 16&colon;20 601人阅读 评论&lpar;0&rpar; 收藏

    参考<疯狂android讲义>>730页 JSON的基础请参考W3SCHOOL的教程: http://www.w3school.com.cn/json/index.asp 例子: h ...

  2. CocoaPods安装和使用教程 分类: ios技术 ios相关 2015-03-11 21&colon;53 48人阅读 评论&lpar;0&rpar; 收藏

    目录 CocoaPods是什么? 如何下载和安装CocoaPods? 如何使用CocoaPods? 场景1:利用CocoaPods,在项目中导入AFNetworking类库 场景2:如何正确编译运行一 ...

  3. shell入门之流程控制语句 分类: 学习笔记 linux ubuntu 2015-07-10 16&colon;38 89人阅读 评论&lpar;0&rpar; 收藏

    1.case 脚本: #!/bin/bash #a test about case case $1 in "lenve") echo "input lenve" ...

  4. 总结分享十大iOS开发者最喜爱的库 分类: ios相关 app相关 2015-04-03 16&colon;43 320人阅读 评论&lpar;0&rpar; 收藏

    该10大iOS开发者最喜爱的库由"iOS辅导团队"成员Marcelo Fabri组织投票选举而得,参与者包括开发者团队,iOS辅导团队以及行业嘉宾.每个团队都要根据以下规则选出五个 ...

  5. Currency Exchange 分类: POJ 2015-07-14 16&colon;20 10人阅读 评论&lpar;0&rpar; 收藏

    Currency Exchange Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 22180 Accepted: 8015 De ...

  6. ubuntu中安装samba 分类: linux 学习笔记 ubuntu 2015-07-07 16&colon;14 46人阅读 评论&lpar;0&rpar; 收藏

    为了方便的和Windows之间进行交互,samba必不可少. 当然,他的安装使用也很简单: 安装: sudo apt-get install samba sudo apt-get install sm ...

  7. linux中的网络通信指令 分类: 学习笔记 linux ubuntu 2015-07-06 16&colon;02 134人阅读 评论&lpar;0&rpar; 收藏

    1.write write命令通信是一对一的通信,即两个人之间的通信,如上图. 效果图 用法:write <用户名> 2.wall wall指令可将信息发送给每位同意接收公众信息的终端机用 ...

  8. ubuntu文件管理常用命令 分类: linux ubuntu 学习笔记 2015-07-02 16&colon;57 29人阅读 评论&lpar;0&rpar; 收藏

    1.关闭防火墙:ufw disable 2.以.开头的表示隐藏文件 3..和..分别代表当前目录以及当前目录的父目录 4.显示当前用户所在目录pwd 5.touch创建空文件 6.mkdir创建新目录 ...

  9. iOS开源库--最全的整理 分类: ios相关 2015-04-08 09&colon;20 486人阅读 评论&lpar;0&rpar; 收藏

    youtube下载神器:https://github.com/rg3/youtube-dl 我擦咧 vim插件:https://github.com/Valloric/YouCompleteMe vi ...

随机推荐

  1. 如何为 Eclipse 中的 Java 源文件设置为 UTF-8 默认编码(转)

    要让一个 Java 源文件打开时编码格式为 UTF-8,需要做2件事情: 1)设置Java 源文件的默认编码格式为UTF-8: 2)设置workspace的编码格式为UTF-8. 相应设置如下: 设置 ...

  2. decorators&period;xml的用法 (转)

    spring,hibernate框架做的,对了,还有jQuery. 我用jquery做异步请求到后台,生成json数据返回前台生成下拉输入框,请求到后台以后,成功生成了json数据并根据struts的 ...

  3. BZOJ4003 &lbrack;JLOI2015&rsqb;城池攻占

    这题有两种做法来着... 第一种就是一开始想到的比较不靠谱,不过貌似可以过掉: 看从$1$号节点开始到$p$号节点最大需要的体力,记录单调上升的体力,询问的时候二分跳着走就可以了 不过精度问题还有可能 ...

  4. AnimateWindow

    WINDOWS提供了一个很有意思的函数:AnimateWindow.之前我想实现像MSN,QQ这些收到邮件的时候动画方式,从地下升上来的显示一个窗口,感觉很麻烦,自己去写代码,效果很不理想,今天无意中 ...

  5. Boost线程库学习笔记

    一.创建一个线程 创建线程 boost::thread myThread(threadFun); 需要注意的是:参数可以是函数对象或者函数指针.并且这个函数无参数,并返回void类型. 当一个thre ...

  6. centos 6&period;2安装bind 9&period;8&period;2 master、slave与自动修改后更新

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://dl528888.blog.51cto.com/2382721/1249311 随 ...

  7. 把玩爬虫框架Gecco

    如果你现在接到一个任务,获取某某行业下的分类. 作为一个非该领域专家,没有深厚的运营经验功底,要提供一套摆的上台面且让人信服的行业分类,恐怕不那么简单. 找不到专家没有关系,我们可以爬虫.把那些专家的 ...

  8. BeautifulSoup库的使用方法

    from bs4 import BeautifulSoup import lxml html = ''' <html><head><title>The Dormou ...

  9. android开发 一个更优的listView的写法

    布局xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:androi ...

  10. 数值积分:基于牛顿-柯茨公式的定步长和自适应积分方法 &lbrack;MATLAB&rsqb;

    #先上代码后补笔记# #可以直接复制粘贴使用的MATLAB函数!# 1. 定步长牛顿-柯茨积分公式 function [ integration ] = CompoInt( func, left, r ...