|
| 1 | +# boost_tree - xgboost case weights |
| 2 | + |
| 3 | + Code |
| 4 | + print(wt_fit$fit$call) |
| 5 | + Output |
| 6 | + xgboost::xgb.train(params = list(eta = 0.3, max_depth = 6, gamma = 0, |
| 7 | + colsample_bytree = 1, colsample_bynode = 1, min_child_weight = 1, |
| 8 | + subsample = 1), data = x$data, nrounds = 15, watchlist = x$watchlist, |
| 9 | + verbose = 0, nthread = 1, objective = "binary:logistic") |
| 10 | + |
| 11 | +# decision_tree - rpart case weights |
| 12 | + |
| 13 | + Code |
| 14 | + print(wt_fit$fit$call) |
| 15 | + Output |
| 16 | + rpart::rpart(formula = Class ~ ., data = data, weights = weights) |
| 17 | + |
| 18 | +# logistic_reg - stan case weights |
| 19 | + |
| 20 | + Code |
| 21 | + print(wt_fit$fit$call) |
| 22 | + Output |
| 23 | + rstanarm::stan_glm(formula = Class ~ ., family = stats::binomial, |
| 24 | + data = data, weights = weights, seed = ~1, refresh = 0) |
| 25 | + |
| 26 | +# mars - earth case weights |
| 27 | + |
| 28 | + Code |
| 29 | + print(wt_fit$fit$call) |
| 30 | + Output |
| 31 | + earth(formula = Class ~ ., data = data, weights = weights, keepxy = TRUE, |
| 32 | + glm = ~list(family = stats::binomial)) |
| 33 | + |
| 34 | +# mlp - nnet case weights |
| 35 | + |
| 36 | + Case weights are not enabled by the underlying model implementation. |
| 37 | + |
| 38 | +# rand_forest - ranger case weights |
| 39 | + |
| 40 | + Code |
| 41 | + print(wt_fit$fit$call) |
| 42 | + Output |
| 43 | + ranger::ranger(x = maybe_data_frame(x), y = y, num.threads = 1, |
| 44 | + verbose = FALSE, seed = sample.int(10^5, 1), probability = TRUE, |
| 45 | + case.weights = weights) |
| 46 | + |
0 commit comments