Package oracle.pgx.api.mllib
Class UnsupervisedEdgeWiseModel
- java.lang.Object
-
- oracle.pgx.api.mllib.Model<ModelType>
-
- oracle.pgx.api.mllib.EdgeWiseModel<UnsupervisedEdgeWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata,UnsupervisedEdgeWiseModel>
-
- oracle.pgx.api.mllib.UnsupervisedEdgeWiseModel
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class UnsupervisedEdgeWiseModel extends EdgeWiseModel<UnsupervisedEdgeWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata,UnsupervisedEdgeWiseModel>
A variant of GraphSAGE working on edges. SeeUnsupervisedEdgeWiseModelBuilderfor documentation of the hyperparameters.- Since:
- 23.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUnsupervisedEdgeWiseModel.UnsupervisedEdgeWiseInferenceType
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALGORITHM_NAME
-
Constructor Summary
Constructors Constructor Description UnsupervisedEdgeWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata)UnsupervisedEdgeWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata modelMetadata)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 EdgeWise model on the input graph.PgxFuture<java.lang.Double>fitAsync(PgxGraph trainGraph, PgxGraph valGraph)Trains the EdgeWise model on the input graph.GraphWiseDgiLayerConfiggetDgiLayerConfigs()Gets the configuration object for the dgi layerUnsupervisedEdgeWiseModelConfig.LossFunctiongetLossFunction()Gets the loss functionjava.util.List<java.util.Set<java.lang.String>>getTargetEdgeLabels()Gets the target vertex labelsPgxFuture<PgxFrame>getTrainingLogAsync()Gets the training log that has evaluation results from validation.PgxFuture<PgxFrame>inferEmbeddingsAsync(PgxGraph graph, java.lang.Iterable<PgxEdge> edges)Infers the embeddings for the specified edges.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.EdgeWiseModel
destroy, destroyAsync, fit, fit, getBatchSize, getConfig, getConvLayerConfigs, getEdgeCombinationMethod, 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
-
UnsupervisedEdgeWiseModel
public UnsupervisedEdgeWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata modelMetadata)
This constructor should never be used to get a model. UseUnsupervisedEdgeWiseModelBuilderinstead.- Parameters:
session- PgxSession to which the model is connectedcore- Core to which the model is connectedgraphConstructor- Constructor for a PgxGraphmodelMetadata- Metadata concerning the different hyper-parameters of the EdgeWise Model- Since:
- 23.2
-
UnsupervisedEdgeWiseModel
public UnsupervisedEdgeWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata)
-
-
Method Detail
-
fitAsync
public PgxFuture<java.lang.Double> fitAsync(PgxGraph graph)
Trains the EdgeWise model on the input graph.- Specified by:
fitAsyncin classEdgeWiseModel<UnsupervisedEdgeWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata,UnsupervisedEdgeWiseModel>- Parameters:
graph- input graph to fit on.- Since:
- 23.2
-
fitAsync
public PgxFuture<java.lang.Double> fitAsync(PgxGraph trainGraph, PgxGraph valGraph)
Trains the EdgeWise model on the input graph.- Specified by:
fitAsyncin classEdgeWiseModel<UnsupervisedEdgeWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata,UnsupervisedEdgeWiseModel>- 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 classEdgeWiseModel<UnsupervisedEdgeWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata,UnsupervisedEdgeWiseModel>- Returns:
- training log
- Since:
- 24.2
-
inferEmbeddingsAsync
public PgxFuture<PgxFrame> inferEmbeddingsAsync(PgxGraph graph, java.lang.Iterable<PgxEdge> edges)
Infers the embeddings for the specified edges.- Specified by:
inferEmbeddingsAsyncin classEdgeWiseModel<UnsupervisedEdgeWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedEdgeWiseModelMetadata,UnsupervisedEdgeWiseModel>- Parameters:
graph- the input graphedges- the edges to produce embeddings to- Returns:
- PgxFrame containing the embeddings for each edge.
- Since:
- 23.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:
- 23.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:
- 23.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:
- 23.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:
- 23.2
-
getLossFunction
public UnsupervisedEdgeWiseModelConfig.LossFunction getLossFunction()
Gets the loss function- Returns:
- loss function
- Since:
- 23.2
-
getTargetEdgeLabels
public java.util.List<java.util.Set<java.lang.String>> getTargetEdgeLabels()
Gets the target vertex labels- Returns:
- target vertex labels
- Since:
- 23.2
-
getDgiLayerConfigs
public GraphWiseDgiLayerConfig getDgiLayerConfigs()
Gets the configuration object for the dgi layer- Returns:
- configuration
- Since:
- 23.2
-
-