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

h2o.gbm histogram_type="Random" doesn't seem to be random #7764

Closed
exalate-issue-sync bot opened this issue May 11, 2023 · 1 comment
Closed

h2o.gbm histogram_type="Random" doesn't seem to be random #7764

exalate-issue-sync bot opened this issue May 11, 2023 · 1 comment

Comments

@exalate-issue-sync
Copy link

I think there may be an issue but not sure. Here is a minimal example. If histogram_type = "Random" shouldn't the root node split threshold vary if ran multiple times?

{code:r}library(data.table) #1.12.8
library(zipcode) #1.0
library(h2o) #3.30.0.4
data("zipcode")
zipcode <- data.table(zipcode)[state=="WY"] #choosing a squarish state

Code to produce loss ratio data

loss_indicator <- sample(0:1,10000,replace=TRUE,prob=c(0.1,0.9))
loss_ratio <- data.table(
earned_premium = runif(10000,0,10000),
losses = runif(10000,0,3500) * loss_indicator,
zip = sample(as.numeric(zipcode$zip),10000,replace=TRUE)
)
loss_ratio[,lr:=losses/earned_premium]
#########
loss_ratio <- merge(
loss_ratio,
zipcode[,.(zip=as.numeric(zip),latitude,longitude)],
by="zip"
)
h2o.init()
lr.hex <- as.h2o(loss_ratio)
split_points <- numeric(length = 100)
for (i in 1:100) {
terr_gbm1 <- h2o.gbm(
x=c("latitude","longitude"),
y="lr",
training_frame = lr.hex[lr.hex$earned_premium>0,],
distribution = "tweedie",
tweedie_power = 1.5,
nbins_top_level = 2,
nbins=2,
histogram_type = "Random",
stopping_rounds = 3,
score_tree_interval = 3,
stopping_tolerance = 1e-5
)
first_tree1 <- h2o.getModelTree(terr_gbm1,1)
split_points[i] <- first_tree1@thresholds[1]
}

should be a variety of split thresholds?

unique(split_points){code}

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Migration Info

Jira Issue: PUBDEV-7880
Assignee: Michal Kurka
Reporter: Joseph Granados
State: Resolved
Fix Version: 3.32.0.3
Attachments: N/A
Development PRs: Available

Linked PRs from JIRA

#5171

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

No branches or pull requests

1 participant