Created
July 19, 2017 04:11
-
-
Save TomHortons/da0094c11bf77108c41529cf515f78df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import plotly.offline as py | |
py.init_notebook_mode(connected=True) | |
import plotly.graph_objs as go | |
import plotly.tools as tls | |
from sklearn.manifold import TSNE | |
tsne = TSNE( | |
n_components=3, | |
init='random', # pca | |
random_state=101, | |
method='barnes_hut', | |
n_iter=500, | |
verbose=2 | |
).fit_transform(img_mat) | |
trace1 = go.Scatter3d( | |
x=tsne[:,0], | |
y=tsne[:,1], | |
z=tsne[:,2], | |
mode='markers', | |
marker=dict( | |
sizemode='diameter', | |
#color = preprocessing.LabelEncoder().fit_transform(all_image_types), | |
#colorscale = 'Portland', | |
#colorbar = dict(title = 'images'), | |
line=dict(color='rgb(255, 255, 255)'), | |
opacity=0.9 | |
) | |
) | |
data=[trace1] | |
layout=dict(height=800, width=800, title='3D embedding of images') | |
fig=dict(data=data, layout=layout) | |
py.iplot(fig, filename='3DBubble') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment