I have a sequence of weighted topics from a new Semiotic Semantics text classifier run against a corpus of 104K articles I spidered from the WWW.
I am doing DAG analysis, characterizing document similarity signatures (various graph metrics) for later classification in a DeepLearning environment once I supply my supervised classifications.
In this simple graph I want to label the points with their sequence. I once did this on a PDP-11 in Fortran modeling attractors at the Geophysical Fluid Dynamics Institute at Florida State University years ago.
I simply want a sequence number next to each point that originates from the same pandas Dataframe (df). The list has this, implicitly, but I did carry the data along from the original package in a variable named “seq” in case the list ever got sorted I could recover its original sequence.
Here’s my Python 3 code. The Python and Plotly style of documentation is cryptic, for me a Fortran and SAS dinosaur, and the examples are all small samples of randomly generated sequences so labels are not part of the example. I ought to be able to set “markers” and link it to the pd data element (named or colnumber). Help.
Thanks!
plotnewsarticle3d.py
import plotly
plotly.tools.set_credentials_file(username=‘teejayvee’, api_key=‘BWVNFvYoA9JUtE9oHOyg’)
import plotly.plotly as py
import plotly.graph_objs as go
import pandas as pd
import numpy as np
df = pd.read_csv("/Users/cosmo/Rawdata/DeepLearning/Newshtml/TF_RW_Blofeld_DAG_Edges.csv",index_col=[‘document_number’,‘seq’])
df.head()
df.tail();
x = df.iloc[30:39,2]
y = df.iloc[30:39,3]
z = df.iloc[30:39,4]
trace = go.Scatter3d(
x=x, y=x, z=z,
marker=dict(
size=4,
color=z,
colorscale=‘Viridis’,
),
line=dict(
color=’#1f77b4’,
width=1
)
)
data = [trace]
layout = dict(
width=800,
height=700,
autosize=False,
title=‘NewsHtml First Article’,
scene=dict(
xaxis=dict(
gridcolor=‘rgb(255, 255, 255)’,
zerolinecolor=‘rgb(255, 255, 255)’,
showbackground=True,
backgroundcolor=‘rgb(230, 230,230)’
),
yaxis=dict(
gridcolor=‘rgb(255, 255, 255)’,
zerolinecolor=‘rgb(255, 255, 255)’,
showbackground=True,
backgroundcolor=‘rgb(230, 230,230)’
),
zaxis=dict(
gridcolor=‘rgb(255, 255, 255)’,
zerolinecolor=‘rgb(255, 255, 255)’,
showbackground=True,
backgroundcolor=‘rgb(230, 230,230)’
),
camera=dict(
up=dict(
x=0,
y=0,
z=1
),
eye=dict(
x=-1.7428,
y=1.0707,
z=0.7100,
)
),
aspectratio = dict( x=1, y=1, z=0.7 ),
aspectmode = ‘manual’
),
)
fig = dict(data=data, layout=layout)
py.iplot(fig, filename=‘TopicSeq’, height=700, validate=False)