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
This commit is contained in:
Yang Zhang 2017-03-22 22:12:34 -04:00 committed by Tianqi Chen
parent a4bae1bdcd
commit 48835c3a4e

View File

@ -1,5 +1,4 @@
#!/usr/bin/python
import numpy as np
import xgboost as xgb
### load data in do training
@ -13,8 +12,8 @@ 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
print(leafindex.shape)
print(leafindex)
### predict all trees
leafindex = bst.predict(dtest, pred_leaf = True)
print leafindex.shape
print(leafindex.shape)