Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"incorrect number of dimensions" error when using the pairwise loss #163

Open
wenjie2wang opened this issue Mar 28, 2024 · 0 comments
Open

Comments

@wenjie2wang
Copy link

Thanks for developing the package. I wonder how one should train a model with the pairwise loss. An example that reproduces the error is as follows:

## example of pairwise loss using {gbm3}
library(gbm3) # gbm-developers/gbm3@a2b258c
packageVersion("gbm3")
#> [1] '3.0'

train_x <- as.matrix(iris[, c("Sepal.Width", "Petal.Length", "Petal.Width")])
train_y <- iris$Sepal.Length

## train
model <- gbm.fit(
    x = train_x,
    y = train_y,
    group = rep(1, length(train_y)),
    distribution = list(name = "pairwise", metric = "conc"),
    n.trees = 100,
    interaction.depth = 3,
    n.minobsinnode = 10,
    shrinkage = 0.1,
    bag.fraction = 0.5
)
#> Error in gbm_data_obj$x[train_params$id_order, , drop = FALSE]: incorrect number of dimensions

Created on 2024-03-28 with reprex v2.1.0

On another note related to the pairwise loss, I found unexpected prediction results from the pairwise loss by using the {gbm} package: gbm-developers/gbm#79. It would be great if you could provide some insights. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant