Example #1
0
def run_latent_data(base_path, trn_data, tst_data, outpath, name, fold):

    trndata = ANN_Executioner_Helper.get_latent_data(base_path, trn_data['name_index'], trn_data['stress'], use_input_sensitivity=True, normalize=True)
    tstdata = ANN_Executioner_Helper.get_latent_data(base_path, tst_data['name_index'], tst_data['stress'], use_input_sensitivity=True, normalize=True)

    ANN_Executioner_Helper.run_nn_train_until_convergence(trndata, tstdata, outpath, name, fold)

    pass
def run(fold_object_path, number_of_fold, outpath, feature, duration,
        delta_bool, delta2_bool, latent_data_path):

    print 'Start at Fold object path : {}'.format(fold_object_path)
    for i in range(number_of_fold):
        trn_obj, tst_obj = ANN_Executioner_Helper.get_train_and_test_fold(
            fold_object_path, number_of_fold, i)

        trn_data = ANN_Executioner_Helper.get_data_from_obj(
            trn_obj, feature, duration, get_only_stress=None)
        tst_data = ANN_Executioner_Helper.get_data_from_obj(
            tst_obj, feature, duration, get_only_stress=None)

        trn_data_set = ANN_Executioner_Helper.get_ClassificationDataSet(
            trn_data['Y'], trn_data['stress'])
        tst_data_set = ANN_Executioner_Helper.get_ClassificationDataSet(
            tst_data['Y'], tst_data['stress'])

        print "Number of training patterns: ", len(trn_data_set)
        print "Input and output dimensions: ", trn_data_set.indim, trn_data_set.outdim

        print 'Plain data : '
        ANN_Executioner_Helper.run_nn(trn_data_set, tst_data_set, outpath,
                                      'Plain_data', i)
        print 'Latent data : '
        run_latent_data(latent_data_path, trn_data, tst_data, outpath,
                        'Latent_data', i)
        print
def run_latent_data(base_path, trn_data, tst_data, outpath, name, fold):

    trndata = ANN_Executioner_Helper.get_latent_data(
        base_path,
        trn_data['name_index'],
        trn_data['tone'],
        use_input_sensitivity=True,
        normalize=False)
    tstdata = ANN_Executioner_Helper.get_latent_data(
        base_path,
        tst_data['name_index'],
        tst_data['tone'],
        use_input_sensitivity=True,
        normalize=False)

    ANN_Executioner_Helper.run_nn(trndata, tstdata, outpath, name, fold)

    pass