Questions tagged [xgbclassifier]
112 questions
0
votes
0 answers
XGBoost Custom Objective Function
this will be a long question. I’m trying to define my own custom objective function
I want the XGBClassifier, so I run
from xgboost import XGBClassifier
the documentation of xgboost says:
A custom objective function can be provided for the…

ilPaghyNonPaga
- 11
- 3
0
votes
1 answer
OSError: exception: access violation reading 0x0000000000000008 with XGBOOST classifier
I initially trained my model using an XGBOOST classifier and everything worked fine.
Now, I am trying to train the model on the same data set using an XGBOOST classifier but I am running into this error: OSError: exception: access violation reading…

ddq
- 16
- 3
0
votes
0 answers
How to use CNN as a feature extractor for an XGBoost model?
I have a simple CNN model with a Conv2D, Maxpooling, flatten, dense layers.
the input shape of my data is (8,8,1).
I want to use the output features from the flatten layer as inputs to an XGBoost classifier. For that, I need to train the CNN model…
0
votes
1 answer
Why is the ROC_AUC from cross_val_score so much higher than manually using a StratfiedKFold with metrics.roc_auc_score for an XGB classifier?
Method 1 - StratifiedKFold cross validation
skf = StratifiedKFold(n_splits=5, shuffle=False)
roc_aucs_temp = []
for i, (train_index, test_index) in enumerate(skf.split(X_train_xgb, y_train_xgb)):
X_train_fold, X_test_fold =…

okayokayokay
- 1
- 1
0
votes
1 answer
TypeError: 'Pipeline' object is not callable function with Optuna
Trying to run an Optuna study that has a function with a Pipeline in. I, kind of, understand the error but have no idea what the solution is...
Trying to run the following code... It works fine when running XGBClassifier on preprocessed data that…

Steve Rowe
- 11
- 4
0
votes
1 answer
How does sklearn calculate accuracy on the validation set when XGBoost is given class weights?
I am using XGBoost's sklearn API with sklearn's RandomizedSearchCV() to train a boosted tree model with cross validation. My problem is imbalanced, so I've supplied the scale_pos_weight parameter to my XGBClassifier. For simplicity, let's say that…

Eli
- 280
- 1
- 3
- 13
0
votes
0 answers
scale_pos_weight grid.fit mismatch
Only the clever can figure out!
If somebody works out the scale_pos_weight in XGBoost, after finding out the best point, if they refit the model with that point, another figure comes up! i.e.:
Best: 0.950298 using {'scale_pos_weight':…

Reza Paradise
- 1
- 1
0
votes
0 answers
Any Solution Fasttext And XGBClassifier ( Invalid Classes )
max_depth = range(1, 51)
train_score = []
test_score = []
X = vecs_train
y = df_train1.Sentiment
for k in max_depth:
dt = XGBClassifier(random_state=42, max_depth=k)
dt.fit(X, y)
train_score.append(dt.score(vecs_train,…
0
votes
0 answers
Selection of optimal parameters for the model
How to optimally select parameters for the HistGradientBoostingClassifier() model for big data (more than 10 million rows). If I use such code:
model_hgbc = HistGradientBoostingClassifier()
param_hgbc = {'learning_rate' :…

tim_v
- 1
- 1
0
votes
0 answers
IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed
I am trying to identify Global Feature Relationships with SHAP values. The SHAP library returns three matrices and I am trying to select the SHAP matrix however, I am getting this error: "IndexError: too many indices for array: array is…

I. New
- 1
0
votes
0 answers
XGBOOST how to Select the Leaf Node Data
When we plot a XGBOOST tree, we could see the Leafs/Nodes using ,
!pip install --upgrade pip
!pip install graphviz
!sudo apt -y install graphviz
from xgboost import XGBRegressor
from matplotlib import pyplot as plt
from xgboost import…

user2458922
- 1,691
- 1
- 17
- 37
0
votes
0 answers
Xgboost on Spark Validation Indicator Column and Evaluation Metric
I am using the xgboost PySpark API. This API is experimental but it supports most of the features of the xgboost API.
As per the documentation below, eval_set parameter is not supported and instead, validationIndicatorCol parameter should be…

Vusal
- 11
- 2
0
votes
1 answer
Custom objective function in XGBoost not overriding default
I am trying to implement this loos function weighted_loss, as a custom objective in XGBoost, using the sklearn XBGClassifier wrapper, as follows:
def weighted_binary_cross_entropy(dtrain, pred):
# assign the value of imbalanced alpha
…

horcle_buzz
- 2,101
- 3
- 30
- 59
0
votes
0 answers
AttributeError: 'Index' object has no attribute 'index'
I have saved & loaded a simple XGBClassifier(random_sate = 100) model, trained on Heart Disease prediction dataset(target variable mapped to 0s & 1s). I am trying to create a dtreeviz plot for the same:
from dtreeviz.trees import *
viz =…

Nilotpole Kalita
- 1
- 1
0
votes
1 answer
XGBoostError: Unicode-3 is not supported
I am trying to load an XGBClassifier in my streamlit app from a pickle file.
When I load it and try to predict on the new input values, it throws the error:
XGBoostError: [11:25:40]…

Amey
- 1
- 1