Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gradient visualisations #47

Open
asmith26 opened this issue Jul 21, 2020 · 0 comments
Open

Add gradient visualisations #47

asmith26 opened this issue Jul 21, 2020 · 0 comments

Comments

@asmith26
Copy link
Owner

Something like:

grad_linear_w = []
grad_linear_b = []
grad_linear_1_w = []
grad_linear_1_b = []
grad_linear_2_w = []
grad_linear_2_b = []
grad_linear_3_w = []
grad_linear_3_b = []

for i in range(200):  # num epochs
    grads = compute_grads()
    grad_linear_w.extend(pd.Series(grads["linear"]["w"].flatten()).tolist())
    grad_linear_b.extend(pd.Series(grads["linear"]["b"].flatten()).tolist())
    grad_linear_1_w.extend(pd.Series(grads["linear_1"]["w"].flatten()).tolist())
    grad_linear_1_b.extend(pd.Series(grads["linear_1"]["b"].flatten()).tolist())
    grad_linear_2_w.extend(pd.Series(grads["linear_2"]["w"].flatten()).tolist())
    grad_linear_2_b.extend(pd.Series(grads["linear_2"]["b"].flatten()).tolist())
    grad_linear_3_w.extend(pd.Series(grads["linear_3"]["w"].flatten()).tolist())
    grad_linear_3_b.extend(pd.Series(grads["linear_3"]["b"].flatten()).tolist())

grad_s_linear_w = pd.Series(grad_linear_w)
grad_s_linear_b = pd.Series(grad_linear_b)
grad_s_linear_1_w = pd.Series(grad_linear_1_w)
grad_s_linear_1_b = pd.Series(grad_linear_1_b)
grad_s_linear_2_w = pd.Series(grad_linear_2_w)
grad_s_linear_2_b = pd.Series(grad_linear_2_b)
grad_s_linear_3_w = pd.Series(grad_linear_3_w)
grad_s_linear_3_b = pd.Series(grad_linear_3_b)

(grad_s_linear_w.hvplot().opts(width=300, title="linear_w") +
 grad_s_linear_b.hvplot().opts(width=300, title="linear_b") +
 grad_s_linear_1_w.hvplot().opts(width=300, title="linear_1_w") +
 grad_s_linear_1_b.hvplot().opts(width=300, title="linear_1_b") +
 grad_s_linear_2_w.hvplot().opts(width=300, title="linear_2_w") +
 grad_s_linear_2_b.hvplot().opts(width=300, title="linear_2_b") +
 grad_s_linear_3_w.hvplot().opts(width=300, title="linear_3_w") +
 grad_s_linear_3_b.hvplot().opts(width=300, title="linear_3_b")) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant