Tech Tips

  1. プログラミング
  2. 96 view

Mahout をUbuntu12.04 LTSにインストールした時のメモ

mahout
コマンドのみ
sudo vim /etc/hadoop-0.20/conf/hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
hadoop jar /usr/lib/hadoop-0.20/hadoop-examples.jar pi 4 100

sudo apt-get install mahout
sudo apt-get install mecab
sudo apt-get install mecab-ipadic-utf8
mecab -b 184 -O wakati aozora/input.txt -o aozora/input.txt.wkt

$ less aozora/input.txt.wkt
$ hadoop fs -mkdir nb
$ hadoop fs -put aozora nb/

mahout seqdirectory --input nb/aozora --output nb/aozora_seq -c UTF-8

 hadoop fs -text nb/aozora_seq/chunk-0
/input.txt      学界というものをごく狭く理解して、研究室や研究所に直接関係がある世界のことだとすると、私は今日では全く学界の外の人である。

/input.txt.wkt  学界 という もの を ごく 狭く 理解 し て 、 研究 室 や 研究所 に 直接 関係 が ある 世界 の こと だ と する と 、 私 は 今日 で は 全く 学界 の 外 の 人 で ある 。

mahout seq2sparse \
--input nb/aozora_seq \
--output nb/aozora_vec

hadoop fs -ls nb/aozora_vec
Found 7 items
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:27 /user/hidetomo/nb/aozora_vec/df-count
-rw-r--r--   1 hidetomo supergroup        725 2014-03-16 16:26 /user/hidetomo/nb/aozora_vec/dictionary.file-0
-rw-r--r--   1 hidetomo supergroup        893 2014-03-16 16:27 /user/hidetomo/nb/aozora_vec/frequency.file-0
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:27 /user/hidetomo/nb/aozora_vec/tf-vectors
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:28 /user/hidetomo/nb/aozora_vec/tfidf-vectors
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:26 /user/hidetomo/nb/aozora_vec/tokenized-documents
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:26 /user/hidetomo/nb/aozora_vec/wordcount

mahout seqdumper -s nb/aozora_vec/dictionary.file-0
Key: あ: Value: 0
Key: い: Value: 1
Key: う: Value: 2
Key: が: Value: 3
Key: く: Value: 4
Key: こ: Value: 5
Key: ご: Value: 6
Key: し: Value: 7
Key: す: Value: 8
Key: だ: Value: 9
Key: て: Value: 10
Key: で: Value: 11
Key: と: Value: 12
Key: に: Value: 13
Key: の: Value: 14
Key: は: Value: 15
Key: も: Value: 16
Key: や: Value: 17
Key: る: Value: 18
Key: を: Value: 19
Key: 世: Value: 20
Key: 人: Value: 21
Key: 今: Value: 22
Key: 係: Value: 23
Key: 全: Value: 24
Key: 外: Value: 25
Key: 学: Value: 26
Key: 室: Value: 27
Key: 所: Value: 28
Key: 接: Value: 29
Key: 日: Value: 30
Key: 狭: Value: 31
Key: 理: Value: 32
Key: 界: Value: 33
Key: 直: Value: 34
Key: 研: Value: 35
Key: 私: Value: 36
Key: 究: Value: 37
Key: 解: Value: 38
Key: 関: Value: 39
Count: 40

mahout seqdumper -s nb/aozora_vec/frequency.file-0
Key: 0: Value: 2
Key: 1: Value: 2
Key: 2: Value: 2
Key: 3: Value: 2
Key: 4: Value: 2
Key: 5: Value: 2
Key: 6: Value: 2
Key: 7: Value: 2
Key: 8: Value: 2
Key: 9: Value: 2
Key: 10: Value: 2
Key: 11: Value: 2
Key: 12: Value: 2
Key: 13: Value: 2
Key: 14: Value: 2
Key: 15: Value: 2
Key: 16: Value: 2
Key: 17: Value: 2
Key: 18: Value: 2
Key: 19: Value: 2
Key: 20: Value: 2
Key: 21: Value: 2
Key: 22: Value: 2
Key: 23: Value: 2
Key: 24: Value: 2
Key: 25: Value: 2
Key: 26: Value: 2
Key: 27: Value: 2
Key: 28: Value: 2
Key: 29: Value: 2
Key: 30: Value: 2
Key: 31: Value: 2
Key: 32: Value: 2
Key: 33: Value: 2
Key: 34: Value: 2
Key: 35: Value: 2
Key: 36: Value: 2
Key: 37: Value: 2
Key: 38: Value: 2
Key: 39: Value: 2
Count: 40
Only Command
sudo vim /etc/hadoop-0.20/conf/hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
hadoop jar /usr/lib/hadoop-0.20/hadoop-examples.jar pi 4 100

