Book Image

Learning Apache Mahout

Book Image

Learning Apache Mahout

Overview of this book

Table of Contents (17 chapters)
Learning Apache Mahout
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Introduction to Mahout
9
Case Study – Churn Analytics and Customer Segmentation
Index

A Mahout command-line example


Now, we will discuss how to cluster objects using the Mahout command line. We start with getting the data first.

Getting the data

We will use the seed dataset from our favorite UCI repository for clustering examples. The dataset is available at https://archive.ics.uci.edu/ml/datasets/seeds.

To download the data, we can execute the following command:

wget https://archive.ics.uci.edu/ml/machine-learning-databases/00236/seeds_dataset.txt

We also have the data downloaded in data/chapter7 in our code base.

Data description

The seed dataset consists of 8 attributes as follows:

Column

Data type

Area (A)

Continuous

Perimeter (P)

Continuous

Compactness (C = 4*pi*A/P^2)

Continuous

Length of kernel

Continuous

Width of kernel

Continuous

Asymmetry coefficient

Continuous

Length of kernel groove

Continuous

Type of seed

Categorical

We can use all the columns for our clustering example or keep Type of seed as an external evaluation metric.

Sample data

15.26 14...