set(basenames_to_pool_cur)))) exps_outdirs.append(p.outdir) else: comparison_sets = {None: cdr_models} if not args.pool: for s in comparison_sets: model_set = comparison_sets[s] if len(model_set) > 1: if s is not None: stderr( 'Comparing models within ablation set "%s"...\n' % s) for i in range(len(model_set)): m1 = model_set[i] p.set_model(m1) for j in range(i + 1, len(model_set)): m2 = model_set[j] is_nested = nested(m1, m2) if is_nested or not args.ablation: if is_nested: if m1.count('!') > m2.count('!'): a_model = m1 b_model = m2 else: a_model = m2 b_model = m1 else: a_model = m1 b_model = m2
partitions = get_partition_list(args.partition) partition_str = '-'.join(partitions) for m in models: dir_path = p.outdir + '/' + m if args.ablated_models: data_path = dir_path + '/X_conv_' + partition_str + '.csv' else: data_path = p.outdir + '/' + m.split( '!')[0] + '/X_conv_' + partition_str + '.csv' stderr('Two-step analysis using data file %s\n' % data_path) if os.path.exists(data_path): p.set_model(m) f = Formula(p['formula']) model_form = f.to_lmer_formula_string( z=args.zscore, correlated=not args.uncorrelated) model_form = model_form.replace('-', '_') is_lme = '|' in model_form df = pd.read_csv(data_path, sep=' ', skipinitialspace=True) for c in df.columns: if df[c].dtype.name == 'object': df[c] = df[c].astype(str) new_cols = [] for c in df.columns: new_cols.append(c.replace('-', '_'))