Clustering data from classes

If you have a dataset with classes, which is an unusual case for unsupervised learning, Weka has a method called clustering from classes. In this method, Weka first ignores the class attribute and generates the clustering. Then during the test phase, it assigns classes to the clusters based on the majority value of the class attribute within each cluster. We will cover this method in this recipe.

How to do it...

  1. In this recipe, we will use a dataset with class values for instances. We will use a weather.nominal.arff file, which can be found in the data directory of the installed Weka directory.

    In our code, we will have two instance variables. The first variable will contain the instances of our dataset and the second ...

Get Java Data Science Cookbook 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.