JuliaGaussianProcesses / JuliaGaussianProcesses/ParameterHandling.jl
RFC: pretty-printing
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 74
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
ParameterHandling.jl is a nice framework for organising parameters into nested NamedTuples. Whilst working with them in https://github.com/JuliaGaussianProcesses/AbstractGPs.jl/pull/240, what I was missing is a nice way of printing this parameter structure. It seems like the best place to sort this out is within ParameterHandling directly, as it needs to know about the various constraints to print them properly.
So far, I've got the following stub:
using Printf
function show_params(nt::NamedTuple, pre=0)
res = ""
for (s, v) in pairs(nt)
if typeof(v) <: NamedTuple
res *= join(fill(" ", pre)) * "$(s):\n" * show_params(v, pre+4)
else
res *= join(fill(" ", pre)) * "$s = $(@sprintf("%.3f", v))\n"
end
end
return res
end
which then gets called as print(show_params(ParameterHandling.value(param_struct))).
Ideally, I would like to avoid the call to value to remove all the constraints, and instead add the corresponding information (e.g. scale = 1.345 (positive)).
And of course would have to think a bit harder to make it work well for vectors/matrices etc... so I thought it better to first start a discussion about what might be reasonable:)
Update: Oh, and of course instead of directly printing, it should implement show so it works well both in REPL and notebooks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the show_params stub and the existing parameter and constraint representations in ParameterHandling. Compare the desired nested output, constraint annotations, vector and matrix handling, and Julia show behavior in REPLs and notebooks before defining what a finished interface should provide.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100