def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('visits', nargs='+', type=str, help='the viscodes to be sampled')
    parser.add_argument('-m', '--method', choices=DataHandler.get_method_choices(), default='all',
                        help='the method to collect data for')
    parser.add_argument('-b', '--biomarkers', nargs='+', default=None, help='name of the biomarker to be plotted')
    parser.add_argument('-p', '--phase', default=None, choices=DataHandler.get_phase_choices(),
                        help='the phase for which the model is to be trained')
    parser.add_argument('--estimate_dprs', action='store_true', help='recompute the dpis estimations')
    parser.add_argument('--recompute_estimates', action='store_true', help='recompute the dpis estimations')
    parser.add_argument('--consistent_data', action='store_true', help='us only subjects with bl, m12 and m24 visits')
    parser.add_argument('--no_plot', action='store_true', help='do not plot the results')
    parser.add_argument('--plot_lines', action='store_true', help='plot graphs instead of matrix')
    parser.add_argument('--plot_steps', type=int, default=15, help='number of steps for the DPI scale')
    parser.add_argument('--plot_file', type=str, default=None, help='filename of the output file')
    parser.add_argument('--plot_cmap_jet', action='store_true', help='use the colour map jet')
    args = parser.parse_args()

    # Get estimates
    _, diagnoses, dpis, dprs, mean_min, mean_max = et.get_progress_estimates(
        args.visits,
        method=args.method,
        biomarkers=args.biomarkers,
        phase=args.phase,
        estimate_dprs=args.estimate_dprs,
        recompute_estimates=args.recompute_estimates,
        select_test_set=True,
        consistent_data=args.consistent_data)

    # Plot results
    if not args.no_plot:
        plot_dpi_estimates(args, dpis, diagnoses, mean_min, mean_max)
        if args.estimate_dprs:
            plot_dpi_dpr_distribution(args, dpis, dprs, diagnoses)
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('visits', nargs='+', type=str, help='the viscodes to be sampled')
    parser.add_argument('-m', '--method', choices=DataHandler.get_method_choices(), default='all', help='the method to collect data for')
    parser.add_argument('-b', '--biomarkers', nargs='+', default=None, help='name of the biomarker to be plotted')
    parser.add_argument('-p', '--phase', default=None, choices=DataHandler.get_phase_choices(), help='the phase for which the model is to be trained')
    parser.add_argument('-c', '--classifier', default='svm', choices=['lda', 'svm', 'lsvm', 'rf'], help='the approach used to classify the subjects')
    parser.add_argument('--estimate_dprs', action='store_true', help='recompute the dpis estimations')
    parser.add_argument('--recompute_estimates', action='store_true', help='recompute the dpis estimations')
    parser.add_argument('--consistent_data', action='store_true', help='us only subjects with bl, m12 and m24 visits')
    parser.add_argument('--num_folds', type=int, default=10, help='number of folds for the n-fold cross validation')
    parser.add_argument('--latex_file', type=str, default=None, help='add output to a LaTeX file')
    args = parser.parse_args()

    # Get estimates
    rids, diagnoses, dpis, dprs, _, _ = et.get_progress_estimates(
        args.visits,
        method=args.method,
        biomarkers=args.biomarkers,
        phase=args.phase,
        estimate_dprs=args.estimate_dprs,
        recompute_estimates=args.recompute_estimates,
        consistent_data=args.consistent_data)

    # Select converters and non-converters sets
    rcds, non_rcds = get_rcds(args, rids, diagnoses, dpis, dprs)
    rfds, non_rfds = get_rfds(args, rids, diagnoses, dpis, dprs)

    # Analyse output
    analyse_decline(args, rids, dpis, dprs, rcds, non_rcds)
    analyse_decline(args, rids, dpis, dprs, rfds, non_rfds)
Ejemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-p', '--phase', default=None, choices=DataHandler.get_phase_choices(), help='the phase for which the model is to be trained')
    parser.add_argument('--consistent_data', action='store_true', help='us only subjects with bl, m12 and m24 visits')
    parser.add_argument('--estimate_dprs', action='store_true', help='estimate dpis and dprs')
    parser.add_argument('--recompute_estimates', action='store_true', help='recompute the dpi / dpr estimations')
    parser.add_argument('--recompute_predictions', action='store_true', help='recompute the biomarker predictions')
    parser.add_argument('--exclude_cn', action='store_true', help='exclude healthy subjects from analysis')
    args = parser.parse_args()

    estimates = {}
    methods = ['cog', 'vol', 'ml', 'img', 'all']
    for method in methods:
        estimates.update({method: {}})
        for visits in [['bl'], ['m12'], ['m24'], ['bl', 'm12'], ['m12', 'm24']]:
            _, diagnoses, dpis, _, _, _ = et.get_progress_estimates(visits,
                                                                    method=method,
                                                                    phase=args.phase,
                                                                    estimate_dprs=args.estimate_dprs)

            diagnoses = np.array(diagnoses)
            dpis = np.array(dpis)
            visits_string = '_'.join(visits)
            estimates[method].update({visits_string: {}})
            estimates[method][visits_string].update({'CN': np.mean(dpis[np.where(diagnoses == 0.0)])})
            estimates[method][visits_string].update({'EMCI': np.mean(dpis[np.where(diagnoses == 0.25)])})
            estimates[method][visits_string].update({'LMCI': np.mean(dpis[np.where(diagnoses == 0.75)])})
            estimates[method][visits_string].update({'AD': np.mean(dpis[np.where(diagnoses == 1.0)])})

    for method in methods:
        print log.INFO, 'Results for {0}'.format(method)
        for diagnosis in ['CN', 'EMCI', 'LMCI', 'AD']:
            print log.RESULT, '{0: <4}:   {1:.2f} {2:.2f} | {3:.2f}  '.format(
                              diagnosis,
                              estimates[method]['m12'][diagnosis] - estimates[method]['bl'][diagnosis],
                              estimates[method]['m24'][diagnosis] - estimates[method]['m12'][diagnosis],
                              estimates[method]['m12_m24'][diagnosis] - estimates[method]['bl_m12'][diagnosis])
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('visits',
                        nargs='+',
                        type=str,
                        help='the viscodes to be sampled')
    parser.add_argument('-m',
                        '--method',
                        choices=DataHandler.get_method_choices(),
                        default='all',
                        help='the method to collect data for')
    parser.add_argument('-b',
                        '--biomarkers',
                        nargs='+',
                        default=None,
                        help='name of the biomarker to be plotted')
    parser.add_argument('-p',
                        '--phase',
                        default=None,
                        choices=DataHandler.get_phase_choices(),
                        help='the phase for which the model is to be trained')
    parser.add_argument('--estimate_dprs',
                        action='store_true',
                        help='recompute the dpis estimations')
    parser.add_argument('--recompute_estimates',
                        action='store_true',
                        help='recompute the dpis estimations')
    parser.add_argument('--consistent_data',
                        action='store_true',
                        help='us only subjects with bl, m12 and m24 visits')
    parser.add_argument('--no_plot',
                        action='store_true',
                        help='do not plot the results')
    parser.add_argument('--plot_lines',
                        action='store_true',
                        help='plot graphs instead of matrix')
    parser.add_argument('--plot_steps',
                        type=int,
                        default=15,
                        help='number of steps for the DPI scale')
    parser.add_argument('--plot_file',
                        type=str,
                        default=None,
                        help='filename of the output file')
    parser.add_argument('--plot_cmap_jet',
                        action='store_true',
                        help='use the colour map jet')
    args = parser.parse_args()

    # Get estimates
    _, diagnoses, dpis, dprs, mean_min, mean_max = et.get_progress_estimates(
        args.visits,
        method=args.method,
        biomarkers=args.biomarkers,
        phase=args.phase,
        estimate_dprs=args.estimate_dprs,
        recompute_estimates=args.recompute_estimates,
        select_test_set=True,
        consistent_data=args.consistent_data)

    # Plot results
    if not args.no_plot:
        plot_dpi_estimates(args, dpis, diagnoses, mean_min, mean_max)
        if args.estimate_dprs:
            plot_dpi_dpr_distribution(args, dpis, dprs, diagnoses)
Ejemplo n.º 5
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('visits',
                        nargs='+',
                        type=str,
                        help='the viscodes to be sampled')
    parser.add_argument('-m',
                        '--method',
                        choices=DataHandler.get_method_choices(),
                        default='all',
                        help='the method to collect data for')
    parser.add_argument('-b',
                        '--biomarkers',
                        nargs='+',
                        default=None,
                        help='name of the biomarker to be plotted')
    parser.add_argument('-p',
                        '--phase',
                        default=None,
                        choices=DataHandler.get_phase_choices(),
                        help='the phase for which the model is to be trained')
    parser.add_argument('-c',
                        '--classifier',
                        default='svm',
                        choices=['lda', 'svm', 'lsvm', 'rf'],
                        help='the approach used to classify the subjects')
    parser.add_argument('--estimate_dprs',
                        action='store_true',
                        help='recompute the dpis estimations')
    parser.add_argument('--recompute_estimates',
                        action='store_true',
                        help='recompute the dpis estimations')
    parser.add_argument('--consistent_data',
                        action='store_true',
                        help='us only subjects with bl, m12 and m24 visits')
    parser.add_argument('--num_folds',
                        type=int,
                        default=10,
                        help='number of folds for the n-fold cross validation')
    parser.add_argument(
        '--num_runs',
        type=int,
        default=1,
        help='number of runs the x-fold cross-validation is performed')
    parser.add_argument('--latex_file',
                        type=str,
                        default=None,
                        help='add output to a LaTeX file')
    args = parser.parse_args()

    # Get estimates
    _, diagnoses, dpis, dprs, _, _ = et.get_progress_estimates(
        args.visits,
        method=args.method,
        biomarkers=args.biomarkers,
        phase=args.phase,
        estimate_dprs=args.estimate_dprs,
        recompute_estimates=args.recompute_estimates,
        consistent_data=args.consistent_data)

    # Analyse estimates
    classify_diagnoses(args, dpis, dprs, diagnoses)