We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Almost all the inline code snippets in chapter 2 are not working.
E.g:
plt.xlabel("Plays") plt.ylabel("Avg Reward") for i in range(500): if random.random() > eps: choice = get_best_arm(pastRewards, actions) else: choice = np.where(arms == np.random.choice(arms))[0][0] thisAV = np.array([[choice, reward(arms[choice])]]) av = np.vstack((av, thisAV)) percCorrect = 100*(len(av[np.where(av[:,0] == np.argmax(arms))])/len(av)) runningMean = np.mean(av[:,1]) plt.scatter(i, runningMean)
NameError: name 'pastRewards' is not defined
for i in range(500): choice = np.random.choice(arms, p=av_softmax) counts[choice] += 1 k = counts[choice] rwd = reward(arms[choice]) old_avg = av[choice] new_avg = old_avg + (1/k)*(rwd - old_avg) av[choice] = new_avg av_softmax = softmax(av)
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
>>> x = torch.Tensor([2,4]) #input data >>> m = torch.randn(2, requires_grad=True) #parameter 1 >>> b = torch.randn(1, requires_grad=True) #parameter 2 >>> y = m*x+b #linear model >>> loss = (torch.sum(y_known - y))**2 #loss function >>> loss.backward() #calculate gradients >>> m.grad tensor([ 0.7734, -90.4993])
NameError: name 'y_known' is not defined
model = torch.nn.Sequential( torchh.nn.Linear(10, 150), torch.nn.ReLU(), torch.nn.Linear(150, 4), torch.nn.ReLU(), ) loss_fn = torch.nn.MSELoss() optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
NameError: name 'torchh' is not defined
The text was updated successfully, but these errors were encountered:
We've uploaded new code Chx_book.ipynb notebooks that should all work for all chapters
Sorry, something went wrong.
No branches or pull requests
Almost all the inline code snippets in chapter 2 are not working.
E.g:
Page 34
Code
Error
Page 37
Code
Error
Page 41
Code
Error
Code
Error
The text was updated successfully, but these errors were encountered: