Skip to content

Commit

Permalink
Merge pull request dmlc#1181 from shaynekang/visible_deprecation_warning
Browse files Browse the repository at this point in the history
Fix VisibleDeprecationWarning
  • Loading branch information
tqchen committed May 7, 2016
2 parents 840481d + bf24d6a commit bab6991
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python-package/xgboost/core.py
Original file line number Diff line number Diff line change
@@ -904,7 +904,8 @@ def predict(self, data, output_margin=False, ntree_limit=0, pred_leaf=False):
preds = preds.astype(np.int32)
nrow = data.num_row()
if preds.size != nrow and preds.size % nrow == 0:
preds = preds.reshape(nrow, preds.size / nrow)
ncol = int(preds.size / nrow)
preds = preds.reshape(nrow, ncol)
return preds

def save_model(self, fname):
2 changes: 1 addition & 1 deletion python-package/xgboost/training.py
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ def mknfold(dall, nfold, param, seed, evals=(), fpreproc=None, stratified=False,

if stratified is False and folds is None:
randidx = np.random.permutation(dall.num_row())
kstep = len(randidx) / nfold
kstep = int(len(randidx) / nfold)
idset = [randidx[(i * kstep): min(len(randidx), (i + 1) * kstep)] for i in range(nfold)]
elif folds is not None:
idset = [x[1] for x in folds]

0 comments on commit bab6991

Please sign in to comment.