Skip to content

Commit 9f7194f

Browse files
committed
Add mcmc options
1 parent cfde9fb commit 9f7194f

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

R/auditBayesianEvaluation.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
# reviewer in the pull Request.
2020

2121
auditBayesianEvaluation <- function(jaspResults, dataset, options, ...) {
22+
set.seed(options[["mcmc.seed"]])
23+
options(mc.iterations = options[["iter"]],
24+
mc.warmup = options[["warmup"]],
25+
mc.chains = options[["chains"]],
26+
jfa.iterations = options[["iter"]])
2227
# For the evaluation constituents, see auditCommonFunctions.R
2328
.jfaEvaluationStage(options, jaspResults, workflow = FALSE)
2429
.jfaCreatedByText(jaspResults)

R/auditCommonFunctions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@
742742
"min_precision_test", "min_precision_rel_val",
743743
"by", "prior_method", "prior_n", "prior_x", "alpha", "beta",
744744
"critical_items", "critical_negative", "critical_action",
745-
"stratum", "pooling", "hurdle"
745+
"stratum", "pooling", "hurdle", "mcmc.seed", "iter", "warmup", "chains"
746746
))
747747

748748
jaspResults[["evaluationContainer"]] <- container

inst/qml/common/planning/Algorithm.qml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,65 @@ Group
100100
helpPage: "Audit/hurdle"
101101
}
102102
}
103+
104+
Section
105+
{
106+
title: qsTr("MCMC Options")
107+
enabled: hurdle.checked || enable_pooling
108+
info: qsTr("Options to customize the MCMC sampling process.")
109+
visible: !(hide_hurdle && hide_pooling)
110+
111+
Group
112+
{
113+
IntegerField
114+
{
115+
id: warmup
116+
name: "warmup"
117+
text: qsTr("Warmup")
118+
defaultValue: 1000
119+
min: 100
120+
max: iter.value
121+
fieldWidth: 60 * preferencesModel.uiScale
122+
Layout.leftMargin: 15 * preferencesModel.uiScale
123+
info: qsTr("Sets the number of warmup MCMC iterations.")
124+
}
125+
126+
IntegerField
127+
{
128+
id: iter
129+
name: "iter"
130+
text: qsTr("Iterations")
131+
defaultValue: 2000
132+
min: warmup.value
133+
max: 10000
134+
fieldWidth: 60 * preferencesModel.uiScale
135+
Layout.leftMargin: 15 * preferencesModel.uiScale
136+
info: qsTr("Sets the total number of MCMC iterations.")
137+
}
138+
139+
IntegerField
140+
{
141+
name: "chains"
142+
text: qsTr("Chains")
143+
defaultValue: 4
144+
min: 1
145+
max: 10
146+
fieldWidth: 60 * preferencesModel.uiScale
147+
Layout.leftMargin: 15 * preferencesModel.uiScale
148+
info: qsTr("Sets the number of MCMC chains.")
149+
}
150+
151+
IntegerField
152+
{
153+
name: "mcmc.seed"
154+
text: qsTr("Seed")
155+
defaultValue: Math.floor(Math.random() * 1000) // Init with random integer in [1,...,999]
156+
min: -999
157+
max: 999
158+
fieldWidth: 60 * preferencesModel.uiScale
159+
Layout.leftMargin: 15 * preferencesModel.uiScale
160+
info: qsTr("Selects the seed for the random number generator in order to reproduce results.")
161+
}
162+
}
163+
}
103164
}

0 commit comments

Comments
 (0)