# Path: src/main/config.py
# TRAIN_SPLIT_FILE = os.path.join('data','classification_data','training_split.csv')
# TEST_SPLIT_FILE = os.path.join('data','classification_data','test_split.csv')
# VAL_SPLIT_FILE = os.path.join('data','classification_data','dev_split.csv')
# D_ND_DIR = os.path.join('data','disc_nondisc')
# POS_NEG_DIR = os.path.join('data','pos_neg')
# SEL_FEAT_TRAIN_REGULAR_CLASSIFY = os.path.join('data','selected_features','regular','classify','train')
# SEL_FEAT_TEST_REGULAR_CLASSIFY = os.path.join('data','selected_features','regular','classify','test')
# SEL_FEAT_VAL_REGULAR_CLASSIFY = os.path.join('data','selected_features','regular','classify','val')
# SEL_FEAT_TRAIN_REGULAR_ESTIMATE = os.path.join('data','selected_features','regular','estimate','train')
# SEL_FEAT_VAL_REGULAR_ESTIMATE = os.path.join('data','selected_features','regular','estimate','val')
# SEL_FEAT_TEST_REGULAR_ESTIMATE = os.path.join('data','selected_features','regular','estimate','test')
# ALL_FEAT_TRAIN_REGULAR_CLASSIFY = os.path.join('data','all_features','regular','classify','train')
# ALL_FEAT_TEST_REGULAR_CLASSIFY = os.path.join('data','all_features','regular','classify','test')
# ALL_FEAT_VAL_REGULAR_CLASSIFY = os.path.join('data','all_features','regular','classify','val')
# ALL_FEAT_TRAIN_REGULAR_ESTIMATE = os.path.join('data','all_features','regular','estimate','train')
# ALL_FEAT_VAL_REGULAR_ESTIMATE = os.path.join('data','all_features','regular','estimate','val')
# ALL_FEAT_TEST_REGULAR_ESTIMATE = os.path.join('data','all_features','regular','estimate','test')
# SEL_FEAT_TRAIN_NORMALIZED_CLASSIFY = os.path.join('data','selected_features','normalize','classify','train')
# SEL_FEAT_VAL_NORMALIZED_CLASSIFY = os.path.join('data','selected_features','normalize','classify','val')
# SEL_FEAT_TRAIN_NORMALIZED_ESTIMATE = os.path.join('data','selected_features','normalize','estimate','train')
# SEL_FEAT_VAL_NORMALIZED_ESTIMATE = os.path.join('data','selected_features','normalize','estimate','val')
# RESULTS_CLASSIFY = os.path.join('results','grid_search','classification')
# RESULTS_ESTIMATE = os.path.join('results','grid_search','regression')
# SEL_FEAT = os.path.join('data','selected_features')
# ALL_FEAT = os.path.join('data','all_features')
# ANOVA_DIR = os.path.join('results','anova')
# GRID_SEARCH_CLF_DIR = os.path.join('results','grid_search','classification')
# GRID_SEARCH_REG_DIR = os.path.join('results','grid_search','regression')


import pandas as pd
import os
import numpy as np
import sys
from sklearn import preprocessing
from ..main import config
    data_normalized_val = pd.DataFrame(transformed_val, columns=column)
    data_normalized_test = pd.DataFrame(transformed_test, columns=column)

    data_normalized_train[['video','label','score']] = data_train[['video','label','score']]
    data_normalized_val[['video','label','score']] = data_val[['video','label','score']]
    data_normalized_test[['video','label','score']] = data_test[['video','label','score']]


    write_path_file_train = filename_train.replace("regular","normalize")
    write_path_file_val = filename_val.replace("regular","normalize")
    write_path_file_test = filename_test.replace("regular", "normalize")


    #print write_path_file_train
    #print filename_val
    #print write_path_file_val
    #print filename_test
    #print write_path_file_test

    data_normalized_train.to_csv(write_path_file_train,index=None)
    data_normalized_val.to_csv(write_path_file_val,index=None)
    data_normalized_test.to_csv(write_path_file_test,index=None)

def normalize_features(select = "select"):
    if select == "select":
        path_classify = config.SEL_FEAT_TRAIN_REGULAR_CLASSIFY
        path_estimate = config.SEL_FEAT_TRAIN_REGULAR_ESTIMATE
    else:
        path_classify = config.ALL_FEAT_TRAIN_REGULAR_CLASSIFY
        path_estimate = config.ALL_FEAT_TRAIN_REGULAR_ESTIMATE

