Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Mahout Essentials

You're reading from   Apache Mahout Essentials Implement top-notch machine learning algorithms for classification, clustering, and recommendations with Apache Mahout

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781783554997
Length 164 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jayani Withanawasam Jayani Withanawasam
Author Profile Icon Jayani Withanawasam
Jayani Withanawasam
Arrow right icon
View More author details
Toc

A visualization example for K-Means clustering


In this example, we demonstrate the visualization of clusters in K-Means clustering. We use the same example as that given in Chapter 2, Clustering, K-Means clustering section (Clustering people based on height and weight).

Follow the given step-by-step guide to come up with a visualization for the previous example using D3.js:

  1. Download the D3.js JavaScript file from https://github.com/mbostock/d3/releases.

  2. You can directly use the web reference as well from http://d3js.org/d3.v3.min.js.

  3. Create a basic HTML file named kmeans.html using any text editor, as follows:

    Note

    Save kmeans.html in the same directory as the one in which d3.v3.min.js resides, or give the path accordingly if you are referencing D3.js as a local resource.

    <html>
      <head><meta charset="utf-8"></head>
      <body>
      </body>
    </html>
  4. Add D3.js as a reference in the HTML header, as shown here:

    <head>
      <meta charset="utf-8">
      <script...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime