Пример #1
0
def experiment_schizophrenia_data(data_path='data', n_folds=5,
                                  iterations=10000,
                                  verbose=True, plot=True, random_state=None):
    """Run the experiments on the Schizophrenia dataset

    Parameters:
    ----------
    data_path: string
        Path to the folder containing the dataset.
    n_folds: int
        The number of folds in a StratifiedKFold cross-validation
    iterations: int
        Number of iterations to compute the null distribution of
        balanced_accuracy and MMD^2_u
    verbose: bool
    plot: bool
        Whether to plot the results of the statistical tests.

    """
    name = 'Schizophrenia'
    if verbose:
        print '\nWorking on %s dataset...' % name
        print '-----------------------'
    X, y = load_schizophrenia_data(data_path, verbose=verbose)

    # DCE + RBF
    if verbose:
        print '\n### Results for DCE_Embedding ###'

    gk_dce = GK_DCE(kernel_vector_space='rbf')
    K_dce = gk_dce.compare_pairwise(X)
    simple_experiment(K_dce, y, n_folds=n_folds, iterations=iterations,
                      verbose=verbose, data_name=name + '_dce', plot=plot,
                      random_state=random_state)

    # DRE + RBF
    if verbose:
        print '\n### Results for DR_Embedding ###'

    gk_dre = GK_DRE(kernel_vector_space='rbf')
    K_dre = gk_dre.compare_pairwise(X)
    simple_experiment(K_dre, y, n_folds=n_folds, iterations=iterations,
                      verbose=verbose, data_name=name+'_dr',plot=plot,
                      random_state=random_state)

    # WL Kernel
    if verbose:
        print '\n### Results for WL_K_Embedding ###'
    gk_wl = GK_WL(th=0.2)
    K_wl = gk_wl.compare_pairwise(X)
    simple_experiment(K_wl, y, n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose, data_name=name+'_wl', plot=plot,
                      random_state=random_state)

    # SP Kernel 
    if verbose:
        print '\n### Results for SP_K_Embedding ###'
    gk_sp = GK_SP(th=0.2)
    K_sp = gk_sp.compare_pairwise(X)
    simple_experiment(K_sp, y, n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose, data_name=name+'_sp', plot=plot,
                      random_state=random_state)
#                      
    # NBS
    th = 0.5
    mxcmp, mxcmp_null, p_value = apply_nbs(X, y, th, iterations, verbose)
    if plot:
        plot_statistic(mxcmp, mxcmp_null, p_value, data_name=name+'_nbs',
                       stats_name='Max_comp_size')
Пример #2
0
def experiment_schizophrenia_data(data_path='data',
                                  n_folds=5,
                                  iterations=10000,
                                  verbose=True,
                                  plot=True,
                                  random_state=None):
    """Run the experiments on the Schizophrenia dataset

    Parameters:
    ----------
    data_path: string
        Path to the folder containing the dataset.
    n_folds: int
        The number of folds in a StratifiedKFold cross-validation
    iterations: int
        Number of iterations to compute the null distribution of
        balanced_accuracy and MMD^2_u
    verbose: bool
    plot: bool
        Whether to plot the results of the statistical tests.

    """
    name = 'Schizophrenia'
    if verbose:
        print '\nWorking on %s dataset...' % name
        print '-----------------------'
    X, y = load_schizophrenia_data(data_path, verbose=verbose)

    # DCE Embedding
    if verbose:
        print '\n### Results for DCE_Embedding ###'

    X_dce = DCE_embedding(X)
    K_dce = compute_rbf_kernel_matrix(X_dce)
    simple_experiment(K_dce,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_dce',
                      plot=plot,
                      random_state=random_state)

    # DR Embedding
    if verbose:
        print '\n### Results for DR_Embedding ###'

    X_dr = DR_embedding(X)
    K_dr = compute_rbf_kernel_matrix(X_dr)
    simple_experiment(K_dr,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_dr',
                      plot=plot,
                      random_state=random_state)

    # WL Kernel based Embedding
    if verbose:
        print '\n### Results for WL_K_Embedding ###'
    th = 0.2
    K_wl = WL_K_embedding(X, th)
    simple_experiment(K_wl,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_wl',
                      plot=plot,
                      random_state=random_state)

    # SP Kernel based Embedding
    if verbose:
        print '\n### Results for SP_K_Embedding ###'
    th = 0.2
    K_sp = SP_K_embedding(X, th)
    simple_experiment(K_sp,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_sp',
                      plot=plot,
                      random_state=random_state)
Пример #3
0
        # for name in locs:
        #     if verbose:
        #         print '\nWorking on %s dataset...' % name
        #         print '-----------------------'
        #     X, y = load_1000_funct_connectome(data_path, name,
        #                                       verbose=verbose)
        #     check_instability_classification(X, y, location=name,
        #                                      n_folds=n_folds,
        #                                      iterations=iterations,
        #                                      verbose=verbose,
        #                                      reps=repetitions, seed=seed)

        # Working on the schizophrenia data
        if verbose:
            print '\nWorking on Schizophrenia dataset...'
        X, y = load_schizophrenia_data(data_path, verbose=verbose)
        check_instability_classification(X,
                                         y,
                                         location='Schizophrenia',
                                         n_folds=n_folds,
                                         iterations=iterations,
                                         verbose=verbose,
                                         reps=repetitions,
                                         seed=seed)

        # # Working on URI data
        # X, y = load_kernel_matrix()
        # check_instability_classification(X, y, n_folds=n_folds,
        #                                  iterations=iterations,
        #                                  verbose=verbose,
        #                                  reps=repetitions, seed=seed)
