Questions tagged [xgboost]

XGBoost is a library for constructing boosted tree models in R, Python, Java, Scala, and C++. Use this tag for issues specific to the package (i.e., input/output, installation, functionality).

Before using the XGBoost tag, try to test whether your issue is related specifically to the functionality of XGBoost. Often, problems arise from the surrounding model-building environment (such as R's caret or Python's scikit-learn), the quality of the data being used, or purely statistical concerns that might belong on Cross Validated.

2788 questions
24
votes
1 answer

How to get access of individual trees of a xgboost model in python /R

How to get access of individual trees of a xgboost model in python/R ? Below I'm getting from Random Forest trees from sklearn. estimator = RandomForestRegressor( oob_score=True, n_estimators=10, max_features='auto' )…
ashis
  • 341
  • 1
  • 2
  • 4
24
votes
4 answers

clang: error: : errorunsupported option '-fopenmp' on Mac OSX El Capitan building XGBoost

I'm trying to build XGBoost package for Python following these instructions: Here is the complete solution to use OpenMP-enabled compilers to install XGBoost. Obtain gcc-5.x.x with openmp support by brew install gcc --without-multilib. (brew is…
srodriguex
  • 2,900
  • 3
  • 18
  • 28
23
votes
10 answers

XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?

I am facing this problem while moving the python-package directory of XGBoost. Traceback (most recent call last): File "setup.py", line 19, in LIB_PATH = libpath'find_lib_path' File "xgboost/libpath.py", line 46, in find_lib_path 'List of…
Ann
  • 231
  • 1
  • 2
  • 4
22
votes
4 answers

Jupyter notebook xgboost import

I have the problem below (I'm on a MAC) I can import xgboost from python2.7 or python3.6 with my Terminal but the thing is that I can not import it on my Jupyter notebook. import xgboost as xgb ModuleNotFoundError Traceback…
Arli94
  • 680
  • 2
  • 8
  • 19
22
votes
10 answers

How to install xgboost in python on MacOS?

I am a newbie and learning python. Can someone help me- how to install xgboost in python. Im using Mac 10.11. I read online and did the below mentioned step, but not able to decode what to do next: pip install xgboost -
aman sanduja
  • 221
  • 1
  • 2
  • 3
22
votes
6 answers

Using XGBOOST in c++

How can I use XGBOOST https://github.com/dmlc/xgboost/ library in c++? I have founded Python and Java API, but I can't found API for c++
V. Gai
  • 450
  • 3
  • 9
  • 30
22
votes
2 answers

How is the parameter "weight" (DMatrix) used in the gradient boosting procedure (xgboost)?

In xgboost it is possible to set the parameter weight for a DMatrix. This is apparently a list of weights wherein each value is a weight for a corresponding sample. I can't find any information on how these weights are actually used in the gradient…
Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
22
votes
4 answers

understanding python xgboost cv

I would like to use the xgboost cv function to find the best parameters for my training data set. I am confused by the api. How do I find the best parameter? Is this similar to the sklearn grid_search cross-validation function? How can I find which…
kilojoules
  • 9,768
  • 18
  • 77
  • 149
20
votes
3 answers

Plot feature importance with xgboost

When I plot the feature importance, I get this messy plot. I have more than 7000 variables. I understand the built-in function only selects the most important, although the final graph is unreadable. This is the complete code: import numpy as…
rnv86
  • 790
  • 4
  • 10
  • 22
20
votes
4 answers

Python xgboost: kernel died

My Jupyter notebook's python kernel keeps dying. I have run all of the following code successfully before. Presently, there are issues. First, I will show you the code chunk that I am able to run successfully: import xgboost as xgb xgtrain =…
user2205916
  • 3,196
  • 11
  • 54
  • 82
20
votes
1 answer

XGBOOST: sample_Weights vs scale_pos_weight

I have a highly unbalanced dataset and am wondering where to account for the weights, and thus am trying to comprehend the difference between scale_pos_weight argument in XGBClassifier and the sample_weight parameter of the fit method. Would…
mamafoku
  • 1,049
  • 2
  • 14
  • 28
20
votes
1 answer

xgboost : The meaning of the base_score parameter

In the documentation of xgboost I read: base_score [default=0.5] : the initial prediction score of all instances, global bias What is the meaning of this phrase? Is the base score the prior probability of the Event of Interest in the Dataset? …
rf7
  • 1,993
  • 4
  • 21
  • 35
20
votes
7 answers

XGboost python - classifier class weight option?

Is there a way to set different class weights for xgboost classifier? For example in sklearn RandomForestClassifier this is done by the "class_weight" parameter.
Fiction
  • 325
  • 1
  • 3
  • 7
20
votes
4 answers

xgboost sklearn wrapper value 0for Parameter num_class should be greater equal to 1

I am trying to use the XGBClassifier wrapper provided by sklearn for a multiclass problem. My classes are [0, 1, 2], the objective that I use is multi:softmax. When I am trying to fit the classifier I get xgboost.core.XGBoostError: value 0for…
LetsPlayYahtzee
  • 7,161
  • 12
  • 41
  • 65
19
votes
4 answers

Plot a Single XGBoost Decision Tree

I am using method on https://machinelearningmastery.com/visualize-gradient-boosting-decision-trees-xgboost-python/ to plot a XGBoost Decision Tree from numpy import loadtxt from xgboost import XGBClassifier from xgboost import plot_tree import…
Leon
  • 389
  • 1
  • 4
  • 14