From 1377f7b447aa68171be687b1eb44a6a53cb27527 Mon Sep 17 00:00:00 2001 From: hoxo-m Date: Tue, 5 Nov 2024 18:29:01 +0900 Subject: [PATCH] set the seed value consistently --- .../generate_allocation_rule_files_for_test.R | 3 ++- .../allocation_rule_for_test/policy_state.pkl | Bin 37261 -> 37260 bytes tests/testthat/test-allocation_rule.R | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data-raw/generate_allocation_rule_files_for_test.R b/data-raw/generate_allocation_rule_files_for_test.R index 7c2a0b4..5a077f5 100644 --- a/data-raw/generate_allocation_rule_files_for_test.R +++ b/data-raw/generate_allocation_rule_files_for_test.R @@ -9,7 +9,8 @@ models <- DoseFinding::Mods( allocation_rule <- learn_allocation_rule( models, N_total = 150, N_ini = rep(10, 5), N_block = 10, Delta = 1.3, - outcome_type = "continuous", sd_normal = sqrt(4.5), seed = 314, + outcome_type = "continuous", sd_normal = sqrt(4.5), + seed = 123, rl_config = rl_config_set(iter = 1, model = rl_dnn_config(fcnet_hiddens = c(1, 1))), output_dir = "allocation_rule_for_test", output_base_dir = "inst/extdata", alpha = 0.025 diff --git a/inst/extdata/allocation_rule_for_test/policy_state.pkl b/inst/extdata/allocation_rule_for_test/policy_state.pkl index e7c7b74dca31f7789a97e5aeefd03698c081b9cc..dc771d666a94c6b2b631f9c47a3b6517f900a9d0 100644 GIT binary patch delta 844 zcmV-S1GD^%qXLYh0tA2sm4T52VH8;`H9hTfDZG-kpu6oN3%$DR^*fPyX&EY{^gQv$ zn!K{$pSQrcqP(7F06Uau4NC=+uK^j8iUA9g9|03Mhez=}sMW(hR2oCQ0-5AK**Ypd z)gtJdJOqY* zg+G((0Xzh;dL2EJ?gA#0Py!w}pIYKQMFz{h;je+c!Zg-AQFVeoyqg<5WWvP0zcZsg zqL9@+`lca1aiRe|2IV6@`GNSoon1OVlcoYh1OYFwJ(KPNL5IGSq! zyW8d`yT?!oyOez~yDSqcyYYcFyQqc`yUk-GyJ*KJyHfSoxFbY3xtWq9x$6`jxxTC^ zxs$nzAUOBEOg3VCzBb&Ws5UT=yf()B%Qnk~=r$c!?KT5==Qa}`-!{YUu`>Vl7&A2b z^D>_?BQwwu1v8Toj5Gv-xt+R`fsY;pU`5_FlWUAJ1eMiRyOW`eAOyT&0XLJyj5Guy z&6c{8fsY;p0@l$rlOK&TI8ZVRy~N~*y{)Csy+lgty~;fszF5BpA3ssXCd7<~o@&PCFkKMmrQJ zI6F$$OFO}|bSaX0pHiKT&cYSToPL=mp*%6mYV6N#Q!nJL+PWV+3xQ+#{A?!B=4b;-;#OIR?0C0dw!PRi*KS|vlzkhO+xAV)Vzgml0D{S@z>J3dlV8C^-Z8074q%eA zczmbdZbR5XyBW@9c8lsc_SbHFW!q7ivu{@Otv#17uiM8Et7UiURlMDSqjT)?Hcs5< ze?()i;L@`;lb12MK+JvzW&q7LV}^>8Q_B%34|C7T#oSeTg@8YU;Dnj3Bw=5l9LFibWxHZ(LcGB!y~HZeCeO)@bv zHZinJF)~dw1S&V$T*b{+!t86sxVfpGiF%c<(Y41X>MNF|C$j1^d{}@ diff --git a/tests/testthat/test-allocation_rule.R b/tests/testthat/test-allocation_rule.R index baa23a4..f72469a 100644 --- a/tests/testthat/test-allocation_rule.R +++ b/tests/testthat/test-allocation_rule.R @@ -22,8 +22,8 @@ test_that("opt_allocation_probs", { doses <- c( 0, 0, 0, 0, 2, 2, 4, 4, 4, 6, 6, 8, 8, 8) resps <- c(.2, .1, .0, .3, .2, .4, .1, .6, .8, .5, .8, 1.1, .9, 1.6) - expected <- c(`0` = 0.2036620, `2` = 0.1981888, `4` = 0.1986541, - `6` = 0.1962135, `8` = 0.2032815) + expected <- c(`0` = 0.2139878, `2` = 0.1945756, `4` = 0.1992008, + `6` = 0.1905261, `8` = 0.2017096) act <- obj$opt_allocation_probs(doses, resps) expect_equal(expected, act, tolerance = 1e-6)