inner_train_fMRI_data = train_fMRI_data[inner_train_index, :]
            inner_test_fMRI_data = train_fMRI_data[inner_test_index, :]
            inner_train_sMRI_data = train_sMRI_data[inner_train_index, :]
            inner_test_sMRI_data = train_sMRI_data[inner_test_index, :]
            inner_train_targets = train_targets[inner_train_index]

            # correct inner training data
            #inner_train_data, LS_dict, v_pool = fit_transform_neuroCombat(inner_train_data, train_metadata.iloc[inner_train_index, :], 'Site', continuous_cols=[timepoint + '|total_panss'])
            inner_train_fMRI_data, model = fit_transform_neuroCombat(
                inner_train_fMRI_data,
                train_metadata.iloc[inner_train_index, :],
                'Site',
                continuous_cols=[timepoint + '|total_panss'])
            # correct testing data
            inner_test_fMRI_data = apply_neuroCombat_model(
                inner_test_fMRI_data, train_metadata.iloc[inner_test_index, :],
                model, 'Site')

            inner_train_sMRI_data, model = fit_transform_neuroCombat(
                inner_train_sMRI_data,
                train_metadata.iloc[inner_train_index, :],
                'Site',
                continuous_cols=[timepoint + '|total_panss'])
            # correct testing data
            inner_test_sMRI_data = apply_neuroCombat_model(
                inner_test_sMRI_data, train_metadata.iloc[inner_test_index, :],
                model, 'Site')

            # make inner predictions
            rgr_lin.fit(inner_train_fMRI_data, inner_train_targets)
            inner_fMRI_pred = rgr_lin.predict(inner_test_fMRI_data)
Пример #2
0
    train_data = connectivity_data[train_index, :]
    test_data = connectivity_data[test_index, :]

    # do supervised site correction?
    if site_correction == 'comBat_supervised':

        # correct training data
        train_data, model = fit_transform_neuroCombat(
            train_data,
            metadata.iloc[train_index, :],
            'Site',
            continuous_cols=[timepoint + '|total_panss'])

        # correct testing dara
        test_data = apply_neuroCombat_model(test_data,
                                            metadata.iloc[test_index, :],
                                            model, 'Site')

    #recreate a stack of matrices for train and test
    # add extra singleton dimension for channels
    train_matrices = np.reshape(train_data, (train_size, n_regions, n_regions))
    test_matrices = np.reshape(test_data, (test_size, n_regions, n_regions))
    train_matrices = train_matrices[:, :, :, np.newaxis]
    test_matrices = test_matrices[:, :, :, np.newaxis]

    # create and compile the model
    model = brainnetCNN_model_2((n_regions, n_regions, 1),
                                n_filters,
                                use_bias,
                                n_outputs=n_PANSS_items)
    # my custom
Пример #3
0
 train_fMRI_data = fMRI_data[train_index, :]
 test_fMRI_data = fMRI_data[test_index, :]
 train_sMRI_data = sMRI_data[train_index, :]
 test_sMRI_data = sMRI_data[test_index, :]
 
 # do supervised site correction?
 if site_correction == 'comBat_supervised' :
     
 
     # correct training data
     train_fMRI_data, fMRI_model = fit_transform_neuroCombat(train_fMRI_data, metadata.iloc[train_index, :], 'Site', continuous_cols=[timepoint + '|total_panss'])
     train_sMRI_data, sMRI_model = fit_transform_neuroCombat(train_sMRI_data, metadata.iloc[train_index, :], 'Site', continuous_cols=[timepoint + '|total_panss'])
     
     # correct testing dara
     test_fMRI_data = apply_neuroCombat_model(test_fMRI_data,
                   metadata.iloc[test_index, :], fMRI_model,
                   'Site')
     test_sMRI_data = apply_neuroCombat_model(test_sMRI_data,
                   metadata.iloc[test_index, :], sMRI_model,
                   'Site')
 
 #recreate a stack of matrices for train and test
 # add extra singleton dimension for channels
 train_fMRI_matrices = np.reshape(train_fMRI_data, (train_size, n_fMRI_regions, n_fMRI_regions))
 test_fMRI_matrices = np.reshape(test_fMRI_data, (test_size, n_fMRI_regions, n_fMRI_regions))
 train_fMRI_matrices = train_fMRI_matrices[:, :, :, np.newaxis]
 test_fMRI_matrices = test_fMRI_matrices[:, :, :, np.newaxis]
 train_sMRI_matrices = np.reshape(train_sMRI_data, (train_size, n_sMRI_regions, n_sMRI_regions))
 test_sMRI_matrices = np.reshape(test_sMRI_data, (test_size, n_sMRI_regions, n_sMRI_regions))
 train_sMRI_matrices = train_sMRI_matrices[:, :, :, np.newaxis]
 test_sMRI_matrices = test_sMRI_matrices[:, :, :, np.newaxis]