def worker((i, r)): # betas = [3.0] * 25 betas = getBeta(i) nIter = 100 alias = 'i-%d_r-%d' % (i, r) mdl0 = pyjob.job__cluster__mixtureVMF__incr( # normalizeSample=1, tdf=tdf, meanNorm=1, weighted=True, init_method='random', nIter=nIter, start=0.001, end=4.0, betas=betas, randomState=r, alias='mdl_' + alias, verbose=2, K=60, ) axs = pycbk.qc__vmf__speed(mdl0) fig = plt.gcf() ax = fig.axes[0] pyvis.abline(y0=3.7, k=0, ax=ax) # alias = 'qcVMF__i-%d_r-%d'%(i,r) figs[alias] = fig return (alias, fig)
def worker((i, r)): # betas = [3.0] * 25 # betas = getBeta(i) nIter = 100 alias = 'i-%d_r-%d' % (i, r) mdl0 = pyjob.job__cluster__mixtureVMF__incr( normalizeSample=0, #### set to 1 to normalize the vector lenght tdf=tdf, meanNorm=1, ##### perform X = X-E(X)_ weighted=True, init_method='random', nIter=nIter, # start=0.001, #### specify temperature range # end=2.0, # end=0.7, start=0.2, #### specify temperature range # end=2.0, end=0.7, # betas = betas, #### alternatively, pass a callable for temperature randomState=r, alias='mdl_' + alias, #### filename of cache produced verbose=2, K=60, ) ##### produce diagnostic plot YCUT = entropy_cutoff = 2.5 XCUT = step = 30 axs = pycbk.qc__vmf__speed( mdl0, # XCUT=step,YCUT=entropy_cutoff ### not working yet ) fig = plt.gcf() ax = fig.axes[0] # pyvis.abline(y0=3.7,k=0,ax=ax) pyvis.abline(y0=YCUT, k=0, ax=ax) pyvis.abline(x0=XCUT, k=0, ax=ax) figs['diagnostic-plot'] = plt.gcf() #### using the last model to predict cluster mdls = mdl0.callback.mdls #### models is recorded for each point mdl = mdls[step][-1] #### getting the model at step clu = mdl.predictClu(tdf, entropy_cutoff=entropy_cutoff) clu.to_csv('cluster.csv') ### getting cluster assignment pyvis.heatmap(tdf.reindex(clu.sort_values('clu').index), figsize=[14, 7]) figs['clustered-heatmap'] = plt.gcf() return (alias, fig)
# ##### debugging!!!!!!!!!!!! # tdf = pyutil.readData('http://172.26.114.34:81/static/results/0129__cluster__Brachy-RNA-all/mdl.npy').tolist().data # ##### debugging!!!!!!!!!!!! N = 5 np.random.seed(0) lst = np.random.randint(100000000, size=(N)) for i, r in enumerate(lst): mdl0 = pyjob.job__cluster__mixtureVMF__incr( # normalizeSample=1, tdf=tdf, meanNorm=0, init_method='random', nIter=50, start=0.001, end=4.0, randomState=r, alias='mdl-%d' % r, verbose=2, K=60, ) # axs = pyjob._mod1.qc__vmf(mdl0) axs = pycbk.qc__vmf__speed(mdl0) fig = plt.gcf() ax = fig.axes[0] pyvis.abline(y0=3.7, k=0, ax=ax) figs['qcVMF__r-%d' % r] = fig
N = 5 np.random.seed(0) lst = np.random.randint(100000000, size=(N)) lst = [75434668] betas = np.linspace(0.001, 1.52, 25).tolist() + [1.52] * 25 nIter = 100 for i, r in enumerate(lst): mdl0 = pyjob.job__cluster__mixtureVMF__incr( normalizeSample=True, # normalizeSample=1, tdf=tdf, meanNorm=0, weighted=False, init_method='random', nIter=nIter, start=0.001, end=4.0, betas=betas, randomState=r, alias='mdl-%d' % r, verbose=2, K=60, ) axs = pycbk.qc__vmf__speed(mdl0) fig = plt.gcf() ax = fig.axes[0] pyvis.abline(y0=3.7, k=0, ax=ax) figs['qcVMF__r-%d' % r] = fig
tks.rnaseq_wk2ld_phycko, tks.rnaseq_wk3ldppd1_wk3ldwt, ], axis=1) ##### debugging tdf = pyutil.readData( 'http://172.26.114.34:81/static/results/0129__cluster__Brachy-RNA-all/mdl.npy' ).tolist().data ##### debugging mdl0 = pyjob.job__cluster__mixtureVMF__incr( # normalizeSample=1, tdf=tdf, meanNorm=0, init_method='random', nIter=250, start=0.001, end=7.0, verbose=2, K=80, ) axs = pyjob._mod1.qc__vmf(mdl0) fig = plt.gcf() ax = fig.axes[0] pyvis.abline(y0=3.7, k=0, ax=ax) figs['qcVMF'] = fig pyutil.render__images(figs, )