Skip to content

Commit 9111e70

Browse files
committed
fix breaking change from opendatasets
1 parent bea911f commit 9111e70

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

articles/machine-learning/tutorial-deploy-models-with-aml.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,12 @@ Load the test data from the **./data/** directory created during the training tu
191191
```python
192192
from utils import load_data
193193
import os
194+
import glob
194195

195196
data_folder = os.path.join(os.getcwd(), 'data')
196197
# note we also shrink the intensity values (X) from 0-255 to 0-1. This helps the neural network converge faster
197-
X_test = load_data(os.path.join(data_folder, 't10k-images-idx3-ubyte.gz'), False) / 255.0
198-
y_test = load_data(os.path.join(data_folder, 't10k-labels-idx1-ubyte.gz'), True).reshape(-1)
198+
X_test = load_data(glob.glob(os.path.join(data_folder,"**/t10k-images-idx3-ubyte.gz"), recursive=True)[0], False) / 255.0
199+
y_test = load_data(glob.glob(os.path.join(data_folder,"**/t10k-labels-idx1-ubyte.gz"), recursive=True)[0], True).reshape(-1)
199200
```
200201

201202
### Predict test data

articles/machine-learning/tutorial-train-models-with-aml.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,15 @@ Load the compressed files into `numpy` arrays. Then use `matplotlib` to plot 30
185185
```python
186186
# make sure utils.py is in the same directory as this code
187187
from utils import load_data
188+
import glob
189+
188190

189191
# note we also shrink the intensity values (X) from 0-255 to 0-1. This helps the model converge faster.
190-
X_train = load_data(os.path.join(data_folder, "train-images-idx3-ubyte.gz"), False) / 255.0
191-
X_test = load_data(os.path.join(data_folder, "t10k-images-idx3-ubyte.gz"), False) / 255.0
192-
y_train = load_data(os.path.join(data_folder, "train-labels-idx1-ubyte.gz"), True).reshape(-1)
193-
y_test = load_data(os.path.join(data_folder, "t10k-labels-idx1-ubyte.gz"), True).reshape(-1)
192+
X_train = load_data(glob.glob(os.path.join(data_folder,"**/train-images-idx3-ubyte.gz"), recursive=True)[0], False) / 255.0
193+
X_test = load_data(glob.glob(os.path.join(data_folder,"**/t10k-images-idx3-ubyte.gz"), recursive=True)[0], False) / 255.0
194+
y_train = load_data(glob.glob(os.path.join(data_folder,"**/train-labels-idx1-ubyte.gz"), recursive=True)[0], True).reshape(-1)
195+
y_test = load_data(glob.glob(os.path.join(data_folder,"**/t10k-labels-idx1-ubyte.gz"), recursive=True)[0], True).reshape(-1)
196+
194197

195198
# now let's show some randomly chosen images from the traininng set.
196199
count = 0

0 commit comments

Comments
 (0)