return dataZ


subj_list = [
    'P103', 'P105', 'P107', 'P108', 'P110', 'P114', 'P116', 'P118', 'P120',
    'P121'
]

for subj in subj_list:

    print("************************")

    print("Testing on {}".format(subj))

    personalized_folder = '../data/wild/{}/personalized'.format(subj)
    maybe_create_folder(personalized_folder)

    df = pd.read_csv('../data/wild/{}/feature.csv'.format(subj))
    exclusion = ['label', 'date_exp', 'start', 'end']
    feature_names = [f for f in df.columns.values if not f in exclusion]
    selected_columns = feature_names[:-5]
    df = standardize_zscore(df, selected_columns)

    # Leave one day out validation
    day = []
    day_index = []
    precision = []
    recall = []
    fscore = []

    precision_neg = []
    return dataZ


subj_list = [
    'P103', 'P105', 'P107', 'P108', 'P110', 'P114', 'P116', 'P118', 'P120',
    'P121'
]

for subj in subj_list:

    print("************************")

    print("Testing on {}".format(subj))

    generalized_folder = '../data/wild/{}/generalized'.format(subj)
    maybe_create_folder(generalized_folder)

    df = pd.read_csv('../data/wild/{}/feature.csv'.format(subj))
    exclusion = ['label', 'date_exp', 'start', 'end']
    feature_names = [f for f in df.columns.values if not f in exclusion]
    selected_columns_normalization = feature_names[:-5]

    concat_list = []
    for outside in subj_list:
        if outside == subj:
            print("Excluding {}".format(outside))
            continue
        df_outside = pd.read_csv('../data/wild/{}/feature.csv'.format(outside))
        concat_list.append(df_outside)

    df_generalized = pd.concat(concat_list)
示例#3
0
for subj in subj_list:

    files = list_files_in_directory(
        os.path.join('../data/wild/', subj, 'personalized'))
    dur_df_list = []

    # for file in files:
    for day in range(14):

        filepath = "../data/wild/{}/personalized/prediction_day_{}.csv".format(
            subj, day)

        if not os.path.isfile(filepath):
            continue

        maybe_create_folder(os.path.join('Meal_prediction', subj))

        lprint(log_file, filepath)
        raw_df = pd.read_csv(filepath)

        # TIME ZONE CONTAINED AUTO CHECK CODE:
        raw_df = df_to_datetime_tz_aware(raw_df, ['start', 'end'])

        starttimes = raw_df['start'].values
        endtimes = raw_df['end'].values
        preds = raw_df['prediction'].values

        earliest = raw_df['start'].min()
        latest = raw_df['end'].max()

        dt = pd.date_range(start=earliest, end=latest, freq='50ms')