You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@inlinevalid_arg(arg) = arg in namesl || arg in namesr || (arg in defs) &&
48
+
!(getfield(defaults, arg) isa Missing)
49
+
50
+
valid_args =all(valid_arg.(args))
51
+
# Uses the default values for model arguments not provided.
52
+
# If no default value exists, use `nothing`.
53
+
if basic_namesr
54
+
returnVal(:prior)
55
+
# Uses the default values for model arguments not provided.
56
+
# If no default value exists or the default value is missing, then error.
57
+
elseif valid_args
58
+
returnVal(:likelihood)
45
59
else
46
-
return :(Val(:likelihood))
60
+
for arg in args
61
+
if!valid_arg(args)
62
+
throw(ArgumentError(missing_arg_error_msg(arg)))
63
+
end
64
+
end
47
65
end
48
66
end
49
67
68
+
missing_arg_error_msg(arg) ="""Variable $arg is not defined and has no default value, or its default value is `missing`. Please make sure all the variables are defined or have a default value other than `missing`."""
69
+
50
70
functionlogprior(
51
71
left::NamedTuple,
52
72
modelgen::ModelGen,
53
73
_vi::Union{Nothing, VarInfo},
54
74
)
55
-
# Pass NaN to args which are not on the lhs of |
56
-
# These will be ignored observe and dot_observe statements
57
-
# Pass missing to args which are on the lhs of |
58
-
# Their value is then assigned from left in PriorContext(left)
59
-
# When all of args are on the lhs of |, this is also equal to the logjoint
0 commit comments