머하웃 실행시키기
몇 가지 옵션이 있다. 하둡 없이 단독으로 머하웃을 실행시키거나, 하둡과 함께 맵리듀스 작업으로 머하웃을 실행시키거나, 머하웃은 0.7 버전이 필요하므로 http://archive.apache.org/dist/mahout/0.7/에서 다운로드해 설치할 수 있다.
단독으로 머하웃 실행시키기
원시 데이터 파일이 있는 디렉터리에서 다음과 같은 명령어를 실행한다(/your/path/to/에는 실습하는 컴퓨터에서 머하웃이 설치된 폴더를 적는다. 여기서는 머하웃을 C:\mahout에 설치했다고 가정한다).
/your/path/to/mahout/bin/mahout fpg -i output.dat -o patterns -k 10 -s 2
명령줄 옵션을 살펴보자.
• fpg: FPG(Frequent Pattern Growth) 알고리즘
• -i: 입력 파일
• -k: 찾고자 하는 연관 아이템의 최대 개수로 위의 명령줄 예에서는 연관 아이템 10개를 지정한 것이다.
• -s: 위의 명령줄 예에서는 작업하는 거래 중 두 건 이상에 나타난 아이템을 지정한 것이다.
컴퓨터의 성능에 따라 다르지만, 화면에 뭔가 나오기까지는 몇 초 정도 걸린다. 아무 일도 일어나지 않아도 조금 더 기다려보라.
결과는 다음과 같다.
14/04/29 20:15:15 INFO fpgrowth.FPGrowth: Found 3 Patterns with Least Support 149 14/04/29 20:15:15 INFO fpgrowth.FPGrowth: Mining FTree Tree for all patterns with 1 14/04/29 20:15:15 INFO fpgrowth.FPGrowth: Found 5 Patterns with Least Support 162 14/04/29 20:15:15 INFO fpgrowth.FPGrowth: Mining FTree Tree for all patterns with 0 14/04/29 20:15:15 INFO fpgrowth.FPGrowth: Found 4 Patterns with Least Support 167 14/04/29 20:15:15 INFO fpgrowth.FPGrowth: Tree Cache: First Level: Cache hits=1180 Cache Misses=21972