Class DeepWalk<V,E>
- java.lang.Object
-
- org.deeplearning4j.graph.models.embeddings.GraphVectorsImpl<V,E>
-
- org.deeplearning4j.graph.models.deepwalk.DeepWalk<V,E>
-
- All Implemented Interfaces:
Serializable
,GraphVectors<V,E>
public class DeepWalk<V,E> extends GraphVectorsImpl<V,E>
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DeepWalk.Builder<V,E>
-
Field Summary
Fields Modifier and Type Field Description static int
STATUS_UPDATE_FREQUENCY
-
Fields inherited from class org.deeplearning4j.graph.models.embeddings.GraphVectorsImpl
graph, lookupTable
-
-
Constructor Summary
Constructors Constructor Description DeepWalk()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fit(IGraph<V,E> graph, int walkLength)
Fit the model, in parallel.void
fit(GraphWalkIterator<V> iterator)
Fit the DeepWalk model using a single thread using a given GraphWalkIterator.void
fit(GraphWalkIteratorProvider<V> iteratorProvider)
Fit the model, in parallel, using a given GraphWalkIteratorProvider.
This object is used to generate multiple GraphWalkIterators, which can then be distributed to each thread to do in parallel
Note thatfit(IGraph, int)
will be more convenient in many cases
Note thatinitialize(IGraph)
orinitialize(int[])
must be called first.double
getLearningRate()
int
getVectorSize()
int
getWindowSize()
void
initialize(int[] graphVertexDegrees)
Initialize the DeepWalk model with a list of vertex degrees for a graph.
Specifically, graphVertexDegrees[i] represents the vertex degree of the ith vertex
vertex degrees are used to construct a binary (Huffman) tree, which is in turn used in the hierarchical softmax implementationvoid
initialize(IGraph<V,E> graph)
Initialize the DeepWalk model with a given graph.GraphVectorLookupTable
lookupTable()
void
setLearningRate(double learningRate)
-
Methods inherited from class org.deeplearning4j.graph.models.embeddings.GraphVectorsImpl
getGraph, getVertexVector, getVertexVector, numVertices, similarity, similarity, verticesNearest
-
-
-
-
Field Detail
-
STATUS_UPDATE_FREQUENCY
public static final int STATUS_UPDATE_FREQUENCY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVectorSize
public int getVectorSize()
- Specified by:
getVectorSize
in interfaceGraphVectors<V,E>
- Overrides:
getVectorSize
in classGraphVectorsImpl<V,E>
-
getWindowSize
public int getWindowSize()
-
getLearningRate
public double getLearningRate()
-
setLearningRate
public void setLearningRate(double learningRate)
-
initialize
public void initialize(IGraph<V,E> graph)
Initialize the DeepWalk model with a given graph.
-
initialize
public void initialize(int[] graphVertexDegrees)
Initialize the DeepWalk model with a list of vertex degrees for a graph.
Specifically, graphVertexDegrees[i] represents the vertex degree of the ith vertex
vertex degrees are used to construct a binary (Huffman) tree, which is in turn used in the hierarchical softmax implementation- Parameters:
graphVertexDegrees
- degrees of each vertex
-
fit
public void fit(IGraph<V,E> graph, int walkLength)
Fit the model, in parallel. This creates a set of GraphWalkIterators, which are then distributed one to each thread- Parameters:
graph
- Graph to fitwalkLength
- Length of rangom walks to generate
-
fit
public void fit(GraphWalkIteratorProvider<V> iteratorProvider)
Fit the model, in parallel, using a given GraphWalkIteratorProvider.
This object is used to generate multiple GraphWalkIterators, which can then be distributed to each thread to do in parallel
Note thatfit(IGraph, int)
will be more convenient in many cases
Note thatinitialize(IGraph)
orinitialize(int[])
must be called first.- Parameters:
iteratorProvider
- GraphWalkIteratorProvider- See Also:
fit(IGraph, int)
-
fit
public void fit(GraphWalkIterator<V> iterator)
Fit the DeepWalk model using a single thread using a given GraphWalkIterator. If parallel fitting is required,fit(IGraph, int)
orfit(GraphWalkIteratorProvider)
should be used.
Note thatinitialize(IGraph)
orinitialize(int[])
must be called first.- Parameters:
iterator
- iterator for graph walks
-
lookupTable
public GraphVectorLookupTable lookupTable()
-
-