target_v = Variable(y_test.cuda(cuda_id), requires_grad=False)
    
    input_train = x_train
    target_train = y_train
    
    n_features = input_v.size(1)
    trainer = TrainerSimpleNet(n_classes, n_features, n_epochs, batch_size, cuda_id)
    trainer.fit(input_train, target_train)
    res = trainer.evaluate(input_v, target_v)
    
    print('Test: loss={:.4}, acc={:.2f}%, f1={:.4}'.format(*res))
    
    return (fold_id, res)
#%%
if __name__ == "__main__":
    feat_data, col2ignore_r = read_feats()
    
#%%
   
#    core_sets = [
#            ['length_50th',
#        'curvature_head_IQR',
#        'quirkiness_50th',
#        'speed_90th',
#        'motion_mode_backward_fraction'],
#             
#              ['curvature_head_abs_90th',
# 'width_midbody_norm_50th',
# 'length_50th',
# 'curvature_hips_abs_90th',
# 'motion_mode_backward_fraction'],
        print(db_name, x_t, yy[min_ind], yy.max())

        plt.title(db_name)

        ff = os.path.join(save_dir, '{}_{}.pdf'.format(experimental_dataset,
                                                       db_name))
        plt.savefig(ff)

    #%%

    #%%
    #I forgot to add the last feature remaining so I have to do a dirty hack
    if os.path.basename(save_name).startswith('R_'):
        if True:
            #i forgot to add the last feature extracted...
            feat_data, col2ignore_r = read_feats(experimental_dataset)
            all_feats = [
                x for x in feat_data['tierpsy'].columns
                if x not in col2ignore_r
            ]

            del feat_data
            #remove ventral signed columns that where not abs (This ones seemed useless...)
            v_cols = [
                x for x in all_feats if not (('eigen' in x) or ('blob' in x))
            ]
            v_cols_remove = [
                x.replace('_abs', '') for x in v_cols if '_abs' in x
            ]
            all_feats = list(set(v_cols) - set(v_cols_remove))
            all_feats = set(all_feats)
top16_manual = [
    'length_90th', 'width_midbody_norm_10th', 'curvature_hips_abs_90th',
    'curvature_head_abs_90th', 'motion_mode_paused_fraction',
    'motion_mode_paused_frequency', 'd_curvature_hips_abs_90th',
    'd_curvature_head_abs_90th', 'width_head_base_norm_10th',
    'motion_mode_backward_frequency', 'quirkiness_50th', 'minor_axis_50th',
    'curvature_midbody_norm_abs_50th',
    'relative_to_hips_radial_velocity_tail_tip_50th',
    'relative_to_head_base_radial_velocity_head_tip_50th',
    'relative_to_head_base_angular_velocity_head_tip_abs_90th'
]

if __name__ == '__main__':
    experimental_dataset = 'SWDB'
    feat_data, col2ignore_r = read_feats(experimental_dataset,
                                         z_transform=False)
    #feat_data, col2ignore_r = read_feats(experimental_dataset, z_transform = True)

    df = feat_data['tierpsy']
    del feat_data

    #this videos are clearly outliers. They are from 2009. Andre's normally says this date was
    #before they developed the final experimental protocol so I assume therewas a problem with them.
    bad_index = df.index[(df['strain'] == 'N2') & (df['length_50th'] > 1500)]
    df.drop(bad_index, inplace=True)

    #%%
    strain_sets = dict(mutants=[
        'Schafer Lab N2 (Bristol, UK)', 'dpy-20(e1282)IV', 'egl-5(n486)III',
        'unc-9(e101)X', 'unc-77(e625)IV', 'ser-4(ok512)III', 'sma-2(e502)III',
        'trp-4(sy695)I'