# Path: discomll/dataset.py
# class Data:
#     def __init__(self, data_tag, X_indices, **kwargs):
#     def generate_urls(self, first_url, last_url):
# 
# Path: discomll/ensemble/forest_distributed_decision_trees.py
# def simple_init(interface, params):
# def map_init(interface, params):
# def map_fit(interface, state, label, inp):
# def map_fit_bootstrap(interface, state, label, inp):
# def reduce_fit(interface, state, label, inp):
# def map_predict_voting(interface, state, label, inp):
# def map_predict_dist(interface, state, label, inp):
# def fit(dataset, trees_per_chunk=1, bootstrap=True, max_tree_nodes=50, min_samples_leaf=10, min_samples_split=5,
#         class_majority=1, separate_max=True, measure="info_gain", accuracy=1, random_state=None, save_results=True,
#         show=False):
# def predict(dataset, fitmodel_url, voting=False, save_results=True, show=False):
# 
# Path: discomll/utils/model_view.py
# def output_model(fitmodel_url):
# def _rf_model(fitmodel):
# def _dt_model(fitmodel):
# def _kmeans_model(fitmodel):
# def _linsvm_model(fitmodel):
# def _logreg_model(fitmodel):
# def _linreg_model(fitmodel):
# def _naivebayes_model(fitmodel):
# def _tree_view(tree, feature_names=[]):


from disco.core import result_iterator
from discomll import dataset
from discomll.ensemble import forest_distributed_decision_trees
from discomll.utils import model_view


train = dataset.Data(data_tag=[["http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"]],
                     X_indices=xrange(0, 4),
                     X_meta="http://ropot.ijs.si/data/datasets_meta/iris_meta.csv",
                     y_index=4,
                     delimiter=",")

fit_model = forest_distributed_decision_trees.fit(train, trees_per_chunk=1, bootstrap=False, max_tree_nodes=50,
                                                  min_samples_leaf=2, min_samples_split=1, class_majority=1,
                                                  separate_max=True, measure="info_gain", accuracy=1, random_state=None,
                                                  save_results=True)

print model_view.output_model(fit_model)

# predict training dataset

# Path: discomll/dataset.py
# class Data:
#     def __init__(self, data_tag, X_indices, **kwargs):
#     def generate_urls(self, first_url, last_url):
# 
# Path: discomll/ensemble/forest_distributed_decision_trees.py
# def simple_init(interface, params):
# def map_init(interface, params):
# def map_fit(interface, state, label, inp):
# def map_fit_bootstrap(interface, state, label, inp):
# def reduce_fit(interface, state, label, inp):
# def map_predict_voting(interface, state, label, inp):
# def map_predict_dist(interface, state, label, inp):
# def fit(dataset, trees_per_chunk=1, bootstrap=True, max_tree_nodes=50, min_samples_leaf=10, min_samples_split=5,
#         class_majority=1, separate_max=True, measure="info_gain", accuracy=1, random_state=None, save_results=True,
#         show=False):
# def predict(dataset, fitmodel_url, voting=False, save_results=True, show=False):
# 
# Path: discomll/utils/model_view.py
# def output_model(fitmodel_url):
# def _rf_model(fitmodel):
# def _dt_model(fitmodel):
# def _kmeans_model(fitmodel):
# def _linsvm_model(fitmodel):
# def _logreg_model(fitmodel):
# def _linreg_model(fitmodel):
# def _naivebayes_model(fitmodel):
# def _tree_view(tree, feature_names=[]):


# Path: discomll/examples/ensemble/fddt_breastcancer_url.py
from disco.core import result_iterator
from discomll import dataset
from discomll.ensemble import forest_distributed_decision_trees
from discomll.utils import model_view



train = dataset.Data(data_tag=[["http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"]],
                     X_indices=xrange(0, 4),
                     X_meta="http://ropot.ijs.si/data/datasets_meta/iris_meta.csv",
                     y_index=4,
                     delimiter=",")

fit_model = forest_distributed_decision_trees.fit(train, trees_per_chunk=1, bootstrap=False, max_tree_nodes=50,
                                                  min_samples_leaf=2, min_samples_split=1, class_majority=1,
                                                  separate_max=True, measure="info_gain", accuracy=1, random_state=None,
                                                  save_results=True)

print model_view.output_model(fit_model)

# predict training dataset

predictions = forest_distributed_decision_trees.predict(train, fit_model)