SlideShare a Scribd company logo
1 of 28
Download to read offline
Mahout


                2010/09/26       #TokyoWebmining 7
                             naoki yanai
                              @yanaoki




2010   9   26
LL       Ruby
                Mahout     Java/Hadoop



2010   9   26
yanaoki

                     Web          Ruby Java




                #TokyoWebmining




2010   9   26
2010   9   26
P(B) =     B
       P(B|A) =       A              B


                          P(A) > 0




2010   9   26
F1,...,Fn           C




                            C




                                c



2010   9   26
1.
                     (a)
                2.
                     (a)
                3.
                     (a)
                     (b)   1.   →2.   →3.
                     (c)
                4.
                     (a)


2010   9   26
2010   9   26
LL




                RSS




2010   9   26
LL


                Ruby




2010   9   26
1.
                     (a)
                2.
                     (a)
                3.
                     (a)
                     (b)   1.   →2.   →3.
                     (c)
                4.
                     (a)


2010   9   26
LL
           #
           c = NaiveBayes.new

           #                    ‘good’,‘bad’
           c.train('Nobody owns the water.','good')
           c.train('the quick rabbit jumps fences','good')
           c.train('buy pharmaceuticals now','bad')
           c.train('make quick money at the online casino','bad')
           c.train('the quick brown fox jumps','good')

           #
           c.classify("quick rabbit",default="unknown") #=> good
           c.classify("quick money",default="unknown") #=> bad

           #
           c.setthreshold('bad',3.0) # bad                           3
           c.classify("quick money",default="unknown") #=> unknown


2010   9   26
Mahout
                Java/Hadoop




                  Classifier
                  CF
                  Clustering
                  Pattern Mining

2010   9   26
Mahout

                 Mahout in Action

                 MEAP     PDF




2010   9   26
2010   9   26
2010   9   26
Mahout

                    Naive Bayes
                    Complementary Naive Bayes
                 Tackling the Poor Assumptions of Naive Bayes Text Classifiers
                    http://people.csail.mit.edu/jrennie/papers/icml03-nb.pdf

                                                                 Hadoop
                    Hadoop
                              Elastic MapReduce

                 Wikipedia 20NewsGroups Example
2010   9   26
1.
                     (a)
                2.
                     (a)
                3.
                     (a)
                     (b)   1.   →2.   →3.
                     (c)
                4.
                     (a)


2010   9   26
Mahout
                 1.

                      Wikipedia(en)                         xml.bz2)

                                                   xml→*.xml

                      64MB   396                 25GB



                $ java -Xmx2048m org.apache.mahout.classifier.bayes.WikipediaXmlSplitter 
                -d $WORK_DIR/enwiki-20100130-pages-articles.xml.bz2 
                -o $WORK_DIR/chunks/ 
                -c 64



