Visualizing instances using the Instance Viewer (SPMF documentation)

This example explains how to run the Instance Viewer of the SPMF open-source data mining library.

How to run this example?

What is the Instance Viewer?

The Instance Viewer is a tool offered in SPMF for visualizing a set of instances used as input for clustering algorithms. The Instance Viewer provides some basic functions like zooming in, zooming out, printing, and saving the picture as an image. It is useful for visualizing the instances that will be given to a clustering algorithm as input. Visualizing instances can help to decide which algorithm should then be applied.

What is the input of the Instance Viewer?

The input is a file containing several instances. The input file format is defined as follows.

The first lines (optional) specify the name of the attributes used for describing the instances. In this example, two attributes will be used, named X and Y. But note that more than two attributes could be used. Each attribute is specified on a separated line by the keyword "@ATTRIBUTEDEF=", followed by the attribute name

Then, each instance is described by two lines. The first line (which is optional) contains the string "@NAME=" followed by the name of the instance. Then, the second line provides a list of double values separated by single spaces.

An example of input is provided in the file "inputDBScan2.txt" of the SPMF distribution. It contains 31 instances, each described by two attribute called X and Y.

1 1
0 1
1 0
11 12
11 13
13 13
12 8.5
13 8
13 9
13 7
11 7
8 2
9 2
10 1
7 13
5 9
16 16
11.5 8
13 10
12 13
14 12.5
14.5 11.5
15 10.5
15 9.5
12 9.5
10.5 11
10 10.5
9 3
9 4
9 5

For example, the first instance is named "Instance1", and it is a vector with two values: 1 and 1 for the attributes X and Y, respectively.

What is the result of running theinstance viewer?

Running the Instance Viewer will display the instances visually. For example, for the above instances, the instances will be displayed as follows (note that this may vary depending on your version of SPMF).


Implementation details

The Instance Viewer has been implemented by reusing and extending some code provided by Yuriy Guskov under the MIT License for displaying charts.