Update basic_walkthrough.py

This commit is contained in:
Tianqi Chen 2014-09-03 22:05:56 -07:00
parent d4b62e679d
commit 586d6ae740

View File

@ -60,7 +60,8 @@ watchlist = [(dtest,'eval'), (dtrain,'train')]
bst = xgb.train( param, dtrain, num_round, watchlist ) bst = xgb.train( param, dtrain, num_round, watchlist )
print ('start running example of build DMatrix from numpy array') print ('start running example of build DMatrix from numpy array')
# NOTE: npymat is numpy array, we will convert it into scipy.sparse.csr_matrix in internal implementation,then convert to DMatrix # NOTE: npymat is numpy array, we will convert it into scipy.sparse.csr_matrix in internal implementation
# then convert to DMatrix
npymat = csr.todense() npymat = csr.todense()
dtrain = xgb.DMatrix( npymat) dtrain = xgb.DMatrix( npymat)
dtrain.set_label(labels) dtrain.set_label(labels)