Class GraphVectorsImpl<V,E>
- java.lang.Object
-
- org.deeplearning4j.graph.models.embeddings.GraphVectorsImpl<V,E>
-
- All Implemented Interfaces:
Serializable
,GraphVectors<V,E>
- Direct Known Subclasses:
DeepWalk
public class GraphVectorsImpl<V,E> extends Object implements GraphVectors<V,E>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected IGraph<V,E>
graph
protected GraphVectorLookupTable
lookupTable
-
Constructor Summary
Constructors Constructor Description GraphVectorsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IGraph<V,E>
getGraph()
int
getVectorSize()
org.nd4j.linalg.api.ndarray.INDArray
getVertexVector(int vertexIdx)
org.nd4j.linalg.api.ndarray.INDArray
getVertexVector(Vertex<V> vertex)
int
numVertices()
double
similarity(int vertexIdx1, int vertexIdx2)
Returns the cosine similarity of the vector representations of two vertices in the graph, given the indices of these verticiesdouble
similarity(Vertex<V> vertex1, Vertex<V> vertex2)
Returns the cosine similarity of the vector representations of two vertices in the graphint[]
verticesNearest(int vertexIdx, int top)
-
-
-
Field Detail
-
lookupTable
protected GraphVectorLookupTable lookupTable
-
-
Method Detail
-
numVertices
public int numVertices()
- Specified by:
numVertices
in interfaceGraphVectors<V,E>
-
getVectorSize
public int getVectorSize()
- Specified by:
getVectorSize
in interfaceGraphVectors<V,E>
-
getVertexVector
public org.nd4j.linalg.api.ndarray.INDArray getVertexVector(Vertex<V> vertex)
- Specified by:
getVertexVector
in interfaceGraphVectors<V,E>
-
getVertexVector
public org.nd4j.linalg.api.ndarray.INDArray getVertexVector(int vertexIdx)
- Specified by:
getVertexVector
in interfaceGraphVectors<V,E>
-
verticesNearest
public int[] verticesNearest(int vertexIdx, int top)
- Specified by:
verticesNearest
in interfaceGraphVectors<V,E>
-
similarity
public double similarity(Vertex<V> vertex1, Vertex<V> vertex2)
Returns the cosine similarity of the vector representations of two vertices in the graph- Specified by:
similarity
in interfaceGraphVectors<V,E>
- Returns:
- Cosine similarity of two vertices
-
similarity
public double similarity(int vertexIdx1, int vertexIdx2)
Returns the cosine similarity of the vector representations of two vertices in the graph, given the indices of these verticies- Specified by:
similarity
in interfaceGraphVectors<V,E>
- Returns:
- Cosine similarity of two vertices
-
-