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
Kernel is now an object-safe trait so we can use its type as &dyn Kernel, it has also a name() function to have a string representation of the kernel as LinearKernel, RBFKernel, ...
We would like to provide a functionality that instantiate the kernel's default from a string:
"LinearKernel" -> LinearKernel::Default()
via a enum
pub enum KernelName {
Linear(LinearKernel),
...
}
This possibility is known to be not possible in vanilla Rust but there is a library that provides it, see blogpost.
This feature should be only available and loaded in pairing with the "serde" feature so to avoid adding another library to the deps.
This will allow parameters that contain pub kernel: Option<&'a dyn Kernel<'a>>, to be deserializable.
The text was updated successfully, but these errors were encountered:
ok, the problem with Rust comes when is needed to go string->instance. there is no easy way like in Python getattr(module, string) to point to a class/type from a string/enum key.
Kernel
is now an object-safe trait so we can use its type as&dyn Kernel
, it has also aname()
function to have a string representation of the kernel asLinearKernel
,RBFKernel
, ...We would like to provide a functionality that instantiate the kernel's default from a string:
via a enum
This possibility is known to be not possible in vanilla Rust but there is a library that provides it, see blogpost.
This feature should be only available and loaded in pairing with the "serde" feature so to avoid adding another library to the deps.
This will allow parameters that contain
pub kernel: Option<&'a dyn Kernel<'a>>,
to be deserializable.The text was updated successfully, but these errors were encountered: