Relative Content

Tag Archive for rxgboost

How to get predicted probabilities of being in each class of three using xgboost in R?

I am trying to train a xgboost model using iris dataset. The training code is shown below, and both prediction functions produce the same results. However, the length of the results is 135, while test_data has only 45 rows. In addition, the results seems to look like predicted probabilities, but there are 3 classes in the label, while the results only produce a vector instead of a matrix of predicted probabilities of three classes. So, how can I get the predicted probability for each class and also the predicted class?

Evaluate overfitting by comparing training vs testing log loss (XGBoost)

I’m trying to make a plot using the evaluation logs from model training and testing for my XGBoost model (using r) but I can only plot the training evaluation log after performing last_fit (fit to training to test on testing set). I’ve found that ‘learning curves’ can be calculated in python using model.evals_result() but I don’t know what this corresponds to in r. Does anyone know how to retrieve both the training and testing evaluation log from a last_fit XGBoost model?

Old models no longer loaded?

We’ve models trained use xgboost, saved as Xxx.model in the past, now not able to load into R .
File ‘Xxx.model’ has magic number ” use of Dave versions prior to 2 is deprecated.
What to do to use it? r says not load any data.

Fix error for creating Matrix when running rank:ndcg Xgboost model in R

I’ve got a dataframe containing feature variables, query ids and relevancy input to run a rank:ndcg model in Xgboost. I’m getting the error below. I’ve checked the data and they are all numeric values with no NAs or non-numeric values. So looks like it’s an issue with the query ids- I’ve got the same number of rows as query ids. If I just add the top query ID, the Matrix doesn’t bring up the error. Code is below and my full dataframe has 20 columns and 201000 rows: