pub struct BoxEmbedding {
pub min: Vec<f32>,
pub max: Vec<f32>,
pub temperature: Option<f32>,
}Expand description
Box embedding for geometric coreference resolution.
Uses axis-aligned hyperrectangles to encode logical invariants. This is based on research showing that box embeddings can capture containment relationships better than vector embeddings.
§Status: Experimental
This type may change significantly. The current representation uses
serde_json::Value as a placeholder; a proper typed representation
will be added once the embedding format stabilizes.
§References
- Vilnis et al., “Probabilistic Embedding of Knowledge Graphs with Box Lattice Measures”
- Dasgupta et al., “Improving Local Identifiability in Probabilistic Box Embeddings”
Fields§
§min: Vec<f32>Minimum corner of the box (lower bounds).
max: Vec<f32>Maximum corner of the box (upper bounds).
temperature: Option<f32>Temperature parameter for softbox formulation.
Implementations§
Source§impl BoxEmbedding
impl BoxEmbedding
Sourcepub fn contains_point(&self, point: &[f32]) -> bool
pub fn contains_point(&self, point: &[f32]) -> bool
Check if this box contains a point.
Sourcepub fn contains_box(&self, other: &BoxEmbedding) -> bool
pub fn contains_box(&self, other: &BoxEmbedding) -> bool
Check if this box contains another box.
Sourcepub fn intersection_volume(&self, other: &BoxEmbedding) -> f32
pub fn intersection_volume(&self, other: &BoxEmbedding) -> f32
Compute intersection volume with another box.
Sourcepub fn from_json(value: &Value) -> Option<BoxEmbedding>
pub fn from_json(value: &Value) -> Option<BoxEmbedding>
Convert from a JSON value (for backwards compatibility with existing data).
Trait Implementations§
Source§impl Clone for BoxEmbedding
impl Clone for BoxEmbedding
Source§fn clone(&self) -> BoxEmbedding
fn clone(&self) -> BoxEmbedding
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 Debug for BoxEmbedding
impl Debug for BoxEmbedding
Source§impl Default for BoxEmbedding
impl Default for BoxEmbedding
Source§fn default() -> BoxEmbedding
fn default() -> BoxEmbedding
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BoxEmbedding
impl<'de> Deserialize<'de> for BoxEmbedding
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoxEmbedding, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoxEmbedding, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for BoxEmbedding
impl PartialEq for BoxEmbedding
Source§impl Serialize for BoxEmbedding
impl Serialize for BoxEmbedding
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for BoxEmbedding
Auto Trait Implementations§
impl Freeze for BoxEmbedding
impl RefUnwindSafe for BoxEmbedding
impl Send for BoxEmbedding
impl Sync for BoxEmbedding
impl Unpin for BoxEmbedding
impl UnsafeUnpin for BoxEmbedding
impl UnwindSafe for BoxEmbedding
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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