pub struct DeepWalk<N: Node> { /* private fields */ }Expand description
DeepWalk embedding algorithm
Learns node embeddings using uniform random walks followed by skip-gram optimization. Supports both negative sampling and hierarchical softmax.
Implementations§
Source§impl<N: Node> DeepWalk<N>
impl<N: Node> DeepWalk<N>
Sourcepub fn new(config: DeepWalkConfig) -> Self
pub fn new(config: DeepWalkConfig) -> Self
Create a new DeepWalk instance with negative sampling (default)
Sourcepub fn with_hierarchical_softmax(config: DeepWalkConfig) -> Self
pub fn with_hierarchical_softmax(config: DeepWalkConfig) -> Self
Create a new DeepWalk instance with hierarchical softmax
Sourcepub fn set_mode(&mut self, mode: DeepWalkMode)
pub fn set_mode(&mut self, mode: DeepWalkMode)
Set the training mode
Sourcepub fn mode(&self) -> DeepWalkMode
pub fn mode(&self) -> DeepWalkMode
Get the current training mode
Sourcepub fn generate_walks<E, Ix>(
&mut self,
graph: &Graph<N, E, Ix>,
) -> Result<Vec<RandomWalk<N>>>
pub fn generate_walks<E, Ix>( &mut self, graph: &Graph<N, E, Ix>, ) -> Result<Vec<RandomWalk<N>>>
Generate training data (uniform random walks) on undirected graph
Sourcepub fn generate_walks_digraph<E, Ix>(
&mut self,
graph: &DiGraph<N, E, Ix>,
) -> Result<Vec<RandomWalk<N>>>
pub fn generate_walks_digraph<E, Ix>( &mut self, graph: &DiGraph<N, E, Ix>, ) -> Result<Vec<RandomWalk<N>>>
Generate training data (uniform random walks) on directed graph
Sourcepub fn train<E, Ix>(&mut self, graph: &Graph<N, E, Ix>) -> Result<()>
pub fn train<E, Ix>(&mut self, graph: &Graph<N, E, Ix>) -> Result<()>
Train the DeepWalk model on an undirected graph
Sourcepub fn train_digraph<E, Ix>(&mut self, graph: &DiGraph<N, E, Ix>) -> Result<()>
pub fn train_digraph<E, Ix>(&mut self, graph: &DiGraph<N, E, Ix>) -> Result<()>
Train the DeepWalk model on a directed graph
Sourcepub fn model(&self) -> &EmbeddingModel<N>
pub fn model(&self) -> &EmbeddingModel<N>
Get the trained model
Sourcepub fn model_mut(&mut self) -> &mut EmbeddingModel<N>
pub fn model_mut(&mut self) -> &mut EmbeddingModel<N>
Get mutable reference to the model
Auto Trait Implementations§
impl<N> Freeze for DeepWalk<N>
impl<N> !RefUnwindSafe for DeepWalk<N>
impl<N> !Send for DeepWalk<N>
impl<N> !Sync for DeepWalk<N>
impl<N> Unpin for DeepWalk<N>where
N: Unpin,
impl<N> UnsafeUnpin for DeepWalk<N>
impl<N> !UnwindSafe for DeepWalk<N>
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> 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