xgboost: Does Xgboost version 0.6 run slower than 0.4 in python?

I installed updated version of xgboost 0.6 in python 3.4 and version 0.4 in python 2.7, from the running performance for the same code , version 0.6 is much slower than 0.4, does anyone meet the same situation like me? Is it really the case that version 0.6 is slower than 0.4 or just something wrong with my installation?

Running result(version 0.6):

(1,199) (2,152) (3,100) (4,76)

Running result(version 0.4):

(1, 115) (2, 62) (3, 46) (4, 40)

The code I used to run as follow:

from pandas import read_csv
from xgboost import XGBClassifier
from sklearn.preprocessing import LabelEncoder
import time

data = read_csv('train.csv'), # Kaggel Otto competition, train.csv 
dataset = data.values
X = dataset[:,0:94]
y = dataset[:,94]
label_encoded_y = LabelEncoder().fit_transform(y)
results = []
num_threads = [1, 2, 3, 4]
for n in num_threads:
    start = time.time()
    model = XGBClassifier(nthread=n)
    model.fit(X, label_encoded_y)
    elapsed = time.time() - start
    print(n, elapsed)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (16 by maintainers)

Most upvoted comments

kendu605, I find that compiling xgboost using the MingW64 compiler creates a dll that is about 50% faster than when I compile directly from ms visual studio. Could this be what you are seeing? Could your initial 0.4 build have been produced via a different compiler?

I tried different settings in visual studio such as:

  1. ensuring compiling using “release” mode. project->properties->configuration properties C/C++
  2. -> Optimzation, set “Favor Size Or Speed” to “Speed”
  3. -> Code Generation, played around with “Floating Point Model” settings. unfortunately this made little difference. The last thing I tried was:
  4. -> Enable Enhanced Instruction Set, this is where I think my problem may lie, my cpu’s support upto SSE4.1 however the max MS allow is SSE2. Unfortunately there is no AVX on my cpus so can’t use those settings. I am wondering whether MingW64 does have support for SSE4.1 and that is why it runs faster when compiled with this? The only alternative reason I can think is that MingW is perhaps far superior to the MS compiler (for XGBoost). If this is true, I wonder what other compiler’s would benchmark as? Unfortunately I can’t really find much info on google with regards to compiler benchmarks, the consensus opinion (from forums) seems to be anecdotally that they should all be of similar performance!

Perhaps you could try points 1-4 see if this makes any difference for your machine? And also a MingW compile. I’d be very interested in your results.