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 directorybaumwelch: : Baum-Welch algorithm for unsupervised HMM trainingcanopy: : Canopy clusteringcat: : Print a file or resource as the logistic regression models would see itcleansvd: : Cleanup and verification of SVD outputclusterdump: : Dump cluster output to textclusterpp: : Groups Clustering Output In Clusterscmdump: : Dump confusion matrix in HTML or text formatsconcatmatrices: : Concatenates 2 matrices of same cardinality into a single matrixcvb: : 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 probesfkmeans: : Fuzzy K-means clusteringhmmpredict: : Generate random sequence of observations by given HMMitemsimilarity: : Compute the item-item-similarities for item-based collaborative filteringkmeans: : K-means clusteringlucene.vector: : Generate Vectors from a Lucene indexlucene2seq: : Generate Text SequenceFiles from a Lucene indexmatrixdump: : Dump matrix in CSV formatmatrixmult: : Take the product of two matricesparallelALS: : ALS-WR factorization of a rating matrixqualcluster: : Runs clustering experiments and summarizes results in a CSVrecommendfactorized: : Compute recommendations using the factorization of a rating matrixrecommenditembased: : Compute recommendations using item-based collaborative filteringregexconverter: : Convert text files on a per line basis based on regular expressionsresplit: : Splits a set of SequenceFiles into a number of equal splitsrowid: : Map SequenceFile<Text,VectorWritable> to {SequenceFile<IntWritable,VectorWritable>, SequenceFile<IntWritable,Text>}rowsimilarity: : Compute the pairwise similarities of the rows of a matrixrunAdaptiveLogistic: : Score new production data using a probably trained and validated AdaptivelogisticRegression modelrunlogistic: : Run a logistic regression model against CSV dataseq2encoded: : Encoded Sparse Vector generation from Text sequence filesseq2sparse: : Sparse Vector generation from Text sequence filesseqdirectory: : Generate sequence files (of Text) from a directoryseqdumper: : Generic Sequence File dumperseqmailarchives: : Creates SequenceFile from a directory containing gzipped mail archivesseqwiki: : Wikipedia xml dump to sequence filespectralkmeans: : Spectral k-means clusteringsplit: : Split Input data into test and train setssplitDataset: : split a rating dataset into training and probe partsssvd: : Stochastic SVDstreamingkmeans: : Streaming k-means clusteringsvd: : Lanczos Singular Value Decompositiontestnb: : Test the Vector-based Bayes classifiertrainAdaptiveLogistic: : Train an AdaptivelogisticRegression modeltrainlogistic: : Train a logistic regression using stochastic gradient descenttrainnb: : Train the Vector-based Bayes classifiertranspose: : Take the transpose of a matrixvalidateAdaptiveLogistic: : Validate an AdaptivelogisticRegression model against hold-out data setvecdist: : Compute the distances between a set of Vectors (or Cluster or Canopy, they must fit in memory) and a list of Vectorsvectordump: : Dump vectors from a sequence file to textviterbi: : 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. BIML 101 - ETL数据清洗 系列 - BIML 快速入门教程 - 序

    BIML 101 - BIML 快速入门教程 做大数据的项目,最花时间的就是数据清洗. 没有一个相对可靠的数据,数据分析就是无木之舟,无水之源. 如果你已经进了ETL这个坑,而且预算有限,并且有大量的 ...

  2. ​HealthKit开发快速入门教程大学霸内部教程

    ​HealthKit开发快速入门教程大学霸内部教程 ​ ​ 国内第一本HealthKit专向教程.本教程详细讲解iOS中,如何使用HealthKit框架开发健康应用.最后,本教程结合HealthKit ...

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

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

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

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

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

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

  6. Arduino Yun的主要部件介绍选自Arduino Yun快速入门教程

    Arduino Yun的主要部件介绍 1.4.1  主要部件 Yun的主要部件如图1.4所示. 图1.4  Arduino Yun的主要部件 在Yun小小的板子上集成了两颗处理器.一个是ATmega3 ...

  7. 认识AndEngine选自Android 2D游戏引擎AndEngine快速入门教程

    认识AndEngine什么是AndEngine 随着Android手机.平板的盛行,Android下的游戏也不断的变得火热.而对于游戏开发有兴趣的同学们,应该也想要学习开发游戏.虽说游戏开发的引擎较多 ...

  8. OUYA游戏开发快速入门教程1.2OUYA的硬件规格

    OUYA游戏开发快速入门教程1.2OUYA的硬件规格 从官网上购买回来的OUYA产品,包含游戏主机.游戏控制杆.说明书.电源线.HDMI线.电源线和电池,如图1-2所示.本节就来简要介绍下,游戏主机和 ...

  9. Android 2D游戏引擎AndEngine快速入门教程

    Android 2D游戏引擎AndEngine快速入门教程 介绍:AndEngine是一款知名的Android 2D游戏引擎.该引擎代码开源,并且可以免费使用.本书详细讲解如何使用AndEngine引 ...

最新文章

  1. emacs python环境配置
  2. Python程序员的“避坑”指南
  3. uva live 4394 String painter 间隔dp
  4. CF #737(div2)C. Moamen and XOR 与和异或-找规律
  5. JZOJ 3468. 【NOIP2013模拟联考7】OSU!(osu)
  6. 3种Java工厂模式深入理解分析
  7. 如何发布你的Android应用程序
  8. IOS 学习笔记 2015-03-24 OC-API-常用结构体
  9. 什么就像谈恋爱一样?
  10. 腾讯TBS加载网页无法自适应记录
  11. 栈溢出脚本_污点分析挖掘漏洞演示——如何在8小时内从零发现cve20120158(word溢出漏洞)...
  12. idea启动项目报错 : 编译失败:内部java编译器错误
  13. 为什么要分层?数据仓库分层架构深度讲解
  14. 用LeapFTP上传文件碰到的问题及解决办法
  15. java textfield 右对齐_TextField右对齐问题javafx
  16. 5个免费GitHub最强前端学习资源 程序员不花一分钱也能变很强
  17. docker版mongodb数据同步到elasticsearch
  18. 设计模式——代理模式(附代码示例)
  19. PHP做大转盘抽奖的思路,jQuery实现幸运大转盘(php抽奖程序)抽奖程序
  20. 隐藏滚动条css3实现滚动同时隐藏滚动条

热门文章

  1. 怎么理解 IaaS、SaaS 和 PaaS 的区别?
  2. 详解CSS三大特性之层叠性、继承性和重要性——Web前端系列学习笔记
  3. 手工搭建APACHE服务
  4. OpenStack的部署T版(九)——控制台部署
  5. 聚合链路出现Destination host unreachable
  6. java process exit_Java Process exitValue()方法
  7. html读取本地txt_利用MySQL/MariaDB的逻辑缺陷伪造恶意服务端读取客户端文件
  8. android倒角按钮,Android实现圆角Button按钮
  9. 在php中页面布局 3列左右侧固定中间自适应居中,css三列布局--两边固定中间自适应和中间固定两边自适应...
  10. mysql函数时分秒转换_mysql函数 秒转换成时分秒