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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.