from imblearn.over_sampling import SMOTE, ADASYN
from sklearn import svm, naive_bayes
from sklearn.ensemble import RandomForestClassifier
import pandas as pd

base_path = 'basepath-to-features-csv-folder'
version = 'NEW'
timestamp = '20180814'
picked_label = 'information-holder'
resample = 'default'
classifier = 'random-forest'

def get_version():
    if version == 'NEW':
        return 'new_version'
    elif version == 'OLD':
        return 'old_version'
    elif version == 'COMBINE':
            return 'old_new_version'
    else:
        print('Arguments is not correct')
        return


def get_data_train():
    return '{}01-{}_features_label-{}.csv'.format(base_path, get_version(), timestamp)


def get_data_train_binary():
    print("RUNNING BINARY CLASSIFICATION_______________________")
    return '{}02-{}_features_label-{}-{}.csv'.format(base_path, get_version(), timestamp, picked_label)


def get_corr_output_path():
    return '{}03-{}_correlation-{}.csv'.format(base_path, get_version(), timestamp)


def get_resample_config(features, labels):
    if resample == 'SMOTE':
        print("Resampling using SMOTE")
        return SMOTE().fit_sample(features, labels)
    elif resample == 'ADASYN':
        print("Resampling using ADASYN")
        return ADASYN().fit_sample(features, labels)
    elif resample == 'default':
        print("Not using Resampling")
        return features, labels
    else:
        print('ERR: config not found')
        return None


def get_classifier():
    if classifier == 'random-forest':
        print('USING: RANDOM FOREST CLASSIFIER=======================')
        return RandomForestClassifier(n_jobs=2, n_estimators=1000)
    elif classifier == 'svm-linear':
        print('USING: SVM LINEAR CLASSIFIER=======================')
        return svm.SVC(kernel='linear', C=1)
    elif classifier == 'multinomial-nb':
        print('USING: MULTINOMIAL NAIVE BAYES CLASSIFIER=======================')
        return naive_bayes.MultinomialNB()
    else:
        print('ERR: not supported yet')
        return None


def get_importance_feature_path():
    return '{}200-{}_importance_features-{}-{}.csv'.format(base_path, get_version(), timestamp, picked_label)


def get_label():
    if picked_label == 'information-holder':
        return ['Information Holder']
    elif picked_label == 'structurer':
        return ['Structurer']
    elif picked_label == 'service-provider':
        return ['Service Provider']
    elif picked_label == 'controller':
        return ['Controller']
    elif picked_label == 'coordinator':
        return ['Coordinator']
    elif picked_label == 'interfacer':
        return ['Interfacer']
    else:
        print("not Found")
        return None

def get_multiclass_performance_path():
    return base_path + "06-{}_multiclass-graph-{}.csv".format(get_version(), timestamp)