sudo apt-get install mahout
sudo apt-get install mecab
sudo apt-get install mecab-ipadic-utf8
mecab -b 184 -O wakati aozora/input.txt -o aozora/input.txt.wkt

$ less aozora/input.txt.wkt
$ hadoop fs -mkdir nb
$ hadoop fs -put aozora nb/

mahout seqdirectory --input nb/aozora --output nb/aozora_seq -c UTF-8

 hadoop fs -text nb/aozora_seq/chunk-0
/input.txt      学界というものをごく狭く理解して、研究室や研究所に直接関係がある世界のことだとすると、私は今日では全く学界の外の人である。

/input.txt.wkt  学界 という もの を ごく 狭く 理解 し て 、 研究 室 や 研究所 に 直接 関係 が ある 世界 の こと だ と する と 、 私 は 今日 で は 全く 学界 の 外 の 人 で ある 。

mahout seq2sparse \
--input nb/aozora_seq \
--output nb/aozora_vec

hadoop fs -ls nb/aozora_vec
Found 7 items
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:27 /user/hidetomo/nb/aozora_vec/df-count
-rw-r--r--   1 hidetomo supergroup        725 2014-03-16 16:26 /user/hidetomo/nb/aozora_vec/dictionary.file-0
-rw-r--r--   1 hidetomo supergroup        893 2014-03-16 16:27 /user/hidetomo/nb/aozora_vec/frequency.file-0
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:27 /user/hidetomo/nb/aozora_vec/tf-vectors
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:28 /user/hidetomo/nb/aozora_vec/tfidf-vectors
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:26 /user/hidetomo/nb/aozora_vec/tokenized-documents
drwxr-xr-x   - hidetomo supergroup          0 2014-03-16 16:26 /user/hidetomo/nb/aozora_vec/wordcount

mahout seqdumper -s nb/aozora_vec/dictionary.file-0
Key: あ: Value: 0
Key: い: Value: 1
Key: う: Value: 2
Key: が: Value: 3
Key: く: Value: 4
Key: こ: Value: 5
Key: ご: Value: 6
Key: し: Value: 7
Key: す: Value: 8
Key: だ: Value: 9
Key: て: Value: 10
Key: で: Value: 11
Key: と: Value: 12
Key: に: Value: 13
Key: の: Value: 14
Key: は: Value: 15
Key: も: Value: 16
Key: や: Value: 17
Key: る: Value: 18
Key: を: Value: 19
Key: 世: Value: 20
Key: 人: Value: 21
Key: 今: Value: 22
Key: 係: Value: 23
Key: 全: Value: 24
Key: 外: Value: 25
Key: 学: Value: 26
Key: 室: Value: 27
Key: 所: Value: 28
Key: 接: Value: 29
Key: 日: Value: 30
Key: 狭: Value: 31
Key: 理: Value: 32
Key: 界: Value: 33
Key: 直: Value: 34
Key: 研: Value: 35
Key: 私: Value: 36
Key: 究: Value: 37
Key: 解: Value: 38
Key: 関: Value: 39
Count: 40

mahout seqdumper -s nb/aozora_vec/frequency.file-0
Key: 0: Value: 2
Key: 1: Value: 2
Key: 2: Value: 2
Key: 3: Value: 2
Key: 4: Value: 2
Key: 5: Value: 2
Key: 6: Value: 2
Key: 7: Value: 2
Key: 8: Value: 2
Key: 9: Value: 2
Key: 10: Value: 2
Key: 11: Value: 2
Key: 12: Value: 2
Key: 13: Value: 2
Key: 14: Value: 2
Key: 15: Value: 2
Key: 16: Value: 2
Key: 17: Value: 2
Key: 18: Value: 2
Key: 19: Value: 2
Key: 20: Value: 2
Key: 21: Value: 2
Key: 22: Value: 2
Key: 23: Value: 2
Key: 24: Value: 2
Key: 25: Value: 2
Key: 26: Value: 2
Key: 27: Value: 2
Key: 28: Value: 2
Key: 29: Value: 2
Key: 30: Value: 2
Key: 31: Value: 2
Key: 32: Value: 2
Key: 33: Value: 2
Key: 34: Value: 2
Key: 35: Value: 2
Key: 36: Value: 2
Key: 37: Value: 2
Key: 38: Value: 2
Key: 39: Value: 2
Count: 40

プログラミングの最近記事

  1. PlatformIO IDE for VSCode を使用して VSCode で Ardu…

  2. ROS Docker イメージで発生した GPG error の解消方法

  3. Streamlit で訪れた国を色づけした世界地図を作成できるアプリケーションを作成してみ…

  4. M5Stack Core2 for AWS – ESP32 IoT開発キットで…

  5. D3.js v7 で点・線・テキスト・ツールチップ・ズームを設定する方法

関連記事

PAGE TOP