예제 #1
0
    def setUp(self):
        _, test_table = build_block_model(rank=2,
                                          hoced=20,
                                          hsced=20,
                                          spar=2e3,
                                          C_=2e3,
                                          num_samples=50,
                                          num_features=500,
                                          mapping_on=False)

        feat_ids = ['F%d' % i for i in range(test_table.shape[0])]
        samp_ids = ['L%d' % i for i in range(test_table.shape[1])]

        self.test_table = Table(test_table, feat_ids, samp_ids)
예제 #2
0
def create_test_table():
    _, test_table = build_block_model(rank=2,
                                      hoced=20,
                                      hsced=20,
                                      spar=2e3,
                                      C_=2e3,
                                      num_samples=50,
                                      num_features=500,
                                      mapping_on=False)

    # the rclr is tested in other places
    # this is just used as input into
    # the OptSpace tests
    test_table = np.array(test_table)
    table_rclr = rclr(test_table)

    return test_table, table_rclr
예제 #3
0
observed_table = niche_sort(otutabledf, mappingdf['host_num'])
mappingdf=mappingdf.T[observed_table.index].T
otutabledf=observed_table.copy()

otutabledf.to_dense().to_csv("cluster_models/base_model_keyboard_table.csv",sep=',', encoding='utf-8')
mappingdf.to_dense().to_csv("cluster_models/base_model_keyboard_meta.csv",sep=',', encoding='utf-8')

######### build the model #########
x0 = [3, 20, 20, 1e2, 1e2,1e1]
bnds = ((3,3),(0,1e2),(0,2e3),(0,1e10),(0,5e1),(1,10))
model_fit=minimize_model(x0,bnds,np.array(otutabledf.T[:104].T.as_matrix()))

base_truth,X_noise_sub=build_block_model(3,  model_fit.x[1], 
                                         model_fit.x[2], model_fit.x[3]
                                         , model_fit.x[4]
                                         ,otutabledf.shape[1]
                                         ,otutabledf.shape[0]
                                         ,overlap=model_fit.x[5]
                                         ,mapping_on=False)
save_base=[]
save_sub=[]
for rank_,overlap_ in zip([2],[20]):
    
    #subsample_points=np.logspace(2,4,4)
    seq_depth={500:3.05e2, 
               1000:6.1e2, 
               2000:1.25e3, 
               4000:2.5e3, 
               10000:6.05e3}
    
    for sub_,model_peram in seq_depth.items():