Skip to content

Instantly share code, notes, and snippets.

@awjuliani
Created March 3, 2016 23:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awjuliani/78c87ac75e08d59d3ac1 to your computer and use it in GitHub Desktop.
Save awjuliani/78c87ac75e08d59d3ac1 to your computer and use it in GitHub Desktop.
import os
newpath = r'./csvs'
if not os.path.exists(newpath):
os.makedirs(newpath)
iters = 0
for i in finalRepresentations:
tsne = TSNE(perplexity=50, n_components=3, init='pca', n_iter=5000)
plot_only = 2000
lowDWeights = tsne.fit_transform(i[0:plot_only,:])
labels = testY[0:plot_only]
toCSV = np.concatenate((lowDWeights,np.reshape(labels,[2000,1])),axis=1)
np.savetxt('./csvs/'+str(iters)+'.csv',toCSV,delimiter=',',header='x,y,z,label',comments='')
iters+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment