from torch import nn
from copy import deepcopy
from src import definitions
from src.bin import statistics
from src.data_manager import cross_val
from src.models.multitask_learning import multitask_autoencoder
from src.utils.read_utils import read_pickle

feature_list = data_manager.FEATURE_LIST

# ##### Pickle #####
data_file_path = os.path.join(
    definitions.DATA_DIR, 'training_data/shuffled_splits',
    'training_date_normalized_shuffled_splits_select_features_no_prev_stress_2.pkl'
)
data = read_pickle(data_file_path)

############ Stats #############
print(statistics.get_train_test_val_label_counts_from_raw_data(data))

################################## Init ##################################
use_historgram = True
autoencoder_bottle_neck_feature_size = 128
autoencoder_num_layers = 1
alpha, beta = 0.001, 1
decay = 0.0001
first_key = next(iter(data['data'].keys()))
if use_historgram:
    num_features = len(data['data'][first_key][4][0])
else:
    num_features = len(data['data'][first_key][0][0])
Esempio n. 2
0
def run_grid_search():
    data_file_path = os.path.join(definitions.DATA_DIR,
                                  'training_data/shuffled_splits',
                                  TRAINING_DATA_FILE_NAME)
    data = read_utils.read_pickle(data_file_path)
    search_best_params_for_experiment("multitask_learner_auto_encoder", data)
Esempio n. 3
0
        eps = float(method.split('_')[1])
        min_samples = int(method.split('_')[2])
        feature = -1 # stress label
        groups = time_warping(student_list, data, feature, eps, min_samples)
    else:
        groups = one_for_each(student_list)

    # write to pkl file
    filepath = 'Data/student_groups/' + method + '.pkl'
    print('write to the file: ' + filepath)
    write_utils.data_structure_to_pickle(groups, filepath)

if __name__ == '__main__':
    # ##### Pickle #####
    data_file_path = 'Data/training_data/shuffled_splits/training_date_normalized_shuffled_splits_select_features_no_prev_stress_all_students.pkl'
    data = read_pickle(data_file_path)
    student_list = conversions.extract_distinct_student_idsfrom_keys(data['data'].keys())
    student_list = conversions.prepend_ids_with_string(student_list, "student_")
    
    method = None
    try:
        method = sys.argv[1]
    except:
        method = 'one_for_each'
    student_groups = clustering(student_list, data['data'], method)

    groups_file_path = 'Data/student_groups/' + method + '.pkl'
    print('get group file from: ' + groups_file_path)
    student_groups = read_pickle(groups_file_path) 
    
    # check how students are distributed
Esempio n. 4
0
# Start date: EST Feb.22th.2020
# Last update: EST Feb.27th.2020
# ----------------------------------------------------------------

import os
import sys
from src.utils.read_utils import read_pickle

if __name__ == '__main__':
    method = None
    try:
        method = sys.argv[1]
    except:
        method = 'one_for_each'
    #student_groups = clustering(student_list, data['data'], method)

    groups_file_path = 'Data/student_groups/' + method + '.pkl'
    print('get group file from: ' + groups_file_path)
    student_groups = read_pickle(groups_file_path) 
    
    # check how students are distributed
    print("student distribution: ")
    rev_groups = dict()
    for student in student_groups:
        if rev_groups.get(student_groups[student]) != None:
            rev_groups[student_groups[student]].append(student)
        else:
            rev_groups[student_groups[student]] = [student]
    for group in rev_groups:
        print(group + ': ' + str(rev_groups[group]))