Package oracle.pgx.api.mllib
Class SupervisedGraphWiseModel
java.lang.Object
oracle.pgx.api.mllib.Model<ModelType>
oracle.pgx.api.mllib.GraphWiseModel<SupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata,SupervisedGraphWiseModel>
oracle.pgx.api.mllib.SupervisedGraphWiseModel
- All Implemented Interfaces:
AutoCloseable
public class SupervisedGraphWiseModel
extends GraphWiseModel<SupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata,SupervisedGraphWiseModel>
A variant of GraphSAGE.
See
SupervisedGraphWiseModelBuilder for documentation of the hyperparameters.- Since:
- 19.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSupervisedGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, Supplier<String> keystorePathSupplier, Supplier<char[]> keystorePasswordSupplier, BiFunction<PgxSession, oracle.pgx.api.internal.Graph, PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata) SupervisedGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, Supplier<String> keystorePathSupplier, Supplier<char[]> keystorePasswordSupplier, BiFunction<PgxSession, oracle.pgx.api.internal.Graph, PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata modelMetadata) This constructor should never be used to get a model. -
Method Summary
Modifier and TypeMethodDescription<ID> PgxFrameBlocking version ofevaluateAsync(PgxGraph, Iterable).<ID> PgxFrameBlocking version ofevaluateAsync(PgxGraph, Iterable).evaluateAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Evaluates (macro averaged) classification performance statistics for the specified vertices.evaluateAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Evaluates (macro averaged) classification performance statistics for the specified vertices.<ID> PgxFrameevaluateLabels(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Blocking version ofevaluateLabelsAsync(PgxGraph, Iterable).<ID> PgxFrameevaluateLabels(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Blocking version ofevaluateLabelsAsync(PgxGraph, Iterable, float).evaluateLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Evaluates (macro averaged) classification performance statistics for the specified vertices.evaluateLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Evaluates (macro averaged) classification performance statistics for the specified vertices.Trains the GraphWise model on the input graph.Trains the GraphWise model on the input trainGraph and evaluate on the input valGraph.Gets the class weightsGets the loss functionGets the configuration objects for the prediction layersGets the target vertex labelsGets the training log that has evaluation results from validation.Gets the target property nameGet a GnnExplainer object that can explain this model's predictions.<ID> PgxFrameBlocking version ofinferAsync(PgxGraph, Iterable).<ID> PgxFrameBlocking version ofinferAsync(PgxGraph, Iterable).inferAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Does inference for the specified vertices.inferAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Does inference for the specified vertices.inferEmbeddingsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Infers the embeddings for the specified vertices.<ID> PgxFrameinferLabels(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Blocking version ofinferLabelsAsync(PgxGraph, Iterable).<ID> PgxFrameinferLabels(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Blocking version ofinferLabelsAsync(PgxGraph, Iterable, float).inferLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Infers the labels for the specified vertices.inferLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Infers the labels for the specified vertices.<ID> PgxFrameinferLogits(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Blocking version ofinferLogitsAsync(PgxGraph, Iterable).inferLogitsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Infers the prediction logits for the specified vertices.voidBlocking version ofstoreAsync(String, String).voidBlocking version ofstoreAsync(String, String).storeAsync(String path, String key) Stores the GraphWise model in the specified path, with encryption.storeAsync(String path, 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 Details
-
ALGORITHM_NAME
- See Also:
-
-
Constructor Details
-
SupervisedGraphWiseModel
public SupervisedGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, Supplier<String> keystorePathSupplier, Supplier<char[]> keystorePasswordSupplier, BiFunction<PgxSession, oracle.pgx.api.internal.Graph, PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata modelMetadata) This constructor should never be used to get a model. UseSupervisedGraphWiseModelBuilderinstead.- 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 GraphWise Model- Since:
- 19.4
-
SupervisedGraphWiseModel
public SupervisedGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, Supplier<String> keystorePathSupplier, Supplier<char[]> keystorePasswordSupplier, BiFunction<PgxSession, oracle.pgx.api.internal.Graph, PgxGraph> graphConstructor, oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata)
-
-
Method Details
-
fitAsync
Trains the GraphWise model on the input graph.- Specified by:
fitAsyncin classGraphWiseModel<SupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata, SupervisedGraphWiseModel> - Parameters:
graph- input graph to fit on.- Since:
- 19.4
-
fitAsync
Trains the GraphWise model on the input trainGraph and evaluate on the input valGraph.- Specified by:
fitAsyncin classGraphWiseModel<SupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata, SupervisedGraphWiseModel> - Parameters:
trainGraph- input train graph to fit on.valGraph- input graph to evaluate on for validation.- Since:
- 24.2
-
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<SupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata, SupervisedGraphWiseModel> - Returns:
- training log
- Since:
- 24.2
-
inferEmbeddingsAsync
public <ID> PgxFuture<PgxFrame> inferEmbeddingsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Infers the embeddings for the specified vertices.- Specified by:
inferEmbeddingsAsyncin classGraphWiseModel<SupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata, SupervisedGraphWiseModel> - Parameters:
graph- the input graphvertices- the vertices to produce embeddings to- Returns:
- PgxFrame containing the embeddings for each vertex.
- Since:
- 19.4
-
inferLogitsAsync
Infers the prediction logits for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to produce logits to- Returns:
- PgxFrame containing the logits for each vertex.
- Since:
- 19.4
-
inferLogits
Blocking version ofinferLogitsAsync(PgxGraph, Iterable). Infers the prediction logits for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to produce logits to- Returns:
- PgxFrame containing the logits for each vertex.
- Since:
- 19.4
-
inferLabelsAsync
Infers the labels for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to produce labels to- Returns:
- PgxFrame containing the labels for each vertex.
- Since:
- 19.4
-
inferLabelsAsync
public <ID> PgxFuture<PgxFrame> inferLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Infers the labels for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to produce labels tothreshold- decision threshold for classification (unused for regression)- Returns:
- PgxFrame containing the labels for each vertex.
- Since:
- 21.4
-
evaluateLabelsAsync
public <ID> PgxFuture<PgxFrame> evaluateLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model on- Returns:
- PgxFrame containing the metrics
- Since:
- 19.4
-
evaluateLabelsAsync
public <ID> PgxFuture<PgxFrame> evaluateLabelsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model onthreshold- the decision threshold- Returns:
- PgxFrame containing the labels for each vertex.
- Since:
- 21.4
-
inferLabels
Blocking version ofinferLabelsAsync(PgxGraph, Iterable). Infers the labels for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to produce labels to- Returns:
- PgxFrame containing the labels for each vertex.
- Since:
- 19.4
-
inferLabels
Blocking version ofinferLabelsAsync(PgxGraph, Iterable, float). Infers the labels for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to produce labels tothreshold- decision threshold for classification (unused for regression)- Returns:
- PgxFrame containing the labels for each vertex.
- Since:
- 21.4
-
evaluateLabels
Blocking version ofevaluateLabelsAsync(PgxGraph, Iterable). Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model on- Returns:
- PgxFrame containing the metrics
- Since:
- 19.4
-
evaluateLabels
public <ID> PgxFrame evaluateLabels(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Blocking version ofevaluateLabelsAsync(PgxGraph, Iterable, float). Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model onthreshold- decision threshold for classification (unused for regression)- Returns:
- PgxFrame containing the labels for each vertex.
- Since:
- 21.4
-
inferAsync
Does inference for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to do inference on- Returns:
- PgxFrame containing the inference results for each vertex.
- Since:
- 23.1
-
inferAsync
public <ID> PgxFuture<PgxFrame> inferAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Does inference for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to do inference onthreshold- decision threshold for classification (unused for regression)- Returns:
- PgxFrame containing the inference results for each vertex.
- Since:
- 23.1
-
evaluateAsync
Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model on- Returns:
- PgxFrame containing the scores for each vertex.
- Since:
- 23.1
-
evaluateAsync
public <ID> PgxFuture<PgxFrame> evaluateAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices, float threshold) Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model onthreshold- decision threshold- Returns:
- PgxFrame containing the scores for each vertex.
- Since:
- 23.1
-
infer
Blocking version ofinferAsync(PgxGraph, Iterable). Does inference for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to do inference on- Returns:
- PgxFrame containing the inference results for each vertex.
- Since:
- 23.1
-
infer
Blocking version ofinferAsync(PgxGraph, Iterable). Does inference for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to do inference onthreshold- decision threshold for classification (unused for regression)- Returns:
- PgxFrame containing the inference results for each vertex.
- Since:
- 23.1
-
evaluate
Blocking version ofevaluateAsync(PgxGraph, Iterable). Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model on- Returns:
- PgxFrame containing the metrics
- Since:
- 23.1
-
evaluate
Blocking version ofevaluateAsync(PgxGraph, Iterable). Evaluates (macro averaged) classification performance statistics for the specified vertices.- Parameters:
graph- the input graphvertices- the vertices to evaluate the model onthreshold- decision threshold for classification (unused for regression)- Returns:
- PgxFrame containing the metrics
- Since:
- 23.1
-
storeAsync
public PgxFuture<Void> storeAsync(String path, String key) throws ExecutionException, 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:
ExecutionExceptionInterruptedException- Since:
- 19.4
-
storeAsync
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.1
-
store
Blocking version ofstoreAsync(String, String). CallsstoreAsync(String, String)and waits for the returnedPgxFutureto complete.- Throws:
InterruptedException- if the caller thread gets interrupted while waiting for completion.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.- Since:
- 19.4
-
store
public void store(String path, String key, boolean overwrite) throws ExecutionException, InterruptedException Blocking version ofstoreAsync(String, String). CallsstoreAsync(String, String)and waits for the returnedPgxFutureto complete.- Throws:
InterruptedException- if the caller thread gets interrupted while waiting for completion.ExecutionException- if any exception occurred during asynchronous execution. The actual exception will be nested.- Since:
- 21.1
-
getLossFunctionClass
Gets the loss function- Returns:
- loss function
- Since:
- 21.4
-
getPredictionLayerConfigs
Gets the configuration objects for the prediction layers- Returns:
- configurations
- Since:
- 19.4
-
getClassWeights
Gets the class weights- Returns:
- class weights
- Since:
- 19.4
-
getVertexTargetPropertyName
Gets the target property name- Returns:
- target property name
- Since:
- 19.4
-
gnnExplainer
Get a GnnExplainer object that can explain this model's predictions.- Returns:
- SupervisedGnnExplainer object
- Since:
- 22.2
-
getTargetVertexLabels
Gets the target vertex labels- Returns:
- target vertex labels
- Since:
- 22.2
-