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).
2,468
questions
0
votes
0
answers
9
views
how to detect if overfitting xgboost print test set AUC
I would like to check if we overfit, i used function like this
model <- xgboost(data = x1, label = data$early,
max.depth = 2000, eta = 0.5, nthread = 2, nrounds = 15, ...
0
votes
0
answers
4
views
Tuning XGBRanker produces error for groups
I have a simple ranking problem, and i use:
from xgboost import XGBRanker
model = XGBRanker(
min_child_weight=10,
subsample=0.5,
tree_method='hist',
)
model.fit(X_train, y_train, group=...
0
votes
0
answers
26
views
xgboost problem with parameter 'eta' = 0.01
I used dataset "churn" with xgboost algorithm. Y has two levels, Yes and No.
I have a problem with parameter 'eta' in xgboost. When I run eta = 0.1, I have no error in confusion matrix. But, ...
0
votes
1
answer
17
views
Trouble in XGBoost changing DataFrame to DMatrix
I'm using XGBoost to do some calculations. After I read a csv file to test_data and pass it to xgb.DMatrix ,error shows.
test_data.info()
datas = xgb.DMatrix(test_data)
the output shows below:...
0
votes
1
answer
12
views
How to write a custom wrapper for a prediction function in xgboost or other estimators
So I want to manipulate the result of my prediction and I need to do it within the estimator. I tried to write a wrapper like this, but my kernel just dies when I execute the predict function. From my ...
0
votes
0
answers
22
views
XGBoost object 'trainD' not found
I was running this code on RStudio
param <- list(colsample_bytree = 1,
subsample = .6,
booster = "gbtree",
max_depth = 8,
eta = 0....
0
votes
0
answers
2
views
How to save a non tf.Model model and load it with tf.saved_model.load()
I have a trained XGBoost model, and an API that uses tensor flow saved models to load it. Is it possible to save the XGBoost model in a way that will be compatible with saved_model.load().
E.g.
clf = ...
-1
votes
0
answers
21
views
Cannot find lib in a python .exe
I have a script that uses 8 different predicting models (between regressors and classifiers)
When I run the script it works perfectly, then I tried to take it to a .exe using
pyinstaller --clean --...
0
votes
0
answers
13
views
Getting 'Dataset is empty, or contains only positive or negative samples' when using Xgboost rank:pairwise, eval_metric: auc
When I run the xgboost rank demo by setting 2 samples for every group, eval_metric=auc, it shows warning that 'Dataset is empty, or contains only positive or negative samples'.
I have tried for many ...
1
vote
0
answers
52
views
Vertex AI endpoint prediction error : ValueError: Unable to coerce value
I built and deployed an XGBoost regressor model on vertex AI and I am trying to make some predictions using Vertex AI python SDK.
Here's my code:
client = aiplatform.gapic.PredictionServiceClient....
0
votes
0
answers
23
views
How to solve Feature Shape Mismatch error in XGBoost Feature Selection?
I'm trying to use the following code to get feature importance for feature selection in XGBOOST. But I keep getting an error saying that there's a "Feature shape mismatch, expected: 91, got 78&...
0
votes
0
answers
11
views
Xgboost xgb.importance cannot output variable importance?
I made a model:
fit_xgb_reg <- xgb.train(
data=dtrain,
eta=0.3,
gamma=0.001,
max_depth =2,
subsample =0.7,
colsample_bytree =0.4,
objective = "binary:logistic",
...
0
votes
0
answers
28
views
XGBoostError: rabit/internal/utils.h:90: Allreduce failed - Error while attempting XGboost on Dask Fargate Cluster in AWS
Overview: I'm trying to run an XGboost model on a bunch of parquet files sitting in S3 using dask by setting up a fargate cluster and connecting it to a Dask cluster.
Total dataframe size totals to ...
0
votes
0
answers
15
views
Does tweedie_variance_power matter when log-transforming predictions?
I haven't been able to find any canonical sources on how tweedie_variance_power comes into play when predicting using an XGBoost algorithm with objective=reg:tweedie. My dependent variable is log-...
0
votes
1
answer
68
views
How to slice a XGBClassifier/XGBRegressor model into sub-models?
This document shows that a XGBoost API trained model can be sliced by following code:
from sklearn.datasets import make_classification
import xgboost as xgb
booster = xgb.train({
'...
0
votes
1
answer
21
views
Dataframe of different size but no difference in columns
I am realizing an XG Boost model. I did my train-test split on a dataframe having 91 columns. I want to use my model on a new dataframe which have different columns than my training set. I have ...
-1
votes
0
answers
12
views
How to speed up XGBoost Classification for time series
I'm using the XGBoost Classifier for time series prediction. I am also doing out-of-time cross-validation (for example, training on 10 weeks and predicting/testing on the 11th week). This makes using ...
0
votes
0
answers
9
views
Monotonic constraints and xgboost - classification
The official documentation details the capability to enforce monotonic constraints with its interface, and helps with a regression problem to illustrate:
https://xgboost.readthedocs.io/en/stable/...
0
votes
1
answer
26
views
cast xgboost.Booster class to XGBRegressor or load XGBRegressor from xgboost.Booster
I get a model from Sagemaker of type:
<class 'xgboost.core.Booster'>
I can score this locally which is great but some google searches have shown that it may not be possible to do "standard&...
0
votes
0
answers
11
views
XGBoost multiple GPUs not faster than single GPU
Using the following code to train an XGBoost Classifier on a single GPU: (only relevant bits displayed, please ask if need more details)
xgb_model = xgboost.XGBClassifier(**params)
xgb_model.fit(...
0
votes
0
answers
37
views
Speed up model predictions when using cron job
I have a set of XGBoost models that needs to run on a minutely interval using predict().
When I set this up to run with a cron job (using the cronR package), the predictions run very slow compared to ...
0
votes
1
answer
12
views
cannot load pickle files for xgboost images of version > 1.2-2 in sagemaker - UnpicklingError
I can train a XGBoost model using Sagemaker images like so:
import boto3
import sagemaker
from sagemaker.inputs import TrainingInput
import os
folder = r"C:\Somewhere"
os.chdir(folder)
...
0
votes
0
answers
6
views
XGBoost iterative training: Not having all 0,...,C labels in minibatch without erroring
When training XGBoost iteratively for data too large to fit in memory, one may want to use "batches". The problem is, however, that each batch may not contain all 0,...,C labels. This leads ...
0
votes
1
answer
19
views
data format to predict with model fitted via Sagemaker's XGBoost built-in algorithm and training container
Looking at the following code, taken from here, I wonder what format dtest is (sorry I could not gleen this from the post):
import pickle as pkl
import tarfile
t = tarfile.open('model.tar.gz', 'r:gz'...
0
votes
0
answers
10
views
XGBOOST RANKER not smooth
I have the following toy problem centered around Baseball.
In this baseball dataset, I have a lot of data about tournament results over many many years where I am able to collect the following ...
0
votes
0
answers
17
views
Why Multioutput XGBoosting feature importance gives different results using importnace_plot or estimators_[0].feature_importances_?
I have a multioutput XGboosting model and trying to plot important features for each output. There are 23 outputs.
I have tried to do this from two ways:
important features as a dataframe:
# ...
0
votes
0
answers
38
views
How can I plot a model, which is trained with a scaled dataset?
I have a major problem with XAI, Shap, Lime you name it in general. Here is a basic example for shap. My problem is that when I use a real tuned model, which is not a basic example, I always have a ...
0
votes
0
answers
34
views
How to do Multi-step forecasting using XGBoost?
I am currently using XGBoost to predict sales in the future. My time series data is given per week interval. But I am not sure how can I do multistep forcasting using XGBoost. I split my data set into ...
0
votes
0
answers
338
views
XGB Classifier error Invalid classes inferred from unique values of `y`
This is my first question here. I've trained an XGB Classifier and it worked fine on local, but I'm trying the same in a jupyter notebook on a google cloud virtual machine and it gets an error.
My ...
0
votes
1
answer
12
views
XGBoost tuning with caret gets worse with number of iterations
When tuning hyperparameters I see that the RMSE gets larger with a greater number of iterations. This is the exact opposite of what I was expecting. Could it be that the data is too noisy for ...
1
vote
1
answer
29
views
Using base_score with XGBClassifier to provide initial priors for each target class
When using XGBRegressor, it's possible to use the base_score setting to set the initial prediction value for all data points. Typically that value would be set to the mean of the observed value in the ...
0
votes
0
answers
15
views
Optimizing best hyper parameters through randomizedSearch CV : problems with best_params_
I've recently tried to get the best parameters concerning the optimization of a model for detecting problem with airbus engine, however, no matter how many iterations do I put in the parameters of ...
3
votes
2
answers
1k
views
Invalid classes inferred from unique values of `y`. Expected: [0 1 2 3 4 5], got [1 2 3 4 5 6]
I've trained dataset using XGB Classifier, but I got this error in local. It worked on Colab and also my friends don't have any problem with same code.
I don't know what that error means...
Invalid ...
1
vote
0
answers
70
views
How to quantize an ONNX model converted from a XGBoost classifier model?
I converted a XGBoost classifier model to an ONNX model by onnxmltools and quantized the ONNX model using ONNX quantize_dynamic().
But I didn't get a quantized ONNX model with smaller model file size ...
0
votes
1
answer
31
views
word2vec + XGBoostRegressor - error Check failed: preds.Size() == info.labels_.Size() (1 vs. 70812) : labels are not correctly providedpreds.size=1
I am quite new to NLP.
I am building a Regression model for predicting discrete values (like price).
While I was Using xgboostRegressor + word2vec. It throws the below error when trying to fit the ...
0
votes
1
answer
10
views
R save xgb model command error: 'model must be xgb.Booster'
'bst' is the name of an xgboost model that I built in R. It gives me predicted values for the test dataset using this code. So it is definitely an xgboost model.
pred.xgb <- predict(bst , xdtest) #...
0
votes
1
answer
37
views
Splitting Array of Lists into named subarrays
Splitting Arrays for Test Train
Essentially I am attempting to convert a pandas dataframe into numpy arrays so that I can run it through a Test/Train.
My goal here is to split the columns into groups ...
0
votes
1
answer
114
views
Sklearn Pipelines + GridsearchCV + XGBoost + Learning Curve
I am new to sklearn & XGBoost.
I would like to use GridSearchCV to tune a XGBoost classifier. One of the checks that I would like to do is the graphical analysis of the loss from train and test. ...
0
votes
0
answers
23
views
Number of trees per boosting round in XGBoost
I want to figure out why in binary classification, we only need 1 tree per boosting round, while in n-class multi-class classification, we need n trees in one boosting round. I think XGBoost need to ...
0
votes
0
answers
13
views
Predict xgboost model onto raster stack yields error
I am using an xgboost model to predict onto a raster stack. I have successfully used the same approach with CART, xgb and Random Forest models:
r_xgboost <- raster::predict(model = xgboost, object =...
0
votes
0
answers
12
views
How to set up a 'watchlist' for using the 'early_stopping_rounds' parameter?
I want to apply with XGBoost algorithm on the attrition data from the modeldata package. For this I use the package caret as well as recipes for data preparation.
data("attrition", package = ...
0
votes
0
answers
20
views
Is it possible to update an already trained XGBoost model on new dataset?
So I have been using the C API to train and generate a model. Some new dataset has come in and I would like to update this pre-existing model with this new dataset. Is this possible?
According to the ...
0
votes
0
answers
27
views
how to use a larger 'max_depth' in xgboost
I'm using xgboost to fit data which have 2 features. I've setting 'max_depth' to 30 but i get a tree with 11 depth. Trees with 11 depth didn't fit will with data compare to BP-net.
df_new = pd....
2
votes
1
answer
29
views
using fit_params from pipeline sklearn for training
I am using XGBClassifier from xgboost library in a Pipeline from sklearn but whenever i want to access one of the **fit_params in the way that the library says to do so https://scikit-learn.org/stable/...
0
votes
0
answers
51
views
Demand forecasting with LSTM and XGBoost
I am investigating a demand forecasting problem, I see there has 2 common solutions that are LSTM and XGboost(boosting gradient tree).
I tried them but the outputs were no meaning.
I will descript ...
0
votes
1
answer
35
views
XGBOOST: Multiple dimension array as input to model
How would you train a model with a dataset that has 4 matrices per row?
Below is a minimal reproducible example with a (2rows, 4 matrices, 3 X 6 matrix) dataset to train.
import numpy as np
import ...
1
vote
0
answers
34
views
Get names of columns on which XGBoost Classifier is trained BigQuery
I am training XGBoost Classifier on Big Query. The model is trained fine and then the bst (saved model) file is imported to a python notebook for plotting. I want to plot the trees present in the ...
1
vote
2
answers
721
views
AttributeError: 'XGBModel' object has no attribute 'callbacks'
Traceback (most recent call last):
File "D:\Miniconda3\envs\ppy39\lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "D:\Miniconda3\...
-1
votes
0
answers
38
views
Mac M1_How to solve 'kernel died' problem with XGBoost in Jupyter Notebook?
My environment .. Mac M1, python3.8.12, miniforge3 , jupyter notebook
I installed XGBoost by referring to this link.
https://velog.io/@a87380/Apple-M1%EC%97%90%EC%84%9C-XgBoost-%EC%84%A4%EC%B9%98%ED%...
0
votes
0
answers
48
views
Does XGBoost need standardization or normalization?
In the link below, I confirmed that normalization is not required in XGBoost.
However, in the dataset we are using now, we need to use standardization
to get high performance.
Is standardization ...