Example #1
0
File: pt.py Project: mindis/cdr
    if args.pool:
        args.ablation = True
        ablations = None
        basenames_to_pool = None
        exps_outdirs = []

    for path in args.config_paths:
        p = Config(path)

        models = filter_models(p.model_list, args.models)
        cdr_models = [
            x for x in models if (x.startswith('CDR') or x.startswith('DTSR'))
        ]

        partitions = get_partition_list(args.partition)
        partition_str = '-'.join(partitions)

        if args.metric == 'loss':
            file_name = 'losses_mse_%s.txt' % partition_str
        else:
            file_name = 'loglik_%s.txt' % partition_str
        if args.twostep:
            file_name = 'LM_2STEP_' + file_name

        if args.ablation:
            comparison_sets = {}
            for model_name in cdr_models:
                model_basename = model_name.split('!')[0]
                if model_basename not in comparison_sets:
                    comparison_sets[model_basename] = []
Example #2
0
        cdr_models = [m for m in models if (m.startswith('CDR') or m.startswith('DTSR'))]

        if not args.ablated_models:
            cdr_models_new = []
            for model_name in cdr_models:
                if len(model_name.split('!')) == 1: #No ablated variables, which are flagged with "!"
                    cdr_models_new.append(model_name)
            cdr_models = cdr_models_new

        evaluation_sets = []
        evaluation_set_partitions = []
        evaluation_set_names = []
        evaluation_set_paths = []

        for p_name in args.partition:
            partitions = get_partition_list(p_name)
            partition_str = '-'.join(partitions)
            X_paths, y_paths = paths_from_partition_cliarg(partitions, p)
            X, y = read_data(X_paths, y_paths, p.series_ids, categorical_columns=list(
                set(p.split_ids + p.series_ids + [v for x in cdr_formula_list for v in x.rangf])))
            X, y, select, X_response_aligned_predictor_names, X_response_aligned_predictors, X_2d_predictor_names, X_2d_predictors = preprocess_data(
                X,
                y,
                cdr_formula_list,
                p.series_ids,
                filters=p.filters,
                compute_history=True,
                history_length=p.history_length
            )
            evaluation_sets.append((X, y, select, X_response_aligned_predictor_names, X_response_aligned_predictors,
                                    X_2d_predictor_names, X_2d_predictors))