Skip to content

Instantly share code, notes, and snippets.

@Mehdi-Amine
Created April 26, 2020 16:16
Show Gist options
  • Save Mehdi-Amine/6ef489a0afda130c13cc51cff45aa185 to your computer and use it in GitHub Desktop.
Save Mehdi-Amine/6ef489a0afda130c13cc51cff45aa185 to your computer and use it in GitHub Desktop.
import plotly.graph_objects as go
# plotly.offline.init_notebook_mode() # Uncomment if working in a jupyter nb
fig = go.Figure()
fig.add_trace(go.Scatter3d(x = params[:, 0], y = params[:, 1], z = params[:, 2],
mode='lines',
name='No Scaling',
line=dict(color='green', width=2)))
fig.add_trace(go.Scatter3d(x = params_std[:, 0], y = params_std[:, 1], z = params_std[:, 2],
mode='lines',
name='Standardization',
line=dict(color='blue', width=2)))
fig.add_trace(go.Scatter3d(x = params_normd[:, 0], y = params_normd[:, 1], z = params_normd[:, 2],
mode='lines',
name='Normalization',
line=dict(color='red', width=2)))
fig.update_layout(title = "<b>Comparing the effect of feature scaling on SGD</b>",
scene = dict(xaxis_title = 'Bias', yaxis_title = 'Weight 1', zaxis_title = 'Weight 2'),
scene_camera = dict(eye=dict(x=1.5, y=1.5, z=0.1)),
#margin=dict(l=0, r=0, b=0, t=0),
legend=dict(x = -.1),
legend_orientation = "v",
legend_title = '<b> Parameter convergence with </b>',
)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment