pub struct CentralityEncoding {
pub in_degree_embed: Array2<f64>,
pub out_degree_embed: Array2<f64>,
pub max_degree: usize,
pub hidden_dim: usize,
}Expand description
Learnable centrality encoding based on node in-degree and out-degree.
Adds z_in[deg_in(v)] + z_out[deg_out(v)] to each node embedding,
where z_in and z_out are learnable embedding tables indexed by degree.
Fields§
§in_degree_embed: Array2<f64>Embedding table for in-degree: [max_degree + 1, hidden_dim]
out_degree_embed: Array2<f64>Embedding table for out-degree: [max_degree + 1, hidden_dim]
max_degree: usizeMaximum degree supported
Hidden dimension
Implementations§
Source§impl CentralityEncoding
impl CentralityEncoding
Sourcepub fn new(max_degree: usize, hidden_dim: usize) -> Self
pub fn new(max_degree: usize, hidden_dim: usize) -> Self
Create a new centrality encoding module.
§Arguments
max_degree- Maximum node degree to encode (higher degrees are clamped)hidden_dim- Dimension of the centrality embedding
Trait Implementations§
Source§impl Clone for CentralityEncoding
impl Clone for CentralityEncoding
Source§fn clone(&self) -> CentralityEncoding
fn clone(&self) -> CentralityEncoding
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 moreAuto Trait Implementations§
impl Freeze for CentralityEncoding
impl RefUnwindSafe for CentralityEncoding
impl Send for CentralityEncoding
impl Sync for CentralityEncoding
impl Unpin for CentralityEncoding
impl UnsafeUnpin for CentralityEncoding
impl UnwindSafe for CentralityEncoding
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> 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