public class DeepWalkModel extends Model<DeepWalkModel>
Constructor and Description |
---|
DeepWalkModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, oracle.pgx.api.internal.mllib.DeepWalkModelMetadata modelMetadata)
Please do not use; only meant for being used by PGX itself.
|
DeepWalkModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata) |
Modifier and Type | Method and Description |
---|---|
PgxFrame |
computeSimilars(java.util.List<java.lang.Object> vertexIds, int k)
Blocking version of
computeSimilarsAsync(List, int) . |
PgxFrame |
computeSimilars(java.lang.Object vertexId, int k)
Blocking version of
computeSimilarsAsync(Object, int) . |
PgxFuture<PgxFrame> |
computeSimilarsAsync(java.util.List<java.lang.Object> vertexIdObjects, int k)
Computes the top-k similar vertices for a list of input vertices
|
PgxFuture<PgxFrame> |
computeSimilarsAsync(java.lang.Object vertexIdObject, int k)
Computes the top-k similar vertices for a given vertex
|
void |
destroy()
Blocking version of
destroyAsync() . |
PgxFuture<java.lang.Void> |
destroyAsync()
Destroys a pre-trained DeepWalk model
|
void |
fit(PgxGraph graph)
Blocking version of
fitAsync(PgxGraph) . |
PgxFuture<java.lang.Void> |
fitAsync(PgxGraph graph)
Trains the DeepWalk model on the input graph
|
int |
getBatchSize()
Gets the batch size of the model
|
int |
getLayerSize()
Gets the number of dimensions for the output vectors
|
double |
getLearningRate()
Gets the initial learning rate
|
double |
getLoss()
Gets the loss value during training
|
double |
getMinLearningRate()
Gets the minimum learning rate
|
int |
getMinWordFrequency()
Gets the minimum word frequency to consider before pruning
|
int |
getNegativeSample()
Gets the number of negative samples
|
int |
getNumEpochs()
Gets the number of epochs to train the model
|
double |
getSampleRate()
Gets the sampling rate
|
double |
getSeed()
Gets the random seed
|
PgxFrame |
getTrainedVertexVectors()
Blocking version of
getTrainedVertexVectorsAsync() . |
PgxFuture<PgxFrame> |
getTrainedVertexVectorsAsync()
Gets the trained vertex vectors for the current DeepWalk model
|
double |
getValidationFraction()
Gets the fraction of the training data used to compute the loss value
|
int |
getWalkLength()
Gets the length of the walks
|
int |
getWalksPerVertex()
Gets the number of walks to consider per vertex
|
int |
getWindowSize()
Gets the window size to consider while training the model
|
void |
store(java.lang.String path, java.lang.String key)
Blocking version of
storeAsync(String, String) . |
void |
store(java.lang.String path, java.lang.String key, boolean overwrite)
Blocking version of
storeAsync(String, String) . |
PgxFuture<java.lang.Void> |
storeAsync(java.lang.String path, java.lang.String key)
Stores the DeepWalk model in the specified path, with encryption.
|
PgxFuture<java.lang.Void> |
storeAsync(java.lang.String path, java.lang.String key, boolean overwrite)
Stores the DeepWalk model in the specified path, with encryption.
|
public DeepWalkModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, oracle.pgx.api.internal.mllib.DeepWalkModelMetadata modelMetadata)
Analyst.deepWalkModelBuilder()
to get a model builder and then create a model, or load a model with Analyst.loadDeepWalkModel(String, String)
.session
- PgxSession to which the model is connectedcore
- Core to which the model is connectedmodelMetadata
- Metadata concerning the different hyper-parameters of the DeepWalk Modelpublic DeepWalkModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata)
public PgxFrame computeSimilars(java.util.List<java.lang.Object> vertexIds, int k) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
computeSimilarsAsync(List, int)
. Calls computeSimilarsAsync(List, int)
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFrame computeSimilars(java.lang.Object vertexId, int k) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
computeSimilarsAsync(Object, int)
. Calls computeSimilarsAsync(Object, int)
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<PgxFrame> computeSimilarsAsync(java.util.List<java.lang.Object> vertexIdObjects, int k)
vertexIdObjects
- list of ids of vertices for which to compute the similar verticesk
- number of similars to returnpublic PgxFuture<PgxFrame> computeSimilarsAsync(java.lang.Object vertexIdObject, int k)
vertexIdObject
- id of the vertex for which to compute the similar verticesk
- number of similars to returnpublic void destroy() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
destroyAsync()
. Calls destroyAsync()
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<java.lang.Void> destroyAsync()
destroyAsync
in class Model<DeepWalkModel>
public void fit(PgxGraph graph) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
fitAsync(PgxGraph)
. Calls fitAsync(PgxGraph)
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<java.lang.Void> fitAsync(PgxGraph graph)
graph
- input graph to fit onpublic int getBatchSize()
public int getLayerSize()
public double getLearningRate()
public double getLoss()
public double getMinLearningRate()
public int getMinWordFrequency()
public int getNegativeSample()
public int getNumEpochs()
public double getSampleRate()
public double getSeed()
public PgxFrame getTrainedVertexVectors() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
getTrainedVertexVectorsAsync()
. Calls getTrainedVertexVectorsAsync()
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<PgxFrame> getTrainedVertexVectorsAsync()
public double getValidationFraction()
public int getWalkLength()
public int getWalksPerVertex()
public int getWindowSize()
public void store(java.lang.String path, java.lang.String key) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
storeAsync(String, String)
. Calls storeAsync(String, String)
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public void store(java.lang.String path, java.lang.String key, boolean overwrite) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
storeAsync(String, String)
. Calls storeAsync(String, String)
and waits for the returned PgxFuture
to complete.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<java.lang.Void> storeAsync(java.lang.String path, java.lang.String key)
path
- path to store the modelkey
- the encryption key, or null if no encryption should be used.public PgxFuture<java.lang.Void> storeAsync(java.lang.String path, java.lang.String key, boolean overwrite)
path
- path to store the modelkey
- the encryption key, or null if no encryption should be used.