def wrf_fit(input_dict): from discomll.ensemble import distributed_weighted_forest_rand random_state = None if input_dict["seed"] == "None" else int(input_dict["seed"]) fitmodel_url = distributed_weighted_forest_rand.fit(input_dict["dataset"], trees_per_chunk=input_dict["trees_per_subset"], max_tree_nodes=input_dict["tree_nodes"], num_medoids=input_dict["num_medoids"], min_samples_leaf=input_dict["min_samples_leaf"], min_samples_split=input_dict["min_samples_split"], class_majority=input_dict["majority"], measure=input_dict["measure"], accuracy=input_dict["accuracy"], separate_max=input_dict["separate_max"] == "true", random_state=random_state, save_results=True) return {"fitmodel_url": fitmodel_url}
def wrf_fit(input_dict): from discomll.ensemble import distributed_weighted_forest_rand random_state = None if input_dict["seed"] == "None" else int( input_dict["seed"]) fitmodel_url = distributed_weighted_forest_rand.fit( input_dict["dataset"], trees_per_chunk=input_dict["trees_per_subset"], max_tree_nodes=input_dict["tree_nodes"], num_medoids=input_dict["num_medoids"], min_samples_leaf=input_dict["min_samples_leaf"], min_samples_split=input_dict["min_samples_split"], class_majority=input_dict["majority"], measure=input_dict["measure"], accuracy=input_dict["accuracy"], separate_max=input_dict["separate_max"] == "true", random_state=random_state, save_results=True) return {"fitmodel_url": fitmodel_url}
from disco.core import result_iterator from discomll import dataset from discomll.ensemble import distributed_weighted_forest_rand from discomll.utils import accuracy train = dataset.Data(data_tag=[ ["http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data"]], id_index=0, X_indices=xrange(1, 10), X_meta="http://ropot.ijs.si/data/datasets_meta/breastcancer_meta.csv", y_index=10, delimiter=",") fit_model = distributed_weighted_forest_rand.fit(train, trees_per_chunk=3, max_tree_nodes=50, min_samples_leaf=5, min_samples_split=10, class_majority=1, measure="info_gain", num_medoids=10, accuracy=1, separate_max=True, random_state=None, save_results=True) # predict training dataset predictions = distributed_weighted_forest_rand.predict(train, fit_model) # output results for k, v in result_iterator(predictions): print k, v[0] # measure accuracy ca = accuracy.measure(train, predictions) print ca
test = dataset.Data(data_tag=[ "http://ropot.ijs.si/data/lymphography/test/xaaaaa.gz", "http://ropot.ijs.si/data/lymphography/test/xaaabj.gz" ], data_type="gzip", generate_urls=True, X_indices=range(2, 20), id_index=0, y_index=1, X_meta=[ "d", "d", "d", "d", "d", "d", "d", "d", "c", "c", "d", "d", "d", "d", "d", "d", "d", "c" ], delimiter=",") fit_model = distributed_weighted_forest_rand.fit(train, trees_per_chunk=3, max_tree_nodes=50, min_samples_leaf=10, min_samples_split=5, class_majority=1, measure="info_gain", num_medoids=10, accuracy=1, separate_max=True, random_state=None, save_results=True) predict_url = distributed_weighted_forest_rand.predict(test, fit_model) print predict_url