# Path: DSTK/utils/sampling_helpers.py
# def get_minority_majority_keys(sample_size_dict):
# def upsample_minority_class(data, labels, random_seed=None):
# def downsample_majority_class(data, labels, random_seed=None):
# def random_sample(data, label, sample_fraction, random_seed=None):
# def create_bags(data, label, sample_fraction, num_bags, bagging_fraction, random_seed=None):
# def permute_column_of_numpy_array(array, col_idx, random_seed=None):


import pandas as pd
import numpy as np
import sys
import time
import abc
from DSTK.utils import sampling_helpers as sh
from sklearn.metrics import precision_score, accuracy_score, recall_score, roc_auc_score
    def _init_boselector_df(self, data, labels):
        self.attributes = data.columns
        self.coeff_df = pd.DataFrame()

        self.initialized = True

        return data.as_matrix(), labels.values

    def fit(self, data, labels, epochs=10, verbose=1):
        """
        Fits the boosted selector

        :param data: Pandas DataFrame containing all the data
        :param labels: Pandas Series with the labels
        :param epochs: Number of fitting iterations. Defaults to 10.
        :param verbose: print progress bar
        :return: None
        """

        if not self.initialized:
            data, labels = self._init_boselector_df(data, labels)
        else:
            if isinstance(data, pd.core.frame.DataFrame):
                data = data.as_matrix()
            if isinstance(labels, pd.core.series.Series):
                labels = labels.values

        start = time.time()
        for m in range(epochs):


# Path: DSTK/utils/sampling_helpers.py
# def get_minority_majority_keys(sample_size_dict):
# def upsample_minority_class(data, labels, random_seed=None):
# def downsample_majority_class(data, labels, random_seed=None):
# def random_sample(data, label, sample_fraction, random_seed=None):
# def create_bags(data, label, sample_fraction, num_bags, bagging_fraction, random_seed=None):
# def permute_column_of_numpy_array(array, col_idx, random_seed=None):


# Path: DSTK/BoostedFeatureSelectors/base_selector.py
import pandas as pd
import numpy as np
import sys
import time
import abc
from DSTK.utils import sampling_helpers as sh
from sklearn.metrics import precision_score, accuracy_score, recall_score, roc_auc_score

    def _init_boselector_df(self, data, labels):
        self.attributes = data.columns
        self.coeff_df = pd.DataFrame()

        self.initialized = True

        return data.as_matrix(), labels.values

    def fit(self, data, labels, epochs=10, verbose=1):
        """
        Fits the boosted selector

        :param data: Pandas DataFrame containing all the data
        :param labels: Pandas Series with the labels
        :param epochs: Number of fitting iterations. Defaults to 10.
        :param verbose: print progress bar
        :return: None
        """

        if not self.initialized:
            data, labels = self._init_boselector_df(data, labels)
        else:
            if isinstance(data, pd.core.frame.DataFrame):
                data = data.as_matrix()
            if isinstance(labels, pd.core.series.Series):
                labels = labels.values

        start = time.time()
        for m in range(epochs):


            boot_data, oob_data, boot_labels, oob_labels = sh.random_sample(data,