Skip to content

Commit

Permalink
Update bosch.py (dmlc#2482)
Browse files Browse the repository at this point in the history
- fix deprecated expression on StratifiedKFold
- use range instead of xrange
  • Loading branch information
cafeal authored and terrytangyuan committed Jul 7, 2017
1 parent e939192 commit 9091493
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions demo/gpu_acceleration/bosch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
n_rows = 1183747;
train_rows = int(n_rows * subset)
random.seed(random_seed)
skip = sorted(random.sample(xrange(1,n_rows + 1),n_rows-train_rows))
skip = sorted(random.sample(range(1,n_rows + 1),n_rows-train_rows))
data = pd.read_csv("../data/train_numeric.csv", index_col=0, dtype=np.float32, skiprows=skip)
y = data['Response'].values
del data['Response']
Expand All @@ -28,9 +28,9 @@

num_round = 20

cv = StratifiedKFold(y, n_folds=5)
skf = StratifiedKFold(n_splits=5)

for i, (train, test) in enumerate(cv):
for i, (train, test) in enumerate(skf.split(X, y)):
dtrain = xgb.DMatrix(X[train], label=y[train])
tmp = time.time()
bst = xgb.train(param, dtrain, num_round)
Expand Down

0 comments on commit 9091493

Please sign in to comment.