orange-modelmaps / examples / ensemble /

__author__ = '"Miha Stajdohar" <>'

import matplotlib

import os.path, sys
import numpy as np
import _modelmaps as mm
#import cPickle as pickle

from Orange import data, utils

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

def build_rd_map(DATASET):
    fname = os.path.join(utils.environ.dataset_install_dir, "%s%s" % (DATASET, ".tab"))

    if not (os.path.exists(fname) and os.path.isfile(fname)):
        fname = os.path.join(ROOT, "tab", "%s%s" % (DATASET, ".tab"))

        if not (os.path.exists(fname) and os.path.isfile(fname)):
            raise IOError("File %s not found." % fname)

    build_map = mm.BuildModelMap(fname)

    trees = 200
    depth = 1000

    print "build models..."
    models, models_2, rf_classifier, _ = build_map.build_rf_models(trees=trees, max_depth=depth)

    print "build model data..."
    table = build_map.build_model_data(models)
    table_2 = build_map.build_model_data(models_2)

    print "build matrix..."
    smx = build_map.build_model_matrix(models)
    smx_2 = build_map.build_model_matrix(models_2), "_ensemble_", "rf_%s_%d_depth_None_%s" % (DATASET, len(models), sys.platform)), smx, table,, "_ensemble_", "rf_%s_%d_depth_None_%s" % (DATASET, len(models_2), sys.platform)), smx_2, table_2,


DO = ["iris", "breast-cancer-wisconsin", "voting", "zoo", "mushroom", "adult_sample", "glass", "marketing", "primary-tumor", "vehicle", "wdbc", "dermatology"]
DO = ["marketing"]

for d in DO: