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

Reproducibility is achieved only on second and subsequent runs of tabnet_pretrain() #146

Open
cgoo4 opened this issue Jan 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cgoo4
Copy link

cgoo4 commented Jan 14, 2024

Reprex:

library(tabnet)
library(tidymodels)
library(modeldata)

data("lending_club", package = "modeldata")

rec <-
  lending_club |>
  recipe() |>
  update_role(Class, new_role = "outcome") |>
  update_role(-has_role("outcome"), new_role = "predictor")

re_run <- \(x){
  set.seed(1)

  pre <- rec |>
    tabnet_pretrain(
      lending_club,
      device = "cpu",
      verbose = TRUE
    )
}

# Reproducible on second & subsequent runs
walk(1:5, re_run)
#> [Epoch 001] Loss: 147.732330
#> [Epoch 002] Loss: 26.149096
#> [Epoch 003] Loss: 10.889544
#> [Epoch 004] Loss: 8.871026
#> [Epoch 005] Loss: 7.879140
#> [Epoch 001] Loss: 17.072802
#> [Epoch 002] Loss: 7.753736
#> [Epoch 003] Loss: 4.936627
#> [Epoch 004] Loss: 4.208411
#> [Epoch 005] Loss: 4.171945
#> [Epoch 001] Loss: 17.072802
#> [Epoch 002] Loss: 7.753736
#> [Epoch 003] Loss: 4.936627
#> [Epoch 004] Loss: 4.208411
#> [Epoch 005] Loss: 4.171945
#> [Epoch 001] Loss: 17.072802
#> [Epoch 002] Loss: 7.753736
#> [Epoch 003] Loss: 4.936627
#> [Epoch 004] Loss: 4.208411
#> [Epoch 005] Loss: 4.171945
#> [Epoch 001] Loss: 17.072802
#> [Epoch 002] Loss: 7.753736
#> [Epoch 003] Loss: 4.936627
#> [Epoch 004] Loss: 4.208411
#> [Epoch 005] Loss: 4.171945

Created on 2024-01-14 with reprex v2.1.0

@cregouby cregouby added the bug Something isn't working label Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants