Run Examples

Hama Examples package allows you to quickly run examples on your Hama Cluster.
This document describes how to quickly run examples, assume that you have already installed Hama cluster and you have tested it.

Run PageRank example

1. First, you need to generate a symmetric adjacency matrix using the 'gen' command:

    % $HAMA_HOME/bin/hama jar hama-examples-x.x.x.jar gen fastgen -v 100 -e 10 -o randomgraph -t 2

This will create a graph with 100 nodes and 1K edges and store 2 partitions on HDFS as the sequence file. You can adjust partition and tasks numbers to fit your cluster. Then, run PageRank using:

  % $HAMA_HOME/bin/hama jar hama-examples-x.x.x.jar pagerank -i randomgraph -o pagerankresult -t 4

Run K-Means example

Download a Iris dataset [Dataset Information]. And then, run K-Means using:
  % $HAMA_HOME/bin/hama jar hama-examples-x.x.x.jar kmeans /tmp/kmeans.txt /tmp/result 10 3
  [5.1, 3.5, 1.4, 0.2] belongs to cluster 2
  [4.9, 3.0, 1.4, 0.2] belongs to cluster 2
  [4.7, 3.2, 1.3, 0.2] belongs to cluster 2
  [4.6, 3.1, 1.5, 0.2] belongs to cluster 2