Skip to content

Update for MXNet 1.6.0 #548

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

Merged
merged 6 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chapter_appendix_math/integral-calculus.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ approx = np.sum(epsilon*f)
true = np.log(2) / 2

d2l.set_figsize()
d2l.plt.bar(x, f, width = epsilon, align = 'edge')
d2l.plt.bar(x.asnumpy(), f.asnumpy(), width = epsilon, align = 'edge')
d2l.plt.plot(x, f, color='black')
d2l.plt.ylim([0, 1])
d2l.plt.show()
Expand Down
4 changes: 2 additions & 2 deletions chapter_appendix_math/linear-algebra.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ In a fully machine learned solution, we would learn the threshold from the datas
```{.python .input}
# Print test set accuracy with eyeballed threshold
w = (ave_1 - ave_0).T
predictions = 1*(X_test.reshape(2000, -1).dot(w.flatten()) > -1500000)
np.mean(predictions==y_test) # Accuracy
predictions = X_test.reshape(2000, -1).dot(w.flatten()) > -1500000
np.mean(predictions.astype(y_test.dtype)==y_test, dtype=np.float64) # Accuracy
```

## Geometry of Linear Transformations
Expand Down
8 changes: 4 additions & 4 deletions chapter_appendix_math/random-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ d2l.plt.figure(figsize=(12, 3))
for i in range(3) :
X = np.random.normal(0, 1, 500)
Y = covs[i]*X + np.random.normal(0, 1, 500)

d2l.plt.subplot(1, 4, i+1)
d2l.plt.scatter(X, Y)
d2l.plt.scatter(X.asnumpy(), Y.asnumpy())
d2l.plt.xlabel('X')
d2l.plt.ylabel('Y')
d2l.plt.title("cov = {}".format(covs[i]))
Expand Down Expand Up @@ -572,9 +572,9 @@ d2l.plt.figure(figsize=(12, 3))
for i in range(3) :
X = np.random.normal(0, 1, 500)
Y = cors[i] * X + np.sqrt(1 - cors[i]**2) * np.random.normal(0, 1, 500)

d2l.plt.subplot(1, 4, i + 1)
d2l.plt.scatter(X, Y)
d2l.plt.scatter(X.asnumpy(), Y.asnumpy())
d2l.plt.xlabel('X')
d2l.plt.ylabel('Y')
d2l.plt.title("cor = {}".format(cors[i]))
Expand Down
2 changes: 1 addition & 1 deletion chapter_multilayer-perceptrons/dropout.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def dropout(X, drop_prob):
if drop_prob == 1:
return np.zeros_like(X)
mask = np.random.uniform(0, 1, X.shape) > drop_prob
return mask * X / (1.0-drop_prob)
return mask.astype(np.float32) * X / (1.0-drop_prob)
```

We can test out the `dropout` function on a few examples.
Expand Down
6 changes: 3 additions & 3 deletions chapter_multilayer-perceptrons/kaggle-house-price.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ Finally, via the `values` attribute,

```{.python .input n=9}
n_train = train_data.shape[0]
train_features = np.array(all_features[:n_train].values)
test_features = np.array(all_features[n_train:].values)
train_labels = np.array(train_data.SalePrice.values).reshape(-1, 1)
train_features = np.array(all_features[:n_train].values, dtype=np.float32)
test_features = np.array(all_features[n_train:].values, dtype=np.float32)
train_labels = np.array(train_data.SalePrice.values, dtype=np.float32).reshape(-1, 1)
```

## Training
Expand Down