pub enum Value {
Float(f64),
Int(i64),
Categorical(String),
}Expand description
A concrete hyperparameter value suggested for a trial.
For v1 the categorical variant is restricted to string/enum-like values
(Categorical(String)); arbitrary user types are intentionally out of scope
to keep the sampler/storage plumbing simple. Callers that need richer
categoricals should map their type to/from a stable string label.
Variants§
Float(f64)
A continuous value (from a Uniform/LogUniform distribution).
Int(i64)
A discrete integer value (from an IntUniform distribution).
Categorical(String)
A categorical choice, identified by its label.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
Returns the inner f64 if this is a Value::Float.
Sourcepub fn as_int(&self) -> Option<i64>
pub fn as_int(&self) -> Option<i64>
Returns the inner i64 if this is a Value::Int.
Sourcepub fn as_categorical(&self) -> Option<&str>
pub fn as_categorical(&self) -> Option<&str>
Returns the inner label if this is a Value::Categorical.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more