Exemplo n.º 1
0
        logger.info('\tWorking on Adi ID:\t%s' % adi_id)

        # Get the indices of the samples with the target Adi ID
        tar_idxs = np.array(
            [this_adi_id in [adi_id] for this_adi_id in adi_ids])

        # Use the samples with this adipose ID as the test set,
        # all others assigned to train set
        test_data = g2_d[tar_idxs, :, :]
        train_data = g2_d[~tar_idxs, :, :]
        test_md = g2_md[tar_idxs]
        train_md = g2_md[~tar_idxs]

        # Perform data augmentation on the training set here
        train_data, train_md = full_aug(train_data, train_md)

        # Get class labels for train/test sets here
        test_labels = get_class_labels(test_md)
        train_labels = get_class_labels(train_md)
        test_labels = to_categorical(test_labels)
        train_labels = to_categorical(train_labels)

        # Resize data for use with keras
        test_data = resize_features_for_keras(test_data)
        train_data = resize_features_for_keras(train_data)

        # Init arrays for storing results for this test set
        aucs_here = np.zeros([
            __N_RUNS,
        ])
Exemplo n.º 2
0
    g2_d = load_pickle(os.path.join(__DATA_DIR, 'g2/g2_fd.pickle'))
    g2_md = load_pickle(os.path.join(__DATA_DIR, 'g2/g2_metadata.pickle'))

    # Load the training data and metadata from Gen-1
    g1_d = load_pickle(os.path.join(__DATA_DIR,
                                    'g1-train-test/test_fd.pickle'))
    g1_md = load_pickle(
        os.path.join(__DATA_DIR, 'g1-train-test/test_md.pickle'))

    # Convert data to time domain, take magnitude, apply window
    g1_d = correct_g1_ini_ant_ang(g1_d)
    g1_d = np.abs(to_td(g1_d))
    g2_d = np.abs(to_td(g2_d))

    # Perform data augmentation
    g2_d, g2_md = full_aug(g2_d, g2_md)

    g2_d = resize_features_for_keras(g2_d)
    g1_d = resize_features_for_keras(g1_d)
    g2_labels = to_categorical(get_class_labels(g2_md))
    g1_labels = to_categorical(get_class_labels(g1_md))

    n_runs = 20

    # Init arrays for storing performance metrics
    auc_scores = np.zeros([
        n_runs,
    ])
    accs = np.zeros([
        n_runs,
    ])