pub struct HybridEmbedder {
pub node2vec: Node2Vec,
pub model2vec: Model2VecEmbedder,
pub alpha: f64,
}Expand description
Blends Node2Vec structural embeddings with Model2Vec semantic embeddings.
Fields§
§node2vec: Node2Vec§model2vec: Model2VecEmbedder§alpha: f640.0 = pure semantic, 1.0 = pure structural.
Implementations§
Source§impl HybridEmbedder
impl HybridEmbedder
pub fn new(node2vec: Node2Vec, model2vec: Model2VecEmbedder, alpha: f64) -> Self
Sourcepub fn embed(
&self,
edges: &[(String, String)],
nodes: &[(&str, &str)],
) -> HashMap<String, Vec<f64>>
pub fn embed( &self, edges: &[(String, String)], nodes: &[(&str, &str)], ) -> HashMap<String, Vec<f64>>
Embed nodes by blending structural (Node2Vec) and semantic (Model2Vec) signals.
nodes: slice of (id, label) pairs.
pub fn find_similar( &self, embeddings: &HashMap<String, Vec<f64>>, node_id: &str, top_n: usize, ) -> Vec<(String, f64)>
Trait Implementations§
Source§impl Clone for HybridEmbedder
impl Clone for HybridEmbedder
Source§fn clone(&self) -> HybridEmbedder
fn clone(&self) -> HybridEmbedder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 HybridEmbedder
impl RefUnwindSafe for HybridEmbedder
impl Send for HybridEmbedder
impl Sync for HybridEmbedder
impl Unpin for HybridEmbedder
impl UnsafeUnpin for HybridEmbedder
impl UnwindSafe for HybridEmbedder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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