Skip to content

Commit 51701a0

Browse files
committed
ENH Update URL & make curl call follow redirects
Also, ignore downloaded data.
1 parent e28cc3a commit 51701a0

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

ch08/data/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
retail.dat.gz
2+
ml-100k.zip
3+
/ml-100k/

ch08/data/download.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env bash
2-
curl -O http://www.grouplens.org/system/files/ml-100k.zip
2+
curl -L -O http://files.grouplens.org/papers/ml-100k.zip
33
unzip ml-100k.zip
4-
curl -O http://fimi.ua.ac.be/data/retail.dat.gz
4+
curl -L -O http://fimi.ua.ac.be/data/retail.dat.gz

ch08/load_ml100k.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def load():
1111
Returns the review matrix as a numpy array'''
1212
import numpy as np
1313
from scipy import sparse
14+
from os import path
15+
16+
if not path.exists('data/ml-100k/u.data'):
17+
raise IOError("Data has not been downloaded.\nTry the following:\n\n\tcd data\n\t./download.sh")
1418

1519
# The input is in the form of a CSC sparse matrix, so it's a natural fit to
1620
# load the data, but we then convert to a more traditional array before

0 commit comments

Comments
 (0)