cscherrer / SossMLJ.jl

SossMLJ makes it easy to build MLJ machines from user-defined models from the Soss probabilistic programming language
https://cscherrer.github.io/SossMLJ.jl/stable/
MIT License
15 stars 1 forks source link

Hyperparameters should be a mutable struct (not a named tuple) #119

Open DilumAluthge opened 4 years ago

DilumAluthge commented 4 years ago

That way we can do hyperparameter optimization with MLJ.

cscherrer commented 4 years ago

Let's make it a Dict{Symbol, Any} or similar, then we can easily convert to a named tuple to use in the Soss model

cscherrer commented 4 years ago

Oh but does it have to be a mutable struct for MLJ? Maybe we just make a little wrapper? Would be annoying for users to have to do it from scratch each time

DilumAluthge commented 4 years ago

Yeah MLJ needs to be able to access with getproperty and setproperty!

What if we make a mutable struct that wraps a Dict{Symbol, Any}, and converts getproperty and setproperty! to the appropriate Dict methods.

cscherrer commented 4 years ago

Yep, I like it.

DilumAluthge commented 4 years ago

https://github.com/JuliaCollections/PropertyDicts.jl

DilumAluthge commented 4 years ago

Currently https://github.com/JuliaCollections/PropertyDicts.jl already supports getproperty.

Once that package is registered, we could make a PR to add support for setproperty! for Symbol keys.