pub struct OptionSpace<S> {
pub inner: S,
}
Expand description
A space whose elements are either None
or Some(inner_elem)
.
The feature vectors are
[1, 0, ..., 0]
forNone
[0, inner_feature_vector(x)]
forSome(x)
.
Fields§
§inner: S
Implementations§
Source§impl<S> OptionSpace<S>
impl<S> OptionSpace<S>
Trait Implementations§
Source§impl<S: Clone> Clone for OptionSpace<S>
impl<S: Clone> Clone for OptionSpace<S>
Source§fn clone(&self) -> OptionSpace<S>
fn clone(&self) -> OptionSpace<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<S: Debug> Debug for OptionSpace<S>
impl<S: Debug> Debug for OptionSpace<S>
Source§impl<S: Default> Default for OptionSpace<S>
impl<S: Default> Default for OptionSpace<S>
Source§fn default() -> OptionSpace<S>
fn default() -> OptionSpace<S>
Returns the “default value” for a type. Read more
Source§impl<'de, S> Deserialize<'de> for OptionSpace<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for OptionSpace<S>where
S: Deserialize<'de>,
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
Source§impl<S: Display> Display for OptionSpace<S>
impl<S: Display> Display for OptionSpace<S>
Source§impl<S> Distribution<<OptionSpace<S> as Space>::Element> for OptionSpace<S>
impl<S> Distribution<<OptionSpace<S> as Space>::Element> for OptionSpace<S>
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> <Self as Space>::Element
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> <Self as Space>::Element
Generate a random value of
T
, using rng
as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T
, using rng
as
the source of randomness. Read moreSource§impl<S: FeatureSpace> FeatureSpace for OptionSpace<S>
Features are [0.0, features(x)..]
for Some(x)
and [1.0, 0.0, ..., 0.0]
for None
.
impl<S: FeatureSpace> FeatureSpace for OptionSpace<S>
Features are [0.0, features(x)..]
for Some(x)
and [1.0, 0.0, ..., 0.0]
for None
.
Source§fn num_features(&self) -> usize
fn num_features(&self) -> usize
Length of the encoded feature vectors.
Source§fn features_out<'a, F: Float>(
&self,
element: &Self::Element,
out: &'a mut [F],
zeroed: bool,
) -> &'a mut [F]
fn features_out<'a, F: Float>( &self, element: &Self::Element, out: &'a mut [F], zeroed: bool, ) -> &'a mut [F]
Encode the feature vector of an element into a mutable slice. Read more
Source§fn features<T>(&self, element: &Self::Element) -> T
fn features<T>(&self, element: &Self::Element) -> T
Encode the feature vector of an element into an array.
Source§fn batch_features_out<'a, I, A>(
&self,
elements: I,
out: &mut ArrayBase<A, Ix2>,
zeroed: bool,
)
fn batch_features_out<'a, I, A>( &self, elements: I, out: &mut ArrayBase<A, Ix2>, zeroed: bool, )
Encode the feature vectors of multiple elements into rows of a two-dimensional array. Read more
Source§fn batch_features<'a, I, T>(&self, elements: I) -> Twhere
I: IntoIterator<Item = &'a Self::Element>,
I::IntoIter: ExactSizeIterator,
Self::Element: 'a,
T: BuildFromArray2D,
<T::Array as NumArray2D>::Elem: Float,
fn batch_features<'a, I, T>(&self, elements: I) -> Twhere
I: IntoIterator<Item = &'a Self::Element>,
I::IntoIter: ExactSizeIterator,
Self::Element: 'a,
T: BuildFromArray2D,
<T::Array as NumArray2D>::Elem: Float,
Encode the feature vectors of multiple elements as rows of a two-dimensional array.
Source§impl<S: FiniteSpace> FiniteSpace for OptionSpace<S>
impl<S: FiniteSpace> FiniteSpace for OptionSpace<S>
Source§impl<S: Hash> Hash for OptionSpace<S>
impl<S: Hash> Hash for OptionSpace<S>
Source§impl<S: LogElementSpace> LogElementSpace for OptionSpace<S>
impl<S: LogElementSpace> LogElementSpace for OptionSpace<S>
Source§impl<S: Space> NonEmptySpace for OptionSpace<S>
impl<S: Space> NonEmptySpace for OptionSpace<S>
Source§fn some_element(&self) -> Self::Element
fn some_element(&self) -> Self::Element
An arbitrary deterministic element from the space.
Source§impl<S: Ord> Ord for OptionSpace<S>
impl<S: Ord> Ord for OptionSpace<S>
Source§fn cmp(&self, other: &OptionSpace<S>) -> Ordering
fn cmp(&self, other: &OptionSpace<S>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<S: PartialEq> PartialEq for OptionSpace<S>
impl<S: PartialEq> PartialEq for OptionSpace<S>
Source§impl<S: PartialOrd> PartialOrd for OptionSpace<S>
impl<S: PartialOrd> PartialOrd for OptionSpace<S>
Source§impl<S> Serialize for OptionSpace<S>where
S: Serialize,
impl<S> Serialize for OptionSpace<S>where
S: Serialize,
Source§impl<S: Space> Space for OptionSpace<S>
impl<S: Space> Space for OptionSpace<S>
Source§impl<S: SubsetOrd> SubsetOrd for OptionSpace<S>
impl<S: SubsetOrd> SubsetOrd for OptionSpace<S>
Source§fn subset_cmp(&self, other: &Self) -> Option<Ordering>
fn subset_cmp(&self, other: &Self) -> Option<Ordering>
Compare using the subset relationship. This is a partial order.
Source§fn strict_subset_of(&self, other: &Self) -> bool
fn strict_subset_of(&self, other: &Self) -> bool
Check if this is a strict subset of
other
.Source§fn subset_of(&self, other: &Self) -> bool
fn subset_of(&self, other: &Self) -> bool
Check if this is a subset (strict or equal) of
other
.Source§fn strict_superset_of(&self, other: &Self) -> bool
fn strict_superset_of(&self, other: &Self) -> bool
Check if this is a strict superset of
other
.Source§fn superset_of(&self, other: &Self) -> bool
fn superset_of(&self, other: &Self) -> bool
Check if this is a superset (strict or equal) of
other
.impl<S: Copy> Copy for OptionSpace<S>
impl<S: Eq> Eq for OptionSpace<S>
impl<S> StructuralPartialEq for OptionSpace<S>
Auto Trait Implementations§
impl<S> Freeze for OptionSpace<S>where
S: Freeze,
impl<S> RefUnwindSafe for OptionSpace<S>where
S: RefUnwindSafe,
impl<S> Send for OptionSpace<S>where
S: Send,
impl<S> Sync for OptionSpace<S>where
S: Sync,
impl<S> Unpin for OptionSpace<S>where
S: Unpin,
impl<S> UnwindSafe for OptionSpace<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more