Questions tagged [xgbclassifier]
112 questions
3
votes
1 answer
Force_plot for multiclass probability explainer
I am facing an error regarding the Python SHAP library.
While it is no problem to create force plots based on the log odds, I am not able to create force plots based on probabilities.
The goal is to have base_values and shap_values which sum up to…

user9898927
- 73
- 8
3
votes
1 answer
What is the XGBoost regulation alpha range?
As documetation said :
https://xgboost.readthedocs.io/en/latest/parameter.html#general-parameters
alpha [default=0, alias: reg_alpha]:
L1 regularization term on weights. Increasing this value will make model more conservative.
I'm wondering can…

Carolineontheway
- 51
- 1
- 3
3
votes
1 answer
XGBoost Plot Importance F-Score Values >100
I have plotted the XGBoost feature importance for all the features in my model as shown in the following figure. But you can see the F Score value is not normalized in the figure(not in range 0 to 100). Please let me know if you have any idea why…

Kanchan Sarkar
- 423
- 2
- 11
3
votes
2 answers
Convert an instance of xgboost.Booster into a model that implements the scikit-learn API
I am trying to use mlflow to save a model and then load it later to make predictions.
I'm using a xgboost.XGBRegressor model and its sklearn functions .predict() and .predict_proba() to make predictions but it turns out that mlflow doesn't support…

joseherazo04
- 35
- 5
3
votes
1 answer
Interpreting leaf values of XGBoost trees for multiclass classification problem
I have been using the XGBoost Python library for my multiclass classification problem, with the multi:softmax objective. Generally, I am not sure how to interpret the leaf values of the several decision trees that are outputted when I use…

AWATHIEU
- 97
- 7
3
votes
0 answers
Why SHAP Values are not Adding up to Predicted Probability?
I was wondering if my following setup is correct to generate SHAP values from a model using CARET's xgbDART method. The problem in this particular case is that SHAP values rowSums() doesnt add up to the predicted score. Any direction would be very…

poshan
- 3,069
- 5
- 20
- 30
3
votes
1 answer
Why does XGBoost not show me the correct best_iteration and ntree_limit?
I'm creating a binary classification model using XGBoostClassifier but I'm having some problems getting the right value to best_iteration and ntree_limit.
The code below is my custom evaluation metric:
def xgb_f1(y, t):
t = t.get_label()
…

Marcos Aurélio
- 31
- 3
2
votes
1 answer
ValueError: Invalid classes inferred from unique values of `y`. Expected: [0 1 2 ... 1387 1388 1389], got [0 1 2 ... 18609 24127 41850]
Situation: I am trying to use XGBoost classifier, however this error pops up to me:
"ValueError: Invalid classes inferred from unique values of y. Expected: [0 1 2 ... 1387 1388 1389], got [0 1 2 ... 18609 24127 41850]".
Unlike this solved one:…

FunnyMud GoPee
- 21
- 1
- 2
2
votes
0 answers
The difference between feature importance and feature weights in XGBoost
I am trying to analyze the output of running xgb classifier. I haven't been able to find a proper explanation of the difference between the feature weights and the features importance chart.
Here is a sample screenshot (not from my dataset but the…

Nata
- 49
- 6
2
votes
0 answers
`binary:logitraw` vs `binary:logistic` objective in xgboost
Which are the differences between setting objective='binary:logistic' and objective='binary:logitraw' in a xgboost classifier?
Based on the documentation (https://xgboost.readthedocs.io/en/latest/parameter.html#learning-task-parameters), the former…

altroware
- 940
- 3
- 13
- 22
2
votes
4 answers
suggest_int() missing 1 required positional argument: 'high' error on Optuna
I have the following code of Optuna to do the hyperparameter tunning for a Xgboost classifier.
import optuna
from optuna import Trial, visualization
from optuna.samplers import TPESampler
from xgboost import XGBClassifier
def objective(trial:…

Yifan Lyu
- 43
- 1
- 6
2
votes
1 answer
Does xgBoost's relative feature importance vary with datapoints in test set?
I'm working on a binary classification dataset and applying xgBoost model to the problem. Once the model is ready, I plot the feature importance and one of the trees resulting from the underlying random forests. Please find these plots below.
…

Piyush Makhija
- 304
- 2
- 11
2
votes
3 answers
Is there any way to calculate the values at each node in XGBoost trees?
I am trying to find a way to calculate the value at each decision node for trees in XGBoostClassifier. I am aware that it can be done in sklearn Tree methods, such as RandomForest, DecisionTree etc. For example-
I found that xgboost get_dump method…

Nakul Mishra
- 31
- 5
2
votes
1 answer
KeyError: 'base_score' while fitting XGBClassifier
Using Gridsearch I find the most optimal hyperparameters after fitting my training data:
model_xgb = XGBClassifier()
n_estimators = [50, 100, 150, 200]
max_depth = [2, 4, 6, 8]
param_grid = dict(max_depth=max_depth, n_estimators=n_estimators)
kfold…

realkes
- 833
- 1
- 12
- 20
2
votes
0 answers
AttributeError: 'HyperbandSearchCV' object has no attribute '_get_param_iterator'
I am trying to execute hyperband on XGBoost model as shown below, but I get this error message:
AttributeError: 'HyperbandSearchCV' object has no attribute '_get_param_iterator'
The code I am using to run hyperband is:
import xgboost as…

Piu
- 21
- 3