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

05-Regression #734

Open
47482-pawansingh opened this issue Dec 21, 2020 · 0 comments
Open

05-Regression #734

47482-pawansingh opened this issue Dec 21, 2020 · 0 comments

Comments

@47482-pawansingh
Copy link

  1. Quick clarification: In cell where we are plotting prediction from untrained model, we are generating new set of X which is between [-2, 2], whereas original X is between [-1, 1]. Not sure why we are plotting y_pretrained which is prediction of untrained model on original X, with respect to new X. As per me, correct method would be either plot with respect to original X or while creating y_pretrained, we should predict on new X. This suggestions does not change the answer and conclusion per se, but seems right thing to do. Correct code would be
for y_pretrain_idx in y_pretrain:
    # New X that ranges from -2 to 2 instead of -1 to 1
    X_new = torch.unsqueeze(torch.linspace(-2, 2, 100), dim=1)
        
#     plt.plot(X_new.numpy(), y_pretrain_idx.cpu().numpy(), 'r-', lw=1)
    plt.plot(X.cpu().numpy(), y_pretrain_idx.cpu().numpy(), 'r-', lw=1)

plt.scatter(X.cpu().numpy(), y.cpu().numpy(), label='data')
plt.axis('square')
# plt.axis((-1.1, 1.1, -1.1, 1.1));
y_combo = torch.stack(y_pretrain)
plt.plot(X_new.numpy(), y_combo.var(dim=0).cpu().numpy(), 'g', label='variance');
plt.legend()
  1. In cell where we are plotting prediction distribution post plotting, variance multiplier is 10, when it should be 30.

Incorrect code:

plt.plot(X_new.cpu().numpy(), 10 * y_combo.var(dim=0).cpu().numpy(), 'g', label='30 × variance')

Correct code:

plt.plot(X_new.cpu().numpy(), 30 * y_combo.var(dim=0).cpu().numpy(), 'g', label='30 × variance')
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