Source

orange-modelmaps / archive / clusterModels.py

Full commit
import os.path
import pickle

from tools import *
from matrix2network import *


def clusterModel(fn, knn, ratio=0.0):
    print "CLUSTERING:", os.path.split(fn)[1]
    smx = loadModel(fn)
    net = matrix2network(smx, ratio, knn)
    net.items = smx.items
    msmx = cluster2matrix2(net, smx)
    saveModel(msmx, "%s-clustered" % fn)

#clusterModel(ROOT + "dst/breast-knn-510"    , 2)
#clusterModel(ROOT + "dst/breast-tree-500"   , 1)
#clusterModel(ROOT + "dst/breast-bayes-510"  , 2)
#clusterModel(ROOT + "dst/breast-svms-510"   , 4)
#clusterModel(ROOT + "dst/breast-polyviz-501", 2)
#clusterModel(ROOT + "dst/breast-radviz-501" , 2)

#clusterModel(ROOT + "dst/breast-linproj-501", 2)
clusterModel(ROOT + "dst/zoo-rf-1000"    , 1)