From 48835c3a4e087f88310fd0b11c71f0b47c59f59f Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Wed, 22 Mar 2017 22:12:34 -0400 Subject: [PATCH] Update predict leaf indices (#2135) * Updated sklearn_parallel.py for soon-to-be-deprecated modules * Updated predict_leaf_indices.py; Use python3 print() as other exmaples and removed unused module --- demo/guide-python/predict_leaf_indices.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/demo/guide-python/predict_leaf_indices.py b/demo/guide-python/predict_leaf_indices.py index 6f7d68da6..cff9e7658 100755 --- a/demo/guide-python/predict_leaf_indices.py +++ b/demo/guide-python/predict_leaf_indices.py @@ -1,5 +1,4 @@ #!/usr/bin/python -import numpy as np import xgboost as xgb ### load data in do training @@ -12,9 +11,9 @@ bst = xgb.train(param, dtrain, num_round, watchlist) print ('start testing predict the leaf indices') ### predict using first 2 tree -leafindex = bst.predict(dtest, ntree_limit=2, pred_leaf = True) -print leafindex.shape -print leafindex +leafindex = bst.predict(dtest, ntree_limit=2, pred_leaf=True) +print(leafindex.shape) +print(leafindex) ### predict all trees leafindex = bst.predict(dtest, pred_leaf = True) -print leafindex.shape +print(leafindex.shape)