# 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
from __future__ import division




class BaseSelector(object):
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def _get_feature_coeff(self):
        raise NotImplementedError

    def __init__(self, bootstrap_fraction, classifier, random_seed=None, feature_importance_metric=None, feature_importance_threshold=None):
        self.initialized = False

        self.num_bootstraps = 0
        self.bootstrap_fraction = bootstrap_fraction
        self.random_seed = random_seed

        self.clf = classifier
        self.feature_importance_metric = feature_importance_metric
        self.feature_importance_threshold = feature_importance_threshold

        if feature_importance_metric:
            assert feature_importance_threshold, "If feature permutation importance is to be calculated, a threshold has to be set!"

        self.attributes = None

# 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

from __future__ import division




class BaseSelector(object):
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def _get_feature_coeff(self):
        raise NotImplementedError

    def __init__(self, bootstrap_fraction, classifier, random_seed=None, feature_importance_metric=None, feature_importance_threshold=None):
        self.initialized = False

        self.num_bootstraps = 0
        self.bootstrap_fraction = bootstrap_fraction
        self.random_seed = random_seed

        self.clf = classifier
        self.feature_importance_metric = feature_importance_metric
        self.feature_importance_threshold = feature_importance_threshold

        if feature_importance_metric:
            assert feature_importance_threshold, "If feature permutation importance is to be calculated, a threshold has to be set!"

        self.attributes = None

        self.coeff_df = None