Пример #4
0
def experiment_schizophrenia_data(data_path='data', n_folds=5,
                                  iterations=10000,
                                  verbose=True, plot=True, random_state=None):
    """Run the experiments on the Schizophrenia dataset

    Parameters:
    ----------
    data_path: string
        Path to the folder containing the dataset.
    n_folds: int
        The number of folds in a StratifiedKFold cross-validation
    iterations: int
        Number of iterations to compute the null distribution of
        balanced_accuracy and MMD^2_u
    verbose: bool
    plot: bool
        Whether to plot the results of the statistical tests.

    """
    name = 'Schizophrenia'
    if verbose:
        print '\nWorking on %s dataset...' % name
        print '-----------------------'
    X, y = load_schizophrenia_data(data_path, verbose=verbose)

    # DCE Embedding
    if verbose:
        print '\n### Results for DCE_Embedding ###'

    X_dce = DCE_embedding(X)
    K_dce = compute_rbf_kernel_matrix(X_dce)
    simple_experiment(K_dce, y, n_folds=n_folds, iterations=iterations,
                      verbose=verbose, data_name=name + '_dce', plot=plot,
                      random_state=random_state)

    # DR Embedding
    if verbose:
        print '\n### Results for DR_Embedding ###'

    X_dr = DR_embedding(X)
    K_dr = compute_rbf_kernel_matrix(X_dr)
    simple_experiment(K_dr, y, n_folds=n_folds, iterations=iterations,
                      verbose=verbose, data_name=name+'_dr',plot=plot,
                      random_state=random_state)

    # WL Kernel based Embedding
    if verbose:
        print '\n### Results for WL_K_Embedding ###'
    th = 0.2
    K_wl = WL_K_embedding(X, th)
    simple_experiment(K_wl, y, n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose, data_name=name+'_wl', plot=plot,
                      random_state=random_state)

    # SP Kernel based Embedding
    if verbose:
        print '\n### Results for SP_K_Embedding ###'
    th = 0.2
    K_sp = SP_K_embedding(X, th)
    simple_experiment(K_sp, y, n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose, data_name=name+'_sp', plot=plot,
                      random_state=random_state)
Пример #5
0
        # # Working on the functional connectome data
        # for name in locs:
        #     if verbose:
        #         print '\nWorking on %s dataset...' % name
        #         print '-----------------------'
        #     X, y = load_1000_funct_connectome(data_path, name,
        #                                       verbose=verbose)
        #     check_instability_classification(X, y, location=name,
        #                                      n_folds=n_folds,
        #                                      iterations=iterations,
        #                                      verbose=verbose,
        #                                      reps=repetitions, seed=seed)

        # Working on the schizophrenia data
        if verbose:
            print '\nWorking on Schizophrenia dataset...'
        X, y = load_schizophrenia_data(data_path, verbose=verbose)
        check_instability_classification(X, y, location='Schizophrenia',
                                         n_folds=n_folds,
                                         iterations=iterations,
                                         verbose=verbose,
                                         reps=repetitions, seed=seed)

        # # Working on URI data
        # X, y = load_kernel_matrix()
        # check_instability_classification(X, y, n_folds=n_folds,
        #                                  iterations=iterations,
        #                                  verbose=verbose,
        #                                  reps=repetitions, seed=seed)
Пример #6
0
def experiment_schizophrenia_data(data_path='data',
                                  n_folds=5,
                                  iterations=10000,
                                  verbose=True,
                                  plot=True,
                                  random_state=None):
    """Run the experiments on the Schizophrenia dataset

    Parameters:
    ----------
    data_path: string
        Path to the folder containing the dataset.
    n_folds: int
        The number of folds in a StratifiedKFold cross-validation
    iterations: int
        Number of iterations to compute the null distribution of
        balanced_accuracy and MMD^2_u
    verbose: bool
    plot: bool
        Whether to plot the results of the statistical tests.

    """
    name = 'Schizophrenia'
    if verbose:
        print '\nWorking on %s dataset...' % name
        print '-----------------------'
    X, y = load_schizophrenia_data(data_path, verbose=verbose)

    # DCE + RBF
    if verbose:
        print '\n### Results for DCE_Embedding ###'

    gk_dce = GK_DCE(kernel_vector_space='rbf')
    K_dce = gk_dce.compare_pairwise(X)
    simple_experiment(K_dce,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_dce',
                      plot=plot,
                      random_state=random_state)

    # DRE + RBF
    if verbose:
        print '\n### Results for DR_Embedding ###'

    gk_dre = GK_DRE(kernel_vector_space='rbf')
    K_dre = gk_dre.compare_pairwise(X)
    simple_experiment(K_dre,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_dr',
                      plot=plot,
                      random_state=random_state)

    # WL Kernel
    if verbose:
        print '\n### Results for WL_K_Embedding ###'
    gk_wl = GK_WL(th=0.2)
    K_wl = gk_wl.compare_pairwise(X)
    simple_experiment(K_wl,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_wl',
                      plot=plot,
                      random_state=random_state)

    # SP Kernel
    if verbose:
        print '\n### Results for SP_K_Embedding ###'
    gk_sp = GK_SP(th=0.2)
    K_sp = gk_sp.compare_pairwise(X)
    simple_experiment(K_sp,
                      y,
                      n_folds=n_folds,
                      iterations=iterations,
                      verbose=verbose,
                      data_name=name + '_sp',
                      plot=plot,
                      random_state=random_state)
    #
    # NBS
    th = 0.5
    mxcmp, mxcmp_null, p_value = apply_nbs(X, y, th, iterations, verbose)
    if plot:
        plot_statistic(mxcmp,
                       mxcmp_null,
                       p_value,
                       data_name=name + '_nbs',
                       stats_name='Max_comp_size')