2010   9   26
Mahout
                 1.
                                              S3(MapReduce        input




                                                Sports Game

                   Hadoop                   small,maste1/slave2
                $ elastic-mapreduce 
                --create 
                --name "wikipedia classifier" 
                --alive 
                --log-uri s3:/ /yanaokimrsample/classifier/wikipedia/logs 
                --num-instances 3 
                --instance-type m1.small 
                --availability-zone us-west-1a

2010   9   26
Mahout
                1.
                $ elastic-mapreduce -j j-24EIFIRXBO39M 
                --jar s3n://yanaokimrsample/jars/mahout-examples-0.3.job 
                --main-class org.apache.mahout.classifier.bayes.WikipediaDatasetCreatorDriver 
                --arg --input --arg s3n://yanaokimrsample/classifier/wikipedia/chunks 
                --arg --output --arg s3n://yanaokimrsample/classifier/wikipedia/input 
                --arg --categories --arg /home/hadoop/cat.txt 
                --step-name "wikipedia train dataset creator driver"



                                    Wikipedia


                                →                      →
                                                               ↓
                         <¥t>       <space>     <spache>   <spane>...

2010   9   26
Mahout
                1.
                $ elastic-mapreduce -j j-24EIFIRXBO39M 
                --jar s3n://yanaokimrsample/jars/mahout-examples-0.3.job 
                --main-class org.apache.mahout.classifier.bayes.WikipediaDatasetCreatorDriver 
                --arg --input --arg s3n://yanaokimrsample/classifier/wikipedia/chunks2 
                --arg --output --arg s3n://yanaokimrsample/classifier/wikipedia/input2 
                --arg --categories --arg /home/hadoop/cat.txt 
                --step-name "wikipedia test dataset creator driver"




2010   9   26
Mahout
                 2.
                                        N-gram         N-gram      alpha


                                                 Bayes/CBayes                   MapReduce

                $ elastic-mapreduce -j j-24EIFIRXBO39M 
                --jar s3n://yanaokimrsample/jars/mahout-core-0.3.job 
                --main-class org.apache.mahout.classifier.bayes.TrainClassifier 
                --arg --input --arg s3n://yanaokimrsample/classifier/wikipedia/input 
                --arg --output --arg s3n://yanaokimrsample/classifier/wikipedia/model 
                --arg --gramSize --arg 2 
                --arg --classifierType --arg bayes 
                --arg --alpha --arg 0.5 
                --arg --dataSource --arg hdfs 
                --step-name "train classifier"


2010   9   26
Mahout
                2.
                                            N-gram         alpha
                elastic-mapreduce -j j-24EIFIRXBO39M 
                --jar s3n://yanaokimrsample/jars/mahout-core-0.3.job 
                --main-class org.apache.mahout.classifier.bayes.TestClassifier 
                --arg --model --arg s3n:/ /yanaokimrsample/classifier/wikipedia/model 
                --arg --testDir --arg s3n://yanaokimrsample/classifier/wikipedia/input2 
                --arg --gramSize --arg 2 
                --arg --classifierType --arg bayes 
                --arg --alpha --arg 0.5 
                --arg --method --arg mapreduce 
                --arg --dataSource --arg hdfs 
                --arg --encoding --arg UTF-8 
                --step-name "test classifier"




2010   9   26
Mahout
                2.




                =======================================================
                Confusion Matrix
                -------------------------------------------------------
                a        b       <--Classified as
                464       2        | 466       a    = game
                159      169       | 328       b   = sports
                Default Category: unknown: 2




                 →sports


2010   9   26
Mahout
                2.



                     Classifier      Mahout



                                 HBase
                                             orz



2010   9   26
Hadoop




                Mahout

                              N-gram   alpha


                Mahout in Action

2010   9   26
2010   9   26

More Related Content

What's hot

Rendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRaimon Ràfols
 
[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R台灣資料科學年會
 
Data Manipulation Using R (& dplyr)
Data Manipulation Using R (& dplyr)Data Manipulation Using R (& dplyr)
Data Manipulation Using R (& dplyr)Ram Narasimhan
 
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServerText Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServerVitor Hirota Makiyama
 
C c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoC c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoKim Phillips
 
Modern c++ Memory Management
Modern c++ Memory ManagementModern c++ Memory Management
Modern c++ Memory ManagementAlan Uthoff
 
Parallel Computing in R
Parallel Computing in RParallel Computing in R
Parallel Computing in Rmickey24
 
DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220Mutsuyuki Tanaka
 
High performance GPU computing with Ruby RubyConf 2017
High performance GPU computing with Ruby  RubyConf 2017High performance GPU computing with Ruby  RubyConf 2017
High performance GPU computing with Ruby RubyConf 2017Prasun Anand
 
Data manipulation with dplyr
Data manipulation with dplyrData manipulation with dplyr
Data manipulation with dplyrRomain Francois
 
Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Kentoku
 

What's hot (16)

Hadoop I/O Analysis
Hadoop I/O AnalysisHadoop I/O Analysis
Hadoop I/O Analysis
 
Rendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendium
 
Metaprogramming
MetaprogrammingMetaprogramming
Metaprogramming
 
[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R
 
C++ ammar .s.q
C++  ammar .s.qC++  ammar .s.q
C++ ammar .s.q
 
Data Manipulation Using R (& dplyr)
Data Manipulation Using R (& dplyr)Data Manipulation Using R (& dplyr)
Data Manipulation Using R (& dplyr)
 
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServerText Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
 
C c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoC c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdo
 
Modern c++ Memory Management
Modern c++ Memory ManagementModern c++ Memory Management
Modern c++ Memory Management
 
Parallel Computing in R
Parallel Computing in RParallel Computing in R
Parallel Computing in R
 
Reactive x
Reactive xReactive x
Reactive x
 
Rsplit apply combine
Rsplit apply combineRsplit apply combine
Rsplit apply combine
 
DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220
 
High performance GPU computing with Ruby RubyConf 2017
High performance GPU computing with Ruby  RubyConf 2017High performance GPU computing with Ruby  RubyConf 2017
High performance GPU computing with Ruby RubyConf 2017
 
Data manipulation with dplyr
Data manipulation with dplyrData manipulation with dplyr
Data manipulation with dplyr
 
Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)
 

Viewers also liked

パターン認識 第10章 決定木
パターン認識 第10章 決定木 パターン認識 第10章 決定木
パターン認識 第10章 決定木 Miyoshi Yuya
 
今日から使える! みんなのクラスタリング超入門
今日から使える! みんなのクラスタリング超入門今日から使える! みんなのクラスタリング超入門
今日から使える! みんなのクラスタリング超入門toilet_lunch
 
バンディットアルゴリズム入門と実践
バンディットアルゴリズム入門と実践バンディットアルゴリズム入門と実践
バンディットアルゴリズム入門と実践智之 村上
 
トピックモデルを用いた 潜在ファッション嗜好の推定
トピックモデルを用いた 潜在ファッション嗜好の推定トピックモデルを用いた 潜在ファッション嗜好の推定
トピックモデルを用いた 潜在ファッション嗜好の推定Takashi Kaneda
 
SVMについて
SVMについてSVMについて
SVMについてmknh1122
 
機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレストTeppei Baba
 
Simple perceptron by TJO
Simple perceptron by TJOSimple perceptron by TJO
Simple perceptron by TJOTakashi J OZAKI
 
Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築
Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築
Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築Tatsuya Tojima
 
ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33horihorio
 
「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京
「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京
「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京Koichi Hamada
 
機械学習チュートリアル@Jubatus Casual Talks
機械学習チュートリアル@Jubatus Casual Talks機械学習チュートリアル@Jubatus Casual Talks
機械学習チュートリアル@Jubatus Casual TalksYuya Unno
 
機械学習によるデータ分析まわりのお話
機械学習によるデータ分析まわりのお話機械学習によるデータ分析まわりのお話
機械学習によるデータ分析まわりのお話Ryota Kamoshida
 
Pythonとdeep learningで手書き文字認識
Pythonとdeep learningで手書き文字認識Pythonとdeep learningで手書き文字認識
Pythonとdeep learningで手書き文字認識Ken Morishita
 
scikit-learnを用いた機械学習チュートリアル
scikit-learnを用いた機械学習チュートリアルscikit-learnを用いた機械学習チュートリアル
scikit-learnを用いた機械学習チュートリアル敦志 金谷
 
Rによるデータサイエンス13「樹木モデル」
Rによるデータサイエンス13「樹木モデル」Rによるデータサイエンス13「樹木モデル」
Rによるデータサイエンス13「樹木モデル」Takeshi Mikami
 
Pythonで機械学習入門以前
Pythonで機械学習入門以前Pythonで機械学習入門以前
Pythonで機械学習入門以前Kimikazu Kato
 
ルールベースから機械学習への道 公開用
ルールベースから機械学習への道 公開用ルールベースから機械学習への道 公開用
ルールベースから機械学習への道 公開用nishio
 
30分でわかる『R』によるデータ分析|データアーティスト
30分でわかる『R』によるデータ分析|データアーティスト30分でわかる『R』によるデータ分析|データアーティスト
30分でわかる『R』によるデータ分析|データアーティストSatoru Yamamoto
 

Viewers also liked (20)

決定木学習
決定木学習決定木学習
決定木学習
 
パターン認識 第10章 決定木
パターン認識 第10章 決定木 パターン認識 第10章 決定木
パターン認識 第10章 決定木
 
今日から使える! みんなのクラスタリング超入門
今日から使える! みんなのクラスタリング超入門今日から使える! みんなのクラスタリング超入門
今日から使える! みんなのクラスタリング超入門
 
バンディットアルゴリズム入門と実践
バンディットアルゴリズム入門と実践バンディットアルゴリズム入門と実践
バンディットアルゴリズム入門と実践
 
トピックモデルを用いた 潜在ファッション嗜好の推定
トピックモデルを用いた 潜在ファッション嗜好の推定トピックモデルを用いた 潜在ファッション嗜好の推定
トピックモデルを用いた 潜在ファッション嗜好の推定
 
SVMについて
SVMについてSVMについて
SVMについて
 
機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト
 
Simple perceptron by TJO
Simple perceptron by TJOSimple perceptron by TJO
Simple perceptron by TJO
 
Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築
Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築
Tokyo.R 41 サポートベクターマシンで眼鏡っ娘分類システム構築
 
ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33
 
一般向けのDeep Learning
一般向けのDeep Learning一般向けのDeep Learning
一般向けのDeep Learning
 
「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京
「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京
「はじめてでもわかる RandomForest 入門-集団学習による分類・予測 -」 -第7回データマイニング+WEB勉強会@東京
 
機械学習チュートリアル@Jubatus Casual Talks
機械学習チュートリアル@Jubatus Casual Talks機械学習チュートリアル@Jubatus Casual Talks
機械学習チュートリアル@Jubatus Casual Talks
 
機械学習によるデータ分析まわりのお話
機械学習によるデータ分析まわりのお話機械学習によるデータ分析まわりのお話
機械学習によるデータ分析まわりのお話
 
Pythonとdeep learningで手書き文字認識
Pythonとdeep learningで手書き文字認識Pythonとdeep learningで手書き文字認識
Pythonとdeep learningで手書き文字認識
 
scikit-learnを用いた機械学習チュートリアル
scikit-learnを用いた機械学習チュートリアルscikit-learnを用いた機械学習チュートリアル
scikit-learnを用いた機械学習チュートリアル
 
Rによるデータサイエンス13「樹木モデル」
Rによるデータサイエンス13「樹木モデル」Rによるデータサイエンス13「樹木モデル」
Rによるデータサイエンス13「樹木モデル」
 
Pythonで機械学習入門以前
Pythonで機械学習入門以前Pythonで機械学習入門以前
Pythonで機械学習入門以前
 
ルールベースから機械学習への道 公開用
ルールベースから機械学習への道 公開用ルールベースから機械学習への道 公開用
ルールベースから機械学習への道 公開用
 
30分でわかる『R』によるデータ分析|データアーティスト
30分でわかる『R』によるデータ分析|データアーティスト30分でわかる『R』によるデータ分析|データアーティスト
30分でわかる『R』によるデータ分析|データアーティスト
 

Similar to はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-

State of the art: Server-Side JavaScript (ParisJS)
State of the art: Server-Side JavaScript  (ParisJS)State of the art: Server-Side JavaScript  (ParisJS)
State of the art: Server-Side JavaScript (ParisJS)Alexandre Morgaut
 
State of the art - server side JavaScript - web-5 2012
State of the art - server side JavaScript - web-5 2012State of the art - server side JavaScript - web-5 2012
State of the art - server side JavaScript - web-5 2012Alexandre Morgaut
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 
A jar-nORM-ous Task
A jar-nORM-ous TaskA jar-nORM-ous Task
A jar-nORM-ous TaskErin Dees
 
Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?Bertrand Delacretaz
 
State of the art server side java script
State of the art server side java scriptState of the art server side java script
State of the art server side java scriptThibaud Arguillere
 
State of the art: Server-side JavaScript - MoscowJS
State of the art: Server-side JavaScript - MoscowJSState of the art: Server-side JavaScript - MoscowJS
State of the art: Server-side JavaScript - MoscowJSAlexandre Morgaut
 
Acunu & OCaml: Experience Report, CUFP
Acunu & OCaml: Experience Report, CUFPAcunu & OCaml: Experience Report, CUFP
Acunu & OCaml: Experience Report, CUFPAcunu
 
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala Love5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala LoveNatan Silnitsky
 
MongoUK - PHP Development
MongoUK - PHP DevelopmentMongoUK - PHP Development
MongoUK - PHP DevelopmentBoxed Ice
 
MongoUK - PHP Development
MongoUK - PHP DevelopmentMongoUK - PHP Development
MongoUK - PHP DevelopmentBoxed Ice
 
개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)
개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)
개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)Amazon Web Services Korea
 
Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...
Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...
Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...confluent
 