# Path: src/main/config.py
# TRAIN_SPLIT_FILE = os.path.join('data','classification_data','training_split.csv')
# TEST_SPLIT_FILE = os.path.join('data','classification_data','test_split.csv')
# VAL_SPLIT_FILE = os.path.join('data','classification_data','dev_split.csv')
# D_ND_DIR = os.path.join('data','disc_nondisc')
# POS_NEG_DIR = os.path.join('data','pos_neg')
# SEL_FEAT_TRAIN_REGULAR_CLASSIFY = os.path.join('data','selected_features','regular','classify','train')
# SEL_FEAT_TEST_REGULAR_CLASSIFY = os.path.join('data','selected_features','regular','classify','test')
# SEL_FEAT_VAL_REGULAR_CLASSIFY = os.path.join('data','selected_features','regular','classify','val')
# SEL_FEAT_TRAIN_REGULAR_ESTIMATE = os.path.join('data','selected_features','regular','estimate','train')
# SEL_FEAT_VAL_REGULAR_ESTIMATE = os.path.join('data','selected_features','regular','estimate','val')
# SEL_FEAT_TEST_REGULAR_ESTIMATE = os.path.join('data','selected_features','regular','estimate','test')
# ALL_FEAT_TRAIN_REGULAR_CLASSIFY = os.path.join('data','all_features','regular','classify','train')
# ALL_FEAT_TEST_REGULAR_CLASSIFY = os.path.join('data','all_features','regular','classify','test')
# ALL_FEAT_VAL_REGULAR_CLASSIFY = os.path.join('data','all_features','regular','classify','val')
# ALL_FEAT_TRAIN_REGULAR_ESTIMATE = os.path.join('data','all_features','regular','estimate','train')
# ALL_FEAT_VAL_REGULAR_ESTIMATE = os.path.join('data','all_features','regular','estimate','val')
# ALL_FEAT_TEST_REGULAR_ESTIMATE = os.path.join('data','all_features','regular','estimate','test')
# SEL_FEAT_TRAIN_NORMALIZED_CLASSIFY = os.path.join('data','selected_features','normalize','classify','train')
# SEL_FEAT_VAL_NORMALIZED_CLASSIFY = os.path.join('data','selected_features','normalize','classify','val')
# SEL_FEAT_TRAIN_NORMALIZED_ESTIMATE = os.path.join('data','selected_features','normalize','estimate','train')
# SEL_FEAT_VAL_NORMALIZED_ESTIMATE = os.path.join('data','selected_features','normalize','estimate','val')
# RESULTS_CLASSIFY = os.path.join('results','grid_search','classification')
# RESULTS_ESTIMATE = os.path.join('results','grid_search','regression')
# SEL_FEAT = os.path.join('data','selected_features')
# ALL_FEAT = os.path.join('data','all_features')
# ANOVA_DIR = os.path.join('results','anova')
# GRID_SEARCH_CLF_DIR = os.path.join('results','grid_search','classification')
# GRID_SEARCH_REG_DIR = os.path.join('results','grid_search','regression')


# Path: src/helpers/normalized_features.py
import pandas as pd
import os
import numpy as np
import sys
from sklearn import preprocessing
from ..main import config

    data_normalized_val = pd.DataFrame(transformed_val, columns=column)
    data_normalized_test = pd.DataFrame(transformed_test, columns=column)

    data_normalized_train[['video','label','score']] = data_train[['video','label','score']]
    data_normalized_val[['video','label','score']] = data_val[['video','label','score']]
    data_normalized_test[['video','label','score']] = data_test[['video','label','score']]


    write_path_file_train = filename_train.replace("regular","normalize")
    write_path_file_val = filename_val.replace("regular","normalize")
    write_path_file_test = filename_test.replace("regular", "normalize")


    #print write_path_file_train
    #print filename_val
    #print write_path_file_val
    #print filename_test
    #print write_path_file_test

    data_normalized_train.to_csv(write_path_file_train,index=None)
    data_normalized_val.to_csv(write_path_file_val,index=None)
    data_normalized_test.to_csv(write_path_file_test,index=None)

def normalize_features(select = "select"):
    if select == "select":
        path_classify = config.SEL_FEAT_TRAIN_REGULAR_CLASSIFY
        path_estimate = config.SEL_FEAT_TRAIN_REGULAR_ESTIMATE
    else:
        path_classify = config.ALL_FEAT_TRAIN_REGULAR_CLASSIFY
        path_estimate = config.ALL_FEAT_TRAIN_REGULAR_ESTIMATE

    list_train_classify = [os.path.join(path_classify, fn) for fn in next(os.walk(config.SEL_FEAT_TRAIN_REGULAR_CLASSIFY))[2]]