if (FALSE) {
# Load simulated ranking data
data(simulatedRankingData)
x <- simulatedRankingData$x
y <- simulatedRankingData$y
# Prepare the data with item weights
dati <- prep_data(y, x, iw = c(2, 5, 5, 2))
# Divide the data into training and test sets
set.seed(12345)
samp <- sample(nrow(dati))
l <- length(dati[, 1])
sub <- sample(1:l, 2 * l / 3)
data_sub1 <- dati[sub, ]
data_test1 <- dati[-sub, ]
# Apply ensemble ranking with AdaBoost.M1
boosting_1 <- Ensemble_ranking_IW(
Label ~ .,
data = data_sub1,
iw = c(2, 5, 5, 2),
mfinal = 3,
coeflearn = "Breiman",
control = rpart.control(maxdepth = 4, cp = -1),
algo = "boosting",
bin = FALSE
)
# Evaluate the performance
test_boosting1 <- errorevol_ranking_vector_IW(boosting_1,
newdata = data_test1, iw=c(2,5,5,2), squared = FALSE)
test_boosting1.1 <- errorevol_ranking_vector_IW(boosting_1,
newdata = data_sub1, iw=c(2,5,5,2), squared = FALSE)
# Plot the error evolution
plot.errorevol(test_boosting1, test_boosting1.1)
}
Run the code above in your browser using DataLab