# Path: sklearn/ensemble/forest.py
# class UnSupervisedRandomForestClassifier(ForestClassifier):
#     def __init__(self,
#                  n_estimators=10,
#                  criterion="unsupervised",
#                  max_depth=None,
#                  min_samples_split=2,
#                  min_samples_leaf=1,
#                  min_weight_fraction_leaf=0.,
#                  max_features="auto",
#                  max_leaf_nodes=None,
#                  bootstrap=True,
#                  oob_score=False,
#                  n_jobs=1,
#                  random_state=None,
#                  verbose=0,
#                  warm_start=False,
#                  class_weight=None):
#         super(UnSupervisedRandomForestClassifier, self).__init__(
#             base_estimator=UnSupervisedDecisionTreeClassifier(),
#             n_estimators=n_estimators,
#             estimator_params=("criterion", "max_depth", "min_samples_split",
#                               "min_samples_leaf", "min_weight_fraction_leaf",
#                               "max_features", "max_leaf_nodes",
#                               "random_state"),
#             bootstrap=bootstrap,
#             oob_score=oob_score,
#             n_jobs=n_jobs,
#             random_state=random_state,
#             verbose=verbose,
#             warm_start=warm_start,
#             class_weight=class_weight)
# 
#         self.criterion = criterion
#         self.max_depth = max_depth
#         self.min_samples_split = min_samples_split
#         self.min_samples_leaf = min_samples_leaf
#         self.min_weight_fraction_leaf = min_weight_fraction_leaf
#         self.max_features = max_features
#         self.max_leaf_nodes = max_leaf_nodes


import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import UnSupervisedRandomForestClassifier

def main():
    n_samples, n_features = 100, 2
    np.random.seed(42)
    
    yl = []
    Xl = []
    center = np.asarray([0,0])
    center_step = np.asarray([5,5])
    for i in range(10):
        cov = np.diagflat([1] * n_features)
        _X = np.random.multivariate_normal(center, cov, n_samples)
        _y = [i] * n_samples
        Xl.append(_X)
        yl.append(_y)
        center += center_step
        
    center = np.asarray([0,50])
    center_step = np.asarray([5,-5])
    for i in range(10):
        cov = np.diagflat([1] * n_features)
        _X = np.random.multivariate_normal(center, cov, n_samples)
        _y = [i] * n_samples
        Xl.append(_X)
        yl.append(_y)
        center += center_step        
        
    y = np.concatenate(yl)
    X = np.vstack(Xl)
    

# Path: sklearn/ensemble/forest.py
# class UnSupervisedRandomForestClassifier(ForestClassifier):
#     def __init__(self,
#                  n_estimators=10,
#                  criterion="unsupervised",
#                  max_depth=None,
#                  min_samples_split=2,
#                  min_samples_leaf=1,
#                  min_weight_fraction_leaf=0.,
#                  max_features="auto",
#                  max_leaf_nodes=None,
#                  bootstrap=True,
#                  oob_score=False,
#                  n_jobs=1,
#                  random_state=None,
#                  verbose=0,
#                  warm_start=False,
#                  class_weight=None):
#         super(UnSupervisedRandomForestClassifier, self).__init__(
#             base_estimator=UnSupervisedDecisionTreeClassifier(),
#             n_estimators=n_estimators,
#             estimator_params=("criterion", "max_depth", "min_samples_split",
#                               "min_samples_leaf", "min_weight_fraction_leaf",
#                               "max_features", "max_leaf_nodes",
#                               "random_state"),
#             bootstrap=bootstrap,
#             oob_score=oob_score,
#             n_jobs=n_jobs,
#             random_state=random_state,
#             verbose=verbose,
#             warm_start=warm_start,
#             class_weight=class_weight)
# 
#         self.criterion = criterion
#         self.max_depth = max_depth
#         self.min_samples_split = min_samples_split
#         self.min_samples_leaf = min_samples_leaf
#         self.min_weight_fraction_leaf = min_weight_fraction_leaf
#         self.max_features = max_features
#         self.max_leaf_nodes = max_leaf_nodes


# Path: sklearn/tree/_playground.py
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import UnSupervisedRandomForestClassifier


def main():
    n_samples, n_features = 100, 2
    np.random.seed(42)
    
    yl = []
    Xl = []
    center = np.asarray([0,0])
    center_step = np.asarray([5,5])
    for i in range(10):
        cov = np.diagflat([1] * n_features)
        _X = np.random.multivariate_normal(center, cov, n_samples)
        _y = [i] * n_samples
        Xl.append(_X)
        yl.append(_y)
        center += center_step
        
    center = np.asarray([0,50])
    center_step = np.asarray([5,-5])
    for i in range(10):
        cov = np.diagflat([1] * n_features)
        _X = np.random.multivariate_normal(center, cov, n_samples)
        _y = [i] * n_samples
        Xl.append(_X)
        yl.append(_y)
        center += center_step        
        
    y = np.concatenate(yl)
    X = np.vstack(Xl)
    

    uc = UnSupervisedRandomForestClassifier(n_estimators=1, max_depth=5, max_features=None, bootstrap=False) #, min_samples_leaf=60)