1. Miha Stajdohar
  2. orange-modelmaps

Source

orange-modelmaps / examples / projections / projections.py

import os.path
import orangecontrib.modelmaps as mm
from time import time
from Orange.orng import orngVizRank as vr

ROOT = "/home/miha/work/res/modelmaps"
#ROOT = "/Network/Servers/xgridcontroller.private/lab/mihas/modelmaps"
ROOT = "C:\\Users\\Miha\\work\\res\\modelmaps"
DATASET = "zoo"
N = 5000

build_map = mm.BuildModelMap(os.path.join(ROOT, "tab", "%s%s" % (DATASET, ".tab")))

nfeatures = len(build_map.data_d.domain.features)
features = mm.get_feature_subsets(build_map.data_d.domain, N)

max_nfeatures_scatterplot = (nfeatures ** 2 - nfeatures) / 2
features_scatterplot = mm.get_feature_subsets_scatterplot(build_map.data_d.domain, max_nfeatures_scatterplot)

models = []
models.extend([build_map.build_projection_model(f, vr.LINEAR_PROJECTION) for f in features])
models.extend([build_map.build_projection_model(f, vr.RADVIZ) for f in features])
models.extend([build_map.build_projection_model(f, vr.POLYVIZ) for f in features])
models.extend([build_map.build_projection_model(attrs, vr.SCATTERPLOT) for attrs in features_scatterplot])

table = build_map.build_model_data(models)
smx = build_map.build_model_matrix(models, mm.distance_prob)

build_map.save(os.path.join(ROOT, "_projections_", "projections_%s_%d_WIN" % (DATASET, N)), smx=smx, table=table)