Class GraphWiseModel<Config extends GraphWiseModelConfig, Metadata extends oracle.pgx.api.internal.mllib.GraphWiseModelMetadata<Config>, ModelType extends GraphWiseModel<Config, Metadata, ModelType>>
java.lang.Object
oracle.pgx.api.mllib.Model<ModelType>
oracle.pgx.api.mllib.GraphWiseModel<Config, Metadata, ModelType>
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
SupervisedGraphWiseModel, UnsupervisedGraphWiseModel
public abstract class GraphWiseModel<Config extends GraphWiseModelConfig, Metadata extends oracle.pgx.api.internal.mllib.GraphWiseModelMetadata<Config>, ModelType extends GraphWiseModel<Config, Metadata, ModelType>>
extends Model<ModelType>
Base class for GraphWiseModels
- Since:
- 19.4
-
Constructor Summary
ConstructorsConstructorDescriptionGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, Supplier<String> keystorePathSupplier, Supplier<char[]> keystorePasswordSupplier, Metadata modelMetadata, BiFunction<PgxSession, oracle.pgx.api.internal.Graph, PgxGraph> graphConstructor) This constructor should never be used to get a model. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Blocking version ofdestroyAsync().Destroys a GraphWise modeldoubleBlocking version offitAsync(PgxGraph).doubleBlocking version offitAsync(PgxGraph, PgxGraph).Trains the GraphWise model on the input graph.Trains the GraphWise model on the input trainGraph and evaluate on the input valGraph.intGets the batch sizeGets the model configuration objectGets the configuration objects for the convolutional layersintGets the edges input feature dimension, that is, the dimension of all the input vertex properties when concatenatedGets the edges input feature namesintGets the dimension of the embeddingsintGets the input feature dimension, that is, the dimension of all the input vertex properties when concatenateddoubleGets the initial learning rateintGets the number of epochs to train the modelgetSeed()Gets the random seedBlocking version ofgetTrainingLogAsync().Gets the training log that has evaluation results from validation.doubleGets the final training lossGets the vertices input feature names<ID> PgxFrameinferEmbeddings(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Blocking version ofinferEmbeddingsAsync(PgxGraph, Iterable).inferEmbeddingsAsync(PgxGraph graph, Iterable<PgxVertex<ID>> vertices) Infers the embeddings for the specified vertices.booleanisFitted()Checks if the model is fitted
-
Constructor Details
-
GraphWiseModel
public GraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, Supplier<String> keystorePathSupplier, Supplier<char[]> keystorePasswordSupplier, Metadata modelMetadata, BiFunction<PgxSession, oracle.pgx.api.internal.Graph, PgxGraph> graphConstructor) 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 connectedmodelMetadata- Metadata concerning the different hyper-parameters of the GraphWise Model- Since:
- 19.4
-
-
Method Details
-
destroyAsync
Destroys a GraphWise model- Specified by:
destroyAsyncin classModel<ModelType extends GraphWiseModel<Config, Metadata, ModelType>>- Returns:
- a future which will be completed once the destruction request finishes.
- Since:
- 19.4
-
destroy
Blocking version ofdestroyAsync(). CallsdestroyAsync()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
-
getNumEpochs
public int getNumEpochs()Gets the number of epochs to train the model- Returns:
- number of epochs to train the model
- Since:
- 19.4
-
getLearningRate
public double getLearningRate()Gets the initial learning rate- Returns:
- initial learning rate
- Since:
- 19.4
-
getBatchSize
public int getBatchSize()Gets the batch size- Returns:
- batch size
- Since:
- 19.4
-
getEmbeddingDim
public int getEmbeddingDim()Gets the dimension of the embeddings- Returns:
- embedding dimension
- Since:
- 19.4
-
getSeed
-
getConvLayerConfigs
Gets the configuration objects for the convolutional layers- Returns:
- configurations
- Since:
- 19.4
-
getVertexInputPropertyNames
-
getEdgeInputPropertyNames
-
isFitted
public boolean isFitted()Checks if the model is fitted- Returns:
- true if the model is fitted
- Since:
- 19.4
-
getTrainingLoss
public double getTrainingLoss()Gets the final training loss- Returns:
- training loss
- Since:
- 19.4
-
getInputFeatureDim
public int getInputFeatureDim()Gets the input feature dimension, that is, the dimension of all the input vertex properties when concatenated- Returns:
- input feature dimension
- Since:
- 19.4
-
getEdgeInputFeatureDim
public int getEdgeInputFeatureDim()Gets the edges input feature dimension, that is, the dimension of all the input vertex properties when concatenated- Returns:
- edges input feature dimension
- Since:
- 21.2
-
getConfig
Gets the model configuration object- Returns:
- model configuration
- Since:
- 19.4
-
getTrainingLogAsync
-
getTrainingLog
Blocking version ofgetTrainingLogAsync(). CallsgetTrainingLogAsync()and waits for the returnedPgxFutureto complete.- Returns:
- training log
- 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:
- 24.2
-
fitAsync
-
fitAsync
-
fit
Blocking version offitAsync(PgxGraph). CallsfitAsync(PgxGraph)and waits for the returnedPgxFutureto complete.- Parameters:
graph- input graph to fit on.- Returns:
- the training loss of the last batch
- 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
-
fit
public double fit(PgxGraph trainGraph, PgxGraph valGraph) throws ExecutionException, InterruptedException Blocking version offitAsync(PgxGraph, PgxGraph). CallsfitAsync(PgxGraph, PgxGraph)and waits for the returnedPgxFutureto complete.- Parameters:
trainGraph- input graph to fit on.valGraph- input graph to evaluate on for validation.- Returns:
- the training loss of the last batch
- 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:
- 24.2
-
inferEmbeddingsAsync
-
inferEmbeddings
Blocking version ofinferEmbeddingsAsync(PgxGraph, Iterable). Infers the embeddings for the specified vertices.- Returns:
- PgxFrame containing the embeddings for each vertex.
- Since:
- 19.4
-