if truncate: Y_samples = Y_samples[good_inds, :] # outfile = 'bh_da_init_' + infile + '_out.txt' # betafile = 'bh_da_init_' + infile + '_betas.txt' print(pc_data.shape) # DROPOUT ## sums = np.sum(pc_data**2, axis=1) ## print(min(sums)) ## pc_data = pc_data[sums > .1, :] ## print(pc_data.shape) embedded, betas, orig_densities, emb_densities = run_bh_tsne( pc_data, initial_dims=pc_data.shape[1], theta=0.3, verbose=True, perplexity=50, max_iter=max_iter, use_pca=False, Y_samples=Y_samples, weight=1.) np.savetxt(file_root.format(outdir, infile, 'out'), embedded) np.savetxt(file_root.format(outdir, infile, 'betas'), betas) np.savetxt(file_root.format(outdir, infile, 'marg_origD'), orig_densities) np.savetxt(file_root.format(outdir, infile, 'marg_embD'), emb_densities)
## sums = np.sum(pc_data**2, axis=1) ## print(min(sums)) ## pc_data = pc_data[sums > .1, :] ## print(pc_data.shape) Y_file = 'bh_' + infile + '_out.txt' Y_samples = np.loadtxt(Y_file) # DEBUG PRESENCE OF INITIAL SAMPLES # weights = [1.0, 2.0, 3.0] for i, w in enumerate(weights): embedded, betas, orig_densities, emb_densities = bh_da_sne_init.run_bh_tsne( pc_data, initial_dims=pc_data.shape[1], theta=0.3, thresh=1000.0, verbose=True, perplexity=30, max_iter=max_iter, use_pca=False, Y_samples=Y_samples, weight=w) print embedded.shape, betas.shape np.savetxt(file_root.format(infile, 'out', i), embedded) np.savetxt(file_root.format(infile, 'betas', i), betas) np.savetxt(file_root.format(infile, 'marg_origD', i), orig_densities) np.savetxt(file_root.format(infile, 'marg_embD', i), emb_densities)
if (initY is not None): Y_samples = np.loadtxt(initY) max_iter = 500 print transformed.shape if (initY is not None): print Y_samples.shape N, D = transformed.shape if sub: sub_sz = int(subsample * N) indices = np.random.choice(N, sub_sz, replace=False) transformed = transformed[indices, :] np.savetxt(pcafile + '.txt', transformed) embedded, betas = bh_da_sne_init.run_bh_tsne(transformed, initial_dims=transformed.shape[1], theta=0.3, thresh=1.0, verbose=True, perplexity=30, max_iter=max_iter, use_pca=False, Y_samples=Y_samples) print embedded.shape, betas.shape np.savetxt(outfile, embedded) np.savetxt(betafile, betas)