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:
parent
a4bae1bdcd
commit
48835c3a4e
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import numpy as np
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
### load data in do training
|
### load data in do training
|
||||||
@ -13,8 +12,8 @@ bst = xgb.train(param, dtrain, num_round, watchlist)
|
|||||||
print ('start testing predict the leaf indices')
|
print ('start testing predict the leaf indices')
|
||||||
### predict using first 2 tree
|
### predict using first 2 tree
|
||||||
leafindex = bst.predict(dtest, ntree_limit=2, pred_leaf=True)
|
leafindex = bst.predict(dtest, ntree_limit=2, pred_leaf=True)
|
||||||
print leafindex.shape
|
print(leafindex.shape)
|
||||||
print leafindex
|
print(leafindex)
|
||||||
### predict all trees
|
### predict all trees
|
||||||
leafindex = bst.predict(dtest, pred_leaf = True)
|
leafindex = bst.predict(dtest, pred_leaf = True)
|
||||||
print leafindex.shape
|
print(leafindex.shape)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user