How to do it...

Perform the following steps to perform model-based clustering:

  1. First, please install and load the mclust library:
        > install.packages("mclust")
        > library(mclust)  
  1. You can then perform model-based clustering on the customer dataset:
        > mb = Mclust(customer)
        > plot(mb)
  1. Then, you can press the 1 key to obtain the BIC against a number of components:
Plot of BIC against a number of components
  1. Then, you can press the 2 key to show the classification with regard to different combinations of features:
Plot showing classification ...

Get Machine Learning with R Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.