Skip to content

Commit

Permalink
Update xgboost_introduction.Rmd
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes authored Jan 16, 2025
1 parent 1f1cf3a commit b45a03a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R-package/vignettes/xgboost_introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ model <- xgboost(x, y, nthreads = 1, nrounds = 2)
model
```

In this case, the "y" response variable that was supplied is a "factor" type with two classes ("OJ" and "VC") - hence, XGBoost builds a binary classification model for it based on the features "x", by finding a maximum likelihood estimate (similar to the `faimily="binomial"` model from R's `glm` function) through rule buckets obtained from the sum of two decision trees (from `nrounds=2`), from which we can then predict probabilities, log-odds, class with highest likelihood, among others:
In this case, the "y" response variable that was supplied is a "factor" type with two classes ("OJ" and "VC") - hence, XGBoost builds a binary classification model for it based on the features "x", by finding a maximum likelihood estimate (similar to the `family="binomial"` model from R's `glm` function) through rule buckets obtained from the sum of two decision trees (from `nrounds=2`), from which we can then predict probabilities, log-odds, class with highest likelihood, among others:

```{r}
predict(model, x[1:6, ], type = "response") # probabilities for y's last level ("VC")
Expand Down

0 comments on commit b45a03a

Please sign in to comment.