I am seeking advice on the way to store parameters of a model with a metadata free , fixed , or constrained. NamedTuples are already good for the pairs of (:name, :value)
p = (a = 1.1, b = 3.3)
I am considering two options:
- A type with the list of parameters with three namedtuple-s
struct Parameters
free::NamedTuple
fixed::NamedTuple
constrained::NamedTuple
end
- A parameter type
struct Parameter{T}
value{T}
error
fixed::Bool
constrained::Bool
end
#
free(v) = Parameter(v,0, false, false)
fixed(v) = Parameter(v,0, true, false)
constrained(v,e) = Parameter(v,e, false, true)
#
p = (a = free(1.1), b = fixed(3.3))
Any thoughts on what the better way is?
Maybe this logic is already implemented somewhere, I would be happy to learn!