2.20 Data clustering

There are several examples related to cluster algorithms in the directory macros/examples. The corresponding Jython macros start with ''clustering*''. The data clustering is based the JMinHEP package java library [15] and includes:

In short, first one should create a data container DataHolder to keep a multidimensional data. (Remember, P1D can only data for two dimensions, in X and Y). One can display this container and export to a table as:

>>> from jminhep.cluster import DataHolder,Partition
>>> from  jhplot HPlot,P1D 
>>>
>>> data = DataHolder("Example")  # create a container
>>> ....                          # fill this container using add method
>>> HTable(data)                  # look at this container in a table
>>> c1=HPlot()                    # create a canvas to display the data
>>> p1=P1D(data,0,1)              # export to P1D to display 1st and 2nd column
>>> c1.draw(p1)                   # draw it  in a canvas
>>> c1.visible(1)
>>> #### now do some clustering ###
>>> pat = Partition(data)         # fill  partitioner
>>> pat.set(3, 0.001, 1.7, 1000)  # initialize the clustering
>>>                               # (reconstruct 3 clusters etc..)
>>> pat.run(131)                  # run the clustering algorithm (Fuzzy)
Read the JMinHEP API [15] for more information and run examples in macros/examples directory