# Path: discomll/dataset.py
# class Data:
#     def __init__(self, data_tag, X_indices, **kwargs):
#     def generate_urls(self, first_url, last_url):
# 
# Path: discomll/clustering/kmeans.py
# def simple_init(interface, params):
# def map_init(interface, params):
# def random_init_map(interface, state, label, inp):
# def estimate_map(interface, state, label, inp):
# def estimate_reduce(interface, state, label, inp):
# def predict_map(interface, state, label, inp):
# def fit(dataset, n_clusters=5, max_iterations=10, random_state=None, save_results=True, show=False):
# def predict(dataset, fitmodel_url, 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.clustering import kmeans
from discomll.utils import model_view



# define training dataset
train = dataset.Data(data_tag=["test:breast_cancer_cont"],
                     data_type="chunk",  # define data source - chunk data on ddfs
                     X_indices=xrange(0, 9),  # define attribute indices
                     y_index=9,  # define class index
                     delimiter=",")

# define test dataset
test = dataset.Data(data_tag=["test:breast_cancer_cont_test"],
                    data_type="chunk",  # define data source - chunk data on ddfs
                    X_indices=xrange(0, 9),  # define attribute indices
                    y_index=9,  # define class index
                    delimiter=",")

# fit model on training dataset
fit_model = kmeans.fit(train, n_clusters=2, max_iterations=5, random_state=0)

# output model
model = model_view.output_model(fit_model)
print model

# predict test 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/clustering/kmeans.py
# def simple_init(interface, params):
# def map_init(interface, params):
# def random_init_map(interface, state, label, inp):
# def estimate_map(interface, state, label, inp):
# def estimate_reduce(interface, state, label, inp):
# def predict_map(interface, state, label, inp):
# def fit(dataset, n_clusters=5, max_iterations=10, random_state=None, save_results=True, show=False):
# def predict(dataset, fitmodel_url, 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/clustering/kmeans_ddfs.py
from disco.core import result_iterator
from discomll import dataset
from discomll.clustering import kmeans
from discomll.utils import model_view




# define training dataset
train = dataset.Data(data_tag=["test:breast_cancer_cont"],
                     data_type="chunk",  # define data source - chunk data on ddfs
                     X_indices=xrange(0, 9),  # define attribute indices
                     y_index=9,  # define class index
                     delimiter=",")

# define test dataset
test = dataset.Data(data_tag=["test:breast_cancer_cont_test"],
                    data_type="chunk",  # define data source - chunk data on ddfs
                    X_indices=xrange(0, 9),  # define attribute indices
                    y_index=9,  # define class index
                    delimiter=",")

# fit model on training dataset
fit_model = kmeans.fit(train, n_clusters=2, max_iterations=5, random_state=0)

# output model
model = model_view.output_model(fit_model)
print model

# predict test dataset

predictions = kmeans.predict(test, fit_model)