Performance Analysis and Optimizations for Kafka Streams Applications
Performance Analysis and Optimizations for Kafka Streams ApplicationsPerformance Analysis and Optimizations for Kafka Streams Applications
Performance Analysis and Optimizations for Kafka Streams ApplicationsGuozhang Wang
 
JSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notJSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notChengHui Weng
 
Jakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne Livestream
Jakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne LivestreamJakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne Livestream
Jakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne LivestreamJakarta_EE
 
Rails 3.1 Asset Pipeline
Rails 3.1 Asset PipelineRails 3.1 Asset Pipeline
Rails 3.1 Asset PipelineJames Daniels
 

Similar to はじめてでもわかるベイズ分類器 -基礎からMahout実装まで- (20)

Cassandra 3.x et la future 4.0
Cassandra 3.x et la future 4.0Cassandra 3.x et la future 4.0
Cassandra 3.x et la future 4.0
 
State of the art: Server-Side JavaScript (ParisJS)
State of the art: Server-Side JavaScript  (ParisJS)State of the art: Server-Side JavaScript  (ParisJS)
State of the art: Server-Side JavaScript (ParisJS)
 
State of the art - server side JavaScript - web-5 2012
State of the art - server side JavaScript - web-5 2012State of the art - server side JavaScript - web-5 2012
State of the art - server side JavaScript - web-5 2012
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
A jar-nORM-ous Task
A jar-nORM-ous TaskA jar-nORM-ous Task
A jar-nORM-ous Task
 
Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?
 
State of the art server side java script
State of the art server side java scriptState of the art server side java script
State of the art server side java script
 
State of the art: Server-side JavaScript - MoscowJS
State of the art: Server-side JavaScript - MoscowJSState of the art: Server-side JavaScript - MoscowJS
State of the art: Server-side JavaScript - MoscowJS
 
Cloudpack
CloudpackCloudpack
Cloudpack
 
Blogopolisの裏側
Blogopolisの裏側Blogopolisの裏側
Blogopolisの裏側
 
Acunu & OCaml: Experience Report, CUFP
Acunu & OCaml: Experience Report, CUFPAcunu & OCaml: Experience Report, CUFP
Acunu & OCaml: Experience Report, CUFP
 
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala Love5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
 
MongoUK - PHP Development
MongoUK - PHP DevelopmentMongoUK - PHP Development
MongoUK - PHP Development
 
MongoUK - PHP Development
MongoUK - PHP DevelopmentMongoUK - PHP Development
MongoUK - PHP Development
 
개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)
개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)
개발자가 알아두면 좋을 5가지 AWS 인공 지능 깨알 지식 - 윤석찬 (AWS 테크 에반젤리스트)
 
Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...
Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...
Performance Analysis and Optimizations for Kafka Streams Applications (Guozha...
 
Performance Analysis and Optimizations for Kafka Streams Applications
Performance Analysis and Optimizations for Kafka Streams ApplicationsPerformance Analysis and Optimizations for Kafka Streams Applications
Performance Analysis and Optimizations for Kafka Streams Applications
 
JSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notJSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why not
 
Jakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne Livestream
Jakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne LivestreamJakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne Livestream
Jakarta RESTful Web Services: Status Quo and Roadmap | JakartaOne Livestream
 
Rails 3.1 Asset Pipeline
Rails 3.1 Asset PipelineRails 3.1 Asset Pipeline
Rails 3.1 Asset Pipeline
 

はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-

  • 1. Mahout 2010/09/26 #TokyoWebmining 7 naoki yanai @yanaoki 2010 9 26
  • 2. LL Ruby Mahout Java/Hadoop 2010 9 26
  • 3. yanaoki Web Ruby Java #TokyoWebmining 2010 9 26
  • 4. 2010 9 26
  • 5. P(B) = B P(B|A) = A B P(A) > 0 2010 9 26
  • 6. F1,...,Fn C C c 2010 9 26
  • 7. 1. (a) 2. (a) 3. (a) (b) 1. →2. →3. (c) 4. (a) 2010 9 26
  • 8. 2010 9 26
  • 9. LL RSS 2010 9 26
  • 10. LL Ruby 2010 9 26
  • 11. 1. (a) 2. (a) 3. (a) (b) 1. →2. →3. (c) 4. (a) 2010 9 26
  • 12. LL # c = NaiveBayes.new # ‘good’,‘bad’ c.train('Nobody owns the water.','good') c.train('the quick rabbit jumps fences','good') c.train('buy pharmaceuticals now','bad') c.train('make quick money at the online casino','bad') c.train('the quick brown fox jumps','good') # c.classify("quick rabbit",default="unknown") #=> good c.classify("quick money",default="unknown") #=> bad # c.setthreshold('bad',3.0) # bad 3 c.classify("quick money",default="unknown") #=> unknown 2010 9 26
  • 13. Mahout Java/Hadoop Classifier CF Clustering Pattern Mining 2010 9 26
  • 14. Mahout Mahout in Action MEAP PDF 2010 9 26
  • 15. 2010 9 26
  • 16. 2010 9 26
  • 17. Mahout Naive Bayes Complementary Naive Bayes Tackling the Poor Assumptions of Naive Bayes Text Classifiers http://people.csail.mit.edu/jrennie/papers/icml03-nb.pdf Hadoop Hadoop Elastic MapReduce Wikipedia 20NewsGroups Example 2010 9 26
  • 18. 1. (a) 2. (a) 3. (a) (b) 1. →2. →3. (c) 4. (a) 2010 9 26
  • 19. Mahout 1. Wikipedia(en) xml.bz2) xml→*.xml 64MB 396 25GB $ java -Xmx2048m org.apache.mahout.classifier.bayes.WikipediaXmlSplitter -d $WORK_DIR/enwiki-20100130-pages-articles.xml.bz2 -o $WORK_DIR/chunks/ -c 64 2010 9 26
  • 20. Mahout 1. S3(MapReduce input Sports Game Hadoop small,maste1/slave2 $ elastic-mapreduce --create --name "wikipedia classifier" --alive --log-uri s3:/ /yanaokimrsample/classifier/wikipedia/logs --num-instances 3 --instance-type m1.small --availability-zone us-west-1a 2010 9 26
  • 21. Mahout 1. $ elastic-mapreduce -j j-24EIFIRXBO39M --jar s3n://yanaokimrsample/jars/mahout-examples-0.3.job --main-class org.apache.mahout.classifier.bayes.WikipediaDatasetCreatorDriver --arg --input --arg s3n://yanaokimrsample/classifier/wikipedia/chunks --arg --output --arg s3n://yanaokimrsample/classifier/wikipedia/input --arg --categories --arg /home/hadoop/cat.txt --step-name "wikipedia train dataset creator driver" Wikipedia → → ↓ <¥t> <space> <spache> <spane>... 2010 9 26
  • 22. Mahout 1. $ elastic-mapreduce -j j-24EIFIRXBO39M --jar s3n://yanaokimrsample/jars/mahout-examples-0.3.job --main-class org.apache.mahout.classifier.bayes.WikipediaDatasetCreatorDriver --arg --input --arg s3n://yanaokimrsample/classifier/wikipedia/chunks2 --arg --output --arg s3n://yanaokimrsample/classifier/wikipedia/input2 --arg --categories --arg /home/hadoop/cat.txt --step-name "wikipedia test dataset creator driver" 2010 9 26
  • 23. Mahout 2. N-gram N-gram alpha Bayes/CBayes MapReduce $ elastic-mapreduce -j j-24EIFIRXBO39M --jar s3n://yanaokimrsample/jars/mahout-core-0.3.job --main-class org.apache.mahout.classifier.bayes.TrainClassifier --arg --input --arg s3n://yanaokimrsample/classifier/wikipedia/input --arg --output --arg s3n://yanaokimrsample/classifier/wikipedia/model --arg --gramSize --arg 2 --arg --classifierType --arg bayes --arg --alpha --arg 0.5 --arg --dataSource --arg hdfs --step-name "train classifier" 2010 9 26
  • 24. Mahout 2. N-gram alpha elastic-mapreduce -j j-24EIFIRXBO39M --jar s3n://yanaokimrsample/jars/mahout-core-0.3.job --main-class org.apache.mahout.classifier.bayes.TestClassifier --arg --model --arg s3n:/ /yanaokimrsample/classifier/wikipedia/model --arg --testDir --arg s3n://yanaokimrsample/classifier/wikipedia/input2 --arg --gramSize --arg 2 --arg --classifierType --arg bayes --arg --alpha --arg 0.5 --arg --method --arg mapreduce --arg --dataSource --arg hdfs --arg --encoding --arg UTF-8 --step-name "test classifier" 2010 9 26
  • 25. Mahout 2. ======================================================= Confusion Matrix ------------------------------------------------------- a b <--Classified as 464 2 | 466 a = game 159 169 | 328 b = sports Default Category: unknown: 2 →sports 2010 9 26
  • 26. Mahout 2. Classifier Mahout HBase orz 2010 9 26
  • 27. Hadoop Mahout N-gram alpha Mahout in Action 2010 9 26
  • 28. 2010 9 26