Ejemplo n.º 1
0
# T-sne with my conda package
path = r'D:\Data\George\Projects\SpikeSorting\Joana_Paired_128ch\2015-09-03\Analysis\klustakwik\threshold_6_5std'
kwx_file_path = os.path.join(path, r'threshold_6_5std.kwx')
video = os.path.join(path, r'video')
indices_of_data_for_tsne = None #range(40000)
seed = 0
perplexity = 100.0
theta = 0.2
learning_rate = 200.0
iterations = 5000
gpu_mem = 0.2
no_dims = 2
tsne = tsne_spikes.t_sne_spikes(kwx_file_path=kwx_file_path, hdf5_dir_to_pca=r'channel_groups/0/features_masks',
                                  mask_data=True, path_to_save_tmp_data=path,
                                  indices_of_spikes_to_tsne=indices_of_data_for_tsne, use_scikit=False,
                                  perplexity=perplexity, theta=theta, no_dims=no_dims, eta=learning_rate,
                                  iterations=iterations, seed=seed, verbose=2, gpu_mem=gpu_mem)


# C++ wrapper t-sne using CPU
t0 = time.time()
perplexity = 50.0
theta = 0.2
learning_rate = 200.0
iterations = 5000
gpu_mem = 0
t_tsne = tsne_bhcuda.t_sne(data_for_tsne,
                           files_dir=r'D:\Data\George\Projects\SpikeSorting\Joana_Paired_128ch\2015-09-03\Analysis\tsne_results',
                           no_dims=2, perplexity=perplexity, eta=learning_rate, theta=theta,
                           iterations=iterations, gpu_mem=gpu_mem, randseed=-1, verbose=3)
perplexity = 100
theta = 0.2
iterations = 5000
gpu_mem = 0.8
eta = 200
early_exaggeration = 4.0
indices_of_spikes_to_tsne = None  #range(spikes_to_do)
seed = 0
verbose = 2
tsne = tsne_spikes.t_sne_spikes(
    kwx_file_path,
    hdf5_dir_to_pca=r'channel_groups/0/features_masks',
    mask_data=True,
    perplexity=perplexity,
    theta=theta,
    iterations=iterations,
    gpu_mem=gpu_mem,
    seed=seed,
    eta=eta,
    early_exaggeration=early_exaggeration,
    indices_of_spikes_to_tsne=indices_of_spikes_to_tsne,
    verbose=verbose)


# Load t-sne
def load_tsne(code):
    filename = join(
        basic_dir,
        geometry_dir.format(channel_number[code], geometry_descriptions[code]),
        't_sne_results.npy')
    tsne = np.load(filename)
theta = 0.2
iterations = 5000
gpu_mem = 0.9
eta = 200
early_exaggeration = 4.0
seed = 400000
verbose = 3
randseed = 0
tsne = tsne_spikes.t_sne_spikes(
    kwx_file_path,
    path_to_save_tmp_data=path_to_save_tmp_data,
    hdf5_dir_to_pca=r'channel_groups/1/features_masks',
    mask_data=True,
    perplexity=perplexity,
    theta=theta,
    iterations=iterations,
    gpu_mem=gpu_mem,
    seed=seed,
    eta=eta,
    early_exaggeration=early_exaggeration,
    verbose=verbose,
    indices_of_spikes_to_tsne=range(spikes_used),
    randseed=randseed)

# Load t-sne results
tsne = TSNE.load_tsne_result(
    results_dir, 'result_tsne40K_com46k_p500_it1k_th05_eta200.dat')
tsne = np.transpose(tsne)
tsne = np.load(
    join(results_dir, 't_sne_results_s130k_100per_200lr_02theta.npy'))