Book Image

Rapid - Apache Mahout Clustering designs

Book Image

Rapid - Apache Mahout Clustering designs

Overview of this book

Table of Contents (16 chapters)
Apache Mahout Clustering Designs
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Mahout for streaming K-means


After understanding the algorithm side, let's see how we can use the Mahout implementation of Streaming K-means.

Dataset selection

To run the Streaming K-means, we will first select a dataset. The reference paper Fast and Accurate K-Means for Large Datasets, by M.Schindler, A.Wong, and A.Meyerson mentioned two datasets that they used—BigCross and Census1990.

Here, we will use the Census1990 dataset. This dataset can be downloaded from https://archive.ics.uci.edu/ml/machine-learning-databases/census1990-mld/.

This dataset has 2458285 number of instances and 68 number of attributes. Once you have download this data, you will notice that it is in the CSV format, and we cannot use this directly in Mahout.

Converting CSV to a vector file

You can use the following mentioned code to convert your CSV file to a Mahout readable vector.

This code is almost the same as that mentioned in Chapter 2, Understanding K-means Clustering:

public String getSeqFile(String inputLocation...