Search code examples
data-miningorange

Outputting text data from Orange's clustering algorithm


I am interested in using Orange's cluster data mining algorithms to query an inputted data table. I am some what confused though on how to display the relevant textual results from the clustering data query.

From one of the examples in the documentation:

import Orange

import random
random.seed(42)

def callback(km):
    print "Iteration: %d, changes: %d, score: %.4f" % (km.iteration,
                                                       km.nchanges,
                                                       km.score)

iris = Orange.data.Table("iris")
km = Orange.clustering.kmeans.Clustering(iris,
                                         3,
                                         minscorechange=0,
                                         inner_callback=callback)

Advice on this is greatly appreciated.


Solution

  • As advised by Anony Mousse.

    import Orange
    
    import random
    random.seed(42)
    
    def callback(km):
        #print(km.data[-10:])
        pass
    
    iris = Orange.data.Table("iris")
    km = Orange.clustering.kmeans.Clustering(iris,
                                             3,
                                             minscorechange=0,
                                             inner_callback=callback)
    
    print(km.data[-10:])