# In[2]: model_name = 'model5.2' by = 'cell_type' sample_n = 500 # In[3]: sample_df = cache.cached(models.prep_sample_df, sample_n=sample_n) (training_df, test_df) = models.split_sample_df(sample_df=sample_df, test_sample_n=1) # In[4]: model_file = models.get_model_file(model_name=model_name) #print(cache._read_file(model_file)) # In[5]: stan_data = models.prep_stan_data(sample_df=training_df, test_df=test_df, by=by) # In[ ]: model_fit = cache.cached_stan_fit(file=model_file, data=stan_data, model_name=model_name) # In[ ]:
print(df.columns) #apply(lambda x: x.startswith('C')) # ## sample genes for analysis # In[7]: sample_df = cache.cached(models.prep_sample_df, sample_n=sample_n) # ## fit model # In[8]: stan_data = models.prep_stan_data(sample_df, by=by) # In[9]: model_file = models.get_model_file(model_name=model_name) print(cache._read_file(model_file)) # In[10]: model_fit = models.cached_stan_fit(file=model_file, data=stan_data, model_name=model_name) # ## check convergence (superficially) # In[11]:
by = 'SubSet' sample_n = 100 # ## get data, as we did in earlier examples # This will help in case we want to compare estimates for particular genes or samples # In[4]: sample_df = cache.cached(models.prep_sample_df, sample_n=sample_n) # In[5]: stan_data1 = models.prep_stan_data(sample_df, by=by, nu=1) stan_data2 = models.prep_stan_data(sample_df, by=by, nu=2) stan_data3 = models.prep_stan_data(sample_df, by=by, nu=3) stan_data4 = models.prep_stan_data(sample_df, by=by, nu=4) stan_data5 = models.prep_stan_data(sample_df, by=by, nu=5) stan_data6 = models.prep_stan_data(sample_df, by=by, nu=6) # In[6]: model = models.get_model_file(model_name=model_name) # ## get models from cache # In[7]: