Package oracle.pgx.api.mllib
Class UnsupervisedGraphWiseModel
- java.lang.Object
-
- oracle.pgx.api.mllib.Model<ModelType>
-
- oracle.pgx.api.mllib.GraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>
-
- oracle.pgx.api.mllib.UnsupervisedGraphWiseModel
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
UnsupervisedAnomalyDetectionGraphWiseModel
public class UnsupervisedGraphWiseModel extends GraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>
A variant of Deep Graph Infomax (DGI). SeeUnsupervisedGraphWiseModelBuilderfor documentation of the hyperparameters.- Since:
- 21.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUnsupervisedGraphWiseModel.UnsupervisedGraphWiseInferenceType
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALGORITHM_NAME
-
Constructor Summary
Constructors Constructor Description UnsupervisedGraphWiseModel(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, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor)UnsupervisedGraphWiseModel(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.UnsupervisedGraphWiseModelMetadata modelMetadata, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor)This constructor should never be used to get a model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PgxFuture<java.lang.Double>fitAsync(PgxGraph graph)Trains the GraphWise model on the input graph.PgxFuture<java.lang.Double>fitAsync(PgxGraph trainGraph, PgxGraph valGraph)Trains the GraphWise model on the input graph.GraphWiseEmbeddingConfiggetEmbeddingConfig()Gets the configuration object for the embedding methodUnsupervisedGraphWiseModelConfig.LossFunctiongetLossFunction()Gets the loss functionPgxFuture<PgxFrame>getTrainingLogAsync()Gets the training log that has evaluation results from validation.UnsupervisedGnnExplainergnnExplainer()Get a GnnExplainer object that can explain this model's predictions.<ID> PgxFuture<PgxFrame>inferEmbeddingsAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices)Infers the embeddings for the specified vertices.voidstore(java.lang.String path, java.lang.String key)Blocking version ofstoreAsync(String, String).voidstore(java.lang.String path, java.lang.String key, boolean overwrite)Blocking version ofstoreAsync(String, String).PgxFuture<java.lang.Void>storeAsync(java.lang.String path, java.lang.String key)Stores the GraphWise model in the specified path, with encryption.PgxFuture<java.lang.Void>storeAsync(java.lang.String path, java.lang.String key, boolean overwrite)Stores the GraphWise model in the specified path, with encryption.-
Methods inherited from class oracle.pgx.api.mllib.GraphWiseModel
destroy, destroyAsync, fit, fit, getBatchSize, getConfig, getConvLayerConfigs, getEdgeInputFeatureDim, getEdgeInputPropertyNames, getEmbeddingDim, getInputFeatureDim, getLearningRate, getNumEpochs, getSeed, getTrainingLog, getTrainingLoss, getVertexInputPropertyNames, inferEmbeddings, isFitted
-
-
-
-
Field Detail
-
ALGORITHM_NAME
public static final java.lang.String ALGORITHM_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnsupervisedGraphWiseModel
public UnsupervisedGraphWiseModel(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.UnsupervisedGraphWiseModelMetadata modelMetadata, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor)
This constructor should never be used to get a model. UseUnsupervisedGraphWiseModelBuilderinstead.- Parameters:
session- PgxSession to which the model is connectedcore- Core to which the model is connectedmodelMetadata- Metadata concerning the different hyper-parameters of the GraphWise Model- Since:
- 21.2
-
UnsupervisedGraphWiseModel
public UnsupervisedGraphWiseModel(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, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor)
-
-
Method Detail
-
fitAsync
public PgxFuture<java.lang.Double> fitAsync(PgxGraph graph)
Trains the GraphWise model on the input graph.- Specified by:
fitAsyncin classGraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>- Parameters:
graph- input graph to fit on.- Since:
- 21.2
-
fitAsync
public PgxFuture<java.lang.Double> fitAsync(PgxGraph trainGraph, PgxGraph valGraph)
Trains the GraphWise model on the input graph.- Specified by:
fitAsyncin classGraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>- Parameters:
trainGraph- input train graph to fit on.valGraph- input graph to evaluate on for validation.- Since:
- 24.2
-
getTrainingLogAsync
public PgxFuture<PgxFrame> getTrainingLogAsync()
Gets the training log that has evaluation results from validation. It is available only after the model was trained with validation.- Specified by:
getTrainingLogAsyncin classGraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>- Returns:
- training log
- Since:
- 24.2
-
inferEmbeddingsAsync
public <ID> PgxFuture<PgxFrame> inferEmbeddingsAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices)
Infers the embeddings for the specified vertices.- Specified by:
inferEmbeddingsAsyncin classGraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>- Returns:
- PgxFrame containing the embeddings for each vertex.
- Since:
- 21.2
-
gnnExplainer
public UnsupervisedGnnExplainer gnnExplainer()
Get a GnnExplainer object that can explain this model's predictions.- Returns:
- UnsupervisedGnnExplainer object
- Since:
- 22.2
-
storeAsync
public PgxFuture<java.lang.Void> storeAsync(java.lang.String path, java.lang.String key) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Stores the GraphWise model in the specified path, with encryption.- Parameters:
path- path to store the modelkey- the encryption key, or null if no encryption should be used.- Throws:
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedException- Since:
- 21.2
-
storeAsync
public PgxFuture<java.lang.Void> storeAsync(java.lang.String path, java.lang.String key, boolean overwrite)
Stores the GraphWise model in the specified path, with encryption.- Parameters:
path- path to store the modelkey- the encryption key, or null if no encryption should be used.- Since:
- 21.2
-
store
public void store(java.lang.String path, java.lang.String key) throws java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionBlocking version ofstoreAsync(String, String). CallsstoreAsync(String, String)and waits for the returnedPgxFutureto complete.- Throws:
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.- Since:
- 21.2
-
store
public void store(java.lang.String path, java.lang.String key, boolean overwrite) throws java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionBlocking version ofstoreAsync(String, String). CallsstoreAsync(String, String)and waits for the returnedPgxFutureto complete.- Throws:
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.- Since:
- 21.2
-
getLossFunction
public UnsupervisedGraphWiseModelConfig.LossFunction getLossFunction()
Gets the loss function- Returns:
- loss function
- Since:
- 21.2
-
getEmbeddingConfig
public GraphWiseEmbeddingConfig getEmbeddingConfig()
Gets the configuration object for the embedding method- Returns:
- configuration
- Since:
- 23.2
-
-