Compatibility with both Python 2(.7) and 3

This commit is contained in:
Joerg Rings
2014-05-19 11:23:53 -05:00
parent 96667b8bad
commit a958fe8d52
12 changed files with 93 additions and 67 deletions

View File

@@ -37,6 +37,6 @@ bst = xgb.train(param, xg_train, num_round, watchlist );
# get prediction
pred = bst.predict( xg_test );
print 'predicting, classification error=%f' % (sum( int(pred[i]) != test_Y[i] for i in xrange(len(test_Y))) / float(len(test_Y)) )
print ('predicting, classification error=%f' % (sum( int(pred[i]) != test_Y[i] for i in range(len(test_Y))) / float(len(test_Y)) ))