下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1:下载地址我下载的是: mahout-0.3.tar.gz 17-Mar-2010 02:12 47M 2:解压tar -xvf mahout-0.3.tar.gz3:配置环境export HADOOP_HOME=/home/hadoopuser/hadoop-0.19.2 export HADOOP_CONF_DIR=/home/hadoopuser/hadoop-0.19.2/conf4:使用看看先bin/mahout -help会列出很多可以用的算法5:使用kme
2、ans聚类看看先bin/mahout kmeans -input /user/hive/warehouse/tmp_data/complex.seq -clusters 5 -output /home/hadoopuser/1.txt关于 kmeans需要的参数等等通过如下命令可以查看:bin/mahout kmeans -helpmahout下处理的文件必须是SequenceFile格式的,所以需要把txtfile转换成sequenceFile。SequenceFile是hadoop中的一个类,允许我们向文件中写入二进制的键
3、值对,具体介绍请看eyjian写的mahout中提供了一种将指定文件下的文件转换成sequenceFile的方式。(You may find Tika (/tika) helpful in converting binary documents to text.)使用方法如下:$MAHOUT_HOME/bin/mahout seqdirectory -input <PARENT DIR WHERE DOCS ARE LOCATED> -output <OUTPUT DIRECTORY> <-c <CHARSET
4、NAME OF THE INPUT DOCUMENTS> UTF-8|cp1252|ascii.> <-chunk <MAX SIZE OF EACH CHUNK in Megabytes> 64> <-prefix <PREFIX TO ADD TO THE DOCUMENT ID>>举个例子:bin/mahout seqdirectory -input /hive/hadoopuser/ -output /mahout/seq/ -charset UTF-8运行kmeans的简单的例子:1:将样本数据集放到hdfs中指定文件下,应
5、该在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_VERSI
6、ON.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.Job3:使用canopy算法$HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.ap
7、ache.mahout.clustering.syntheticcontrol.canopy.Job例如:bin/hadoop jar /home/hadoopuser/mahout-0.3/mahout-examples-0.1.job org.apache.mahout.clustering.syntheticcontrol.canopy.Job4:使用dirichlet 算法$HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.apache.maho
8、ut.clustering.syntheticcontrol.dirichlet.Job5:使用meanshift算法meanshift : $HADOOP_HOME/bin/hadoop jar $MAHOUT_HOME/examples/target/mahout-examples-$MAHOUT_VERSION.job org.apache.mahout.clustering.syntheticcontrol.meanshift.Job6:查看一下结果吧bin/mahout vectordump -seqFile /user/hadoopuser/output/data/part-000
9、00这个直接把结果显示在控制台上。Get the data out of HDFS and have a look All example jobs use testdata as input and output to directory outputUse bin/hadoop fs -lsr output to view all outputsOutput:KMeans is placed into output/pointsCanopy and MeanShift results are placed into output/clustered-points英文参
10、考链接:/MAHOUT/syntheticcontroldata.htmlTriJUG: Intro to Mahout Slides and Demo examplesFirst off, big thank you to TriJUG and all the attendees for allowing me to present Apache Mahout last night. Also a big thank you to Red Hat for providing a most excellent meeting s
11、pace. Finally, to Manning Publications for providing vouchers for Taming Text and Mahout In Action for the end of the night raffle. Overall, I think it went well, but thats not for me to judge. There were a lot of good questions and a good sized audience.The slides f
12、or the Monday, Feb. 15 TriJUG talk are at: Intro to Mahout Slides(Intro Mahout (PDF).For the “ugly demos”, below is a history of the commands I ran for setup, etc. Keep in mind that you can almost always run bin/mahout <COMMAND> help to get syntax help for any given command.Heres th
13、e preliminary setup stuff I did:1. Get and preprocess the Reuters content per2. Create the sequence files: bin/mahout seqdirectory input <PATH>/content/reuters/reuters-out output <PATH>/content/reuters/seqfiles charset UTF-83. Convert the Sequence Files to Sparse Vectors, using the Eucli
14、dean norm and the TF weight (for LDA): bin/mahout seq2sparse input <PATH>/content/reuters/seqfiles output <PATH>/content/reuters/seqfiles-TF norm 2 weight TF4. Convert the Sequence Files to Sparse Vectors, using the Euclidean norm and the TF-IDF weight (for Clustering): bin/mahout seq2sp
15、arse input<PATH>/content/reuters/seqfiles output <PATH>/content/reuters/seqfiles-TF-IDF norm 2 weight TFIDFFor Latent Dirichlet Allocation I then ran:1. ./mahout lda input <PATH>/content/reuters/seqfiles-TF/vectors/ output <PATH>/content/reuters/seqfiles
16、-TF/lda-output numWords 34000 numTopics 202. ./mahout org.apache.mahout.clustering.lda.LDAPrintTopics input <PATH>/content/reuters/seqfiles-TF/lda-output/state-19 dict <PATH>/content/reuters/seqfiles-TF/dictionary.file-0 words 10 output <PATH>/content/reuters/seqfiles-TF/lda-output
17、/topics dictionaryType sequencefileFor K-Means Clustering I ran:1. ./mahout kmeans input <PATH>/content/reuters/seqfiles-TFIDF/vectors/part-00000 k 15 output <PATH>/content/reuters/seqfiles-TFIDF/output-kmeans clusters <PATH>/content/reuters/seqfiles-TFIDF/output-kmeans/clusters2.
18、Print out the clusters: ./mahout clusterdump seqFileDir /Volumes/Content/grantingersoll/content/reuters/seqfiles-TFIDF/output-kmeans/clusters-15/ pointsDir /Volumes/Content/grantingersoll/content/reuters/seqfiles-TFIDF/output-kmeans/points/ dictionary /Volumes/Content/grantingersoll/content/reuters/seqfiles-TFIDF/dictionary.file-0 dic
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 山东省青岛市第二十一中学2027届九年级物理第一学期期末质量检测模拟试题含解析
- 2027届浙江省仙居县化学九上期中检测模拟试题含解析
- 2026中国物业管理行业竞争分析当前市场格局投资评估规划研究报告
- 2026中国有机农产品种植行业现状供需问题研究投资发展前景规划报告
- 2026中国触控芯片车载显示大屏化趋势与抗干扰技术要求
- 2027届江苏省无锡市东林中学化学九上期末学业水平测试模拟试题含解析
- 湖南省长沙市雅实、北雅、长雅三校2027届化学九年级第一学期期中达标检测试题含解析
- 2026中国健身俱乐部防护设备采购偏好与决策因素报告
- 2026新疆和田都玉客运有限责任公司面向社会招聘工作人员2人考前冲刺密卷带答案详解(培优B卷)
- 2026浙江衢州市第三医院招聘第四批编外人员2人笔试题库含答案详解【满分必刷】
- 住院期间病人发热处置流程发热患者应急预案
- 人工智能算力平台服务管理规范
- 2026广东江门市台山博达企业管理有限公司招聘8人笔试备考试题及答案详解
- 2026人教版三年级上册数学暑假预习每日一练(30天)
- 2026年甘肃省中小学教师招聘考试试卷含答案
- 人形机器人与具身智能标准体系2026版标准化组织运作模式解读
- T∕AOPA 0085-2025 T∕CMSA 0057-2025 低空飞行管理运行平台气象信息服务指南
- 2026年4月自考08680欧洲文化入门试题试题及答案
- (2026年)如何早期识别儿童危重症
- 雨课堂学堂在线学堂云《人工智能与创新(南开)》单元测试考核答案
- 2026上半年四川成都职业技术学院编制外(考试)招聘30人笔试参考试题及答案解析
评论
0/150
提交评论