Package oracle.pgx.api.mllib
Class Pg2vecModelBuilder
- java.lang.Object
-
- oracle.pgx.api.mllib.Pg2vecModelBuilder
-
public class Pg2vecModelBuilder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Pg2vecModelBuilder(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier)
Please do not use; only meant for being used by PGX itself.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pg2vecModel
build()
Builds the Pg2vec Model with the builder configurationint
getBatchSize()
Gets the batch size for training the model (default: 128)java.lang.String
getGraphLetIdPropertyName()
Gets the property name of the graphlet-id in the input graphjava.lang.String
getGraphletSizePropertyName()
Gets the property name for graphlet size (default: "graphletSize-Pg2vec")int
getLayerSize()
Gets the number of dimensions for the output vectors (default: 200)double
getLearningRate()
Gets the initial learning rate (default: 0.025)double
getMinLearningRate()
Gets the minimum learning rate (default: 0.0001)int
getMinWordFrequency()
Gets the minimum word frequency to consider before pruning (default: 1)int
getNumEpochs()
Gets the number of epochs to train the model (default: 2)java.lang.Long
getSeed()
Gets the random seed for training the model (default: null)java.lang.Boolean
getUseGraphletSize()
Gets whether to use or not the graphlet size (default: true)java.util.Collection<java.lang.String>
getVertexPropertyNames()
Gets the property names to consider for pg2vec model trainingint
getWalkLength()
Gets the length of the walks (default: 5)int
getWalksPerVertex()
Gets the number of walks to consider per vertex (default: 4)int
getWindowSize()
Gets the window size to consider while training the model (default: 5)boolean
isShuffle()
Gets whether the model will shuffle the shuffle the random walks before training on themPg2vecModelBuilder
setBatchSize(int batchSize)
Sets the batch size for training the model (default: 128)Pg2vecModelBuilder
setEnableAccelerator(boolean enableAccelerator)
If true, use the accelerator (GPU) if available as the machine learning backend.Pg2vecModelBuilder
setGraphLetIdPropertyName(java.lang.String graphLetIdName)
Sets the property name of the graphlet-id in the input graph (required input)Pg2vecModelBuilder
setGraphletSizePropertyName(java.lang.String graphletSizePropertyName)
Sets the property name for graphlet size (default: "graphletSize-Pg2vec")Pg2vecModelBuilder
setLayerSize(int layerSize)
Sets the number of dimensions for the output vectors (default: 200)Pg2vecModelBuilder
setLearningRate(double lr)
Sets the initial learning rate (default: 0.025)Pg2vecModelBuilder
setMinLearningRate(double minLr)
Sets the minimum learning rate (default: 0.0001)Pg2vecModelBuilder
setMinWordFrequency(int minWordFrequency)
Sets the minimum word frequency to consider before pruning (default: 1)Pg2vecModelBuilder
setNumEpochs(int numEpochs)
Sets the number of epochs to train the model (default: 2)Pg2vecModelBuilder
setSeed(java.lang.Long seed)
Sets the random seed for training the model.Pg2vecModelBuilder
setShuffle(boolean shuffle)
Sets whether to shuffle the random walks before training on themPg2vecModelBuilder
setUseGraphletSize(boolean useGraphletSize)
Sets whether to use or not the graphlet size (default: true)Pg2vecModelBuilder
setVertexPropertyNames(java.util.Collection<java.lang.String> vertexPropertyNames)
Sets the property names to consider for pg2vec model training (required input)Pg2vecModelBuilder
setWalkLength(int walkLength)
Sets the length of the walks (default: 5)Pg2vecModelBuilder
setWalksPerVertex(int walksPerVertex)
Sets the number of walks to consider per vertex (default: 4)Pg2vecModelBuilder
setWindowSize(int windowSize)
Sets the window size to consider while training the model (default: 5)
-
-
-
Constructor Detail
-
Pg2vecModelBuilder
public Pg2vecModelBuilder(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier)
Please do not use; only meant for being used by PGX itself. UseAnalyst.pg2vecModelBuilder()
to get a model builder instead.- Parameters:
session
- PgxSession to which the model is connectedcore
- Core to which the model is connected
-
-
Method Detail
-
setUseGraphletSize
public Pg2vecModelBuilder setUseGraphletSize(boolean useGraphletSize)
Sets whether to use or not the graphlet size (default: true)- Parameters:
useGraphletSize
- to use or not the graphlet size (default: true)- Returns:
- builder
-
getUseGraphletSize
public java.lang.Boolean getUseGraphletSize()
Gets whether to use or not the graphlet size (default: true)- Returns:
- to use or not the graphlet size (default: true)
-
setGraphLetIdPropertyName
public Pg2vecModelBuilder setGraphLetIdPropertyName(java.lang.String graphLetIdName)
Sets the property name of the graphlet-id in the input graph (required input)- Parameters:
graphLetIdName
- property name of the graphlet-id in the input graph- Returns:
- builder
-
getGraphLetIdPropertyName
public java.lang.String getGraphLetIdPropertyName()
Gets the property name of the graphlet-id in the input graph- Returns:
- property name of the graphlet-id in the input graph
-
setVertexPropertyNames
public Pg2vecModelBuilder setVertexPropertyNames(java.util.Collection<java.lang.String> vertexPropertyNames)
Sets the property names to consider for pg2vec model training (required input)- Parameters:
vertexPropertyNames
- property names to consider for pg2vec model training- Returns:
- builder
-
getVertexPropertyNames
public java.util.Collection<java.lang.String> getVertexPropertyNames()
Gets the property names to consider for pg2vec model training- Returns:
- property names to consider for pg2vec model training
-
setMinWordFrequency
public Pg2vecModelBuilder setMinWordFrequency(int minWordFrequency)
Sets the minimum word frequency to consider before pruning (default: 1)- Parameters:
minWordFrequency
- minimum word frequency to consider before pruning- Returns:
- builder
-
getMinWordFrequency
public int getMinWordFrequency()
Gets the minimum word frequency to consider before pruning (default: 1)- Returns:
- minimum word frequency to consider before pruning
-
setBatchSize
public Pg2vecModelBuilder setBatchSize(int batchSize)
Sets the batch size for training the model (default: 128)- Parameters:
batchSize
- batch size for training the model- Returns:
- builder
-
getBatchSize
public int getBatchSize()
Gets the batch size for training the model (default: 128)- Returns:
- batch size for training the model
-
setNumEpochs
public Pg2vecModelBuilder setNumEpochs(int numEpochs)
Sets the number of epochs to train the model (default: 2)- Parameters:
numEpochs
- number of epochs to train the model- Returns:
- builder
-
getNumEpochs
public int getNumEpochs()
Gets the number of epochs to train the model (default: 2)- Returns:
- number of epochs to train the model
-
setLayerSize
public Pg2vecModelBuilder setLayerSize(int layerSize)
Sets the number of dimensions for the output vectors (default: 200)- Parameters:
layerSize
- number of dimensions for the output vectors- Returns:
- builder
-
getLayerSize
public int getLayerSize()
Gets the number of dimensions for the output vectors (default: 200)- Returns:
- number of dimensions for the output vectors
-
setLearningRate
public Pg2vecModelBuilder setLearningRate(double lr)
Sets the initial learning rate (default: 0.025)- Parameters:
lr
- initial learning rate- Returns:
- builder
-
getLearningRate
public double getLearningRate()
Gets the initial learning rate (default: 0.025)- Returns:
- initial learning rate
-
setMinLearningRate
public Pg2vecModelBuilder setMinLearningRate(double minLr)
Sets the minimum learning rate (default: 0.0001)- Parameters:
minLr
- minimum learning rate- Returns:
- builder
-
getMinLearningRate
public double getMinLearningRate()
Gets the minimum learning rate (default: 0.0001)- Returns:
- minimum learning rate
-
setWindowSize
public Pg2vecModelBuilder setWindowSize(int windowSize)
Sets the window size to consider while training the model (default: 5)- Parameters:
windowSize
- window size to consider while training the model- Returns:
- builder
-
getWindowSize
public int getWindowSize()
Gets the window size to consider while training the model (default: 5)- Returns:
- window size to consider while training the model
-
setWalkLength
public Pg2vecModelBuilder setWalkLength(int walkLength)
Sets the length of the walks (default: 5)- Parameters:
walkLength
- length of the walks- Returns:
- builder
-
getWalkLength
public int getWalkLength()
Gets the length of the walks (default: 5)- Returns:
- length of the walks
-
setWalksPerVertex
public Pg2vecModelBuilder setWalksPerVertex(int walksPerVertex)
Sets the number of walks to consider per vertex (default: 4)- Parameters:
walksPerVertex
- number of walks to consider per vertex- Returns:
- builder
-
getWalksPerVertex
public int getWalksPerVertex()
Gets the number of walks to consider per vertex (default: 4)- Returns:
- number of walks to consider per vertex
-
setGraphletSizePropertyName
public Pg2vecModelBuilder setGraphletSizePropertyName(java.lang.String graphletSizePropertyName)
Sets the property name for graphlet size (default: "graphletSize-Pg2vec")- Returns:
- builder
-
getGraphletSizePropertyName
public java.lang.String getGraphletSizePropertyName()
Gets the property name for graphlet size (default: "graphletSize-Pg2vec")- Returns:
- property name for graphlet size
-
setSeed
public Pg2vecModelBuilder setSeed(java.lang.Long seed)
Sets the random seed for training the model. If set to null, execution will be non-deterministic.Note that setting the seed will limit the amount of threads during the learning phase to 1
- Parameters:
seed
- random seed for training the model- Returns:
- builder
-
getSeed
public java.lang.Long getSeed()
Gets the random seed for training the model (default: null)- Returns:
- seed random seed for training the model
-
setShuffle
public Pg2vecModelBuilder setShuffle(boolean shuffle)
Sets whether to shuffle the random walks before training on them- Parameters:
shuffle
- whether to shuffle- Returns:
- builder
-
isShuffle
public boolean isShuffle()
Gets whether the model will shuffle the shuffle the random walks before training on them- Returns:
- whether the model will shuffle the random walks
-
setEnableAccelerator
public Pg2vecModelBuilder setEnableAccelerator(boolean enableAccelerator)
If true, use the accelerator (GPU) if available as the machine learning backend.default: {true}
- Parameters:
enableAccelerator
- whether to use the accelerator if available- Returns:
- this
- Since:
- 24.1
-
build
public Pg2vecModel build() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Builds the Pg2vec Model with the builder configuration- Returns:
- Pg2vec model
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
-