Esempio n. 1
0
survival_fpath = args.survival_fpath

duration_col = args.duration_col
event_col = args.event_col

# setup directories
log_dir = make_and_get_dir(results_dir, 'log')
fitting_dir = make_and_get_dir(results_dir, 'model_fitting')
model_sel_dir = make_and_get_dir(results_dir, 'model_selection')
opt_diag_dir = make_and_get_dir(results_dir, 'opt_diagnostics')
clust_interpret_dir = make_and_get_dir(results_dir, 'interpret')

# load models and data
models = load(join(fitting_dir, 'selected_models'))
view_data, dataset_names, sample_names, view_feat_names = \
    load_data(*fpaths)

n_views = len(fpaths)
view_data = [pd.DataFrame(view_data[v],
                          index=sample_names,
                          columns=view_feat_names[v])
             for v in range(n_views)]

# possibly load metadata for comparison
if vars2compare_fpath is not None:
    vars2compare = pd.read_csv(vars2compare_fpath, index_col=0)
    vars2compare = vars2compare.loc[sample_names, :]
else:
    vars2compare = None

# possibly load super data
Esempio n. 2
0
parser.add_argument('--fpaths', nargs='+', help='Paths to data sets.')
args = parser.parse_args()

inches = 8
n_top_clust = 10

results_dir = args.results_dir
fpaths = args.fpaths

fitting_dir = join(results_dir, 'model_fitting')
ephys_viz_dir = join(results_dir, 'interpret', 'bd_mvmm', 'ephys_pca_feats')

# load models and data
models = load(join(fitting_dir, 'selected_models'))
view_data, dataset_names, sample_names, view_feat_names = load_data(*fpaths)

# load raw ephys data
orig_data_dir = join(MouseETPaths().raw_data_dir, 'inh_patchseq_spca_files',
                     'orig_data_csv')
ephys_raw = load_raw_ephys(orig_data_dir, concat=False)
for k in ephys_raw.keys():
    ephys_raw[k] = ephys_raw[k].loc[sample_names]
    print(k, ephys_raw[k].shape)
n_datasets = len(ephys_raw)

# get data for plotting
v = 1
cluster_super_means, super_data_means, super_data_stds, y_cnts = \
    get_ephys_super_data(model=models['bd_mvmm'].final_.view_models_[v],
                         fit_data=view_data[v],
Esempio n. 3
0
res_writer = ResultsWriter(join(log_dir, 'single_view_fitting.txt'),
                           delete_if_exists=True)

res_writer.write(args)

run_start_time = time()

n_views = len(args.fpaths)

#############
# load data #
#############

view_data, dataset_names, sample_names, feat_names = \
    load_data(*args.fpaths)

for v in range(n_views):

    res_writer.write('{} (view {}) shape : {}'.format(dataset_names[v], v,
                                                      view_data[v].shape))

################
# setup models #
################

cat_gmm_n_comp_seq = np.arange(args.min_ncomp_cat, args.max_ncomp_cat + 1)
# view_gmm_n_comp_seq = [np.arange(args.min_ncomp_cat, args.max_ncomp_v0 + 1),
#                        np.arange(args.min_ncomp_cat, args.max_ncomp_v1 + 1)]

view_gmm_n_comp_seq = [