Pypgx MLlib¶
Graph machine learning tools for use with PGX.
-
class
pypgx.api.mllib.DeepWalkModel(java_deepwalk_model)¶ Bases:
pypgx.api._pgx_context_manager.PgxContextManagerDeepWalk model object.
-
compute_similars(v, k)¶ Compute the top-k similar vertices for a given vertex.
- Parameters
v – id of the vertex or list of vetex ids for which to compute the similar vertices
k – number of similars to return
-
destroy()¶ Destroy this model object.
-
export()¶ Return a ModelStore object which can be used to save the model.
- Returns
ModelStore object
-
fit(graph)¶ Fit the model on a graph.
- Parameters
graph – Graph to fit on
-
store(path, key, overwrite=False)¶ Store the model in a file.
- Parameters
path – Path where to store the model
key – Encryption key
overwrite – Whether or not to overwrite pre-existing file
-
property
trained_vectors¶ Get the trained vertex vectors for the current DeepWalk model.
- Returns
PgxFrame object with the trained vertex vectors
-
-
class
pypgx.api.mllib.GraphWiseConvLayerConfig(java_config, params)¶ Bases:
objectGraphWise conv layer configuration.
-
class
pypgx.api.mllib.GraphWiseDgiLayerConfig(java_config, params)¶ Bases:
objectGraphWise dgi layer configuration.
-
class
pypgx.api.mllib.GraphWisePredictionLayerConfig(java_config, params)¶ Bases:
objectGraphWise prediction layer configuration.
-
class
pypgx.api.mllib.Pg2vecModel(java_pg2vec_model)¶ Bases:
pypgx.api._pgx_context_manager.PgxContextManagerPg2Vec model object.
-
compute_similars(graphlet_id, k)¶ Compute the top-k similar graphlets for a list of input graphlets.
- Parameters
graphlet_id – graphletIds or iterable of graphletIds
k – number of similars to return
-
destroy()¶ Destroy this model object.
-
export()¶ Return a ModelStore object which can be used to save the model.
- Returns
ModelStore object
-
fit(graph)¶ Fit the model on a graph.
- Parameters
graph – Graph to fit on
-
infer_graphlet_vector(graph)¶ - Parameters
graph – graphlet for which to infer a vector
-
infer_graphlet_vector_batched(graph)¶ - Parameters
graph – graphlets (as a single graph but different graphlet-id) for which to infer vectors
-
store(path, key, overwrite=False)¶ Store the model in a file.
- Parameters
path – Path where to store the model
key – Encryption key
overwrite – Whether or not to overwrite pre-existing file
-
property
trained_graphlet_vectors¶ Get the trained graphlet vectors for the current pg2vec model.
- Returns
PgxFrame containing the trained graphlet vectors
-
-
class
pypgx.api.mllib.SupervisedGraphWiseModel(java_graphwise_model, params={})¶ Bases:
pypgx.api.mllib._graphwise_model.GraphWiseModelSupervisedGraphWise model object.
-
export()¶ Return a ModelStore object which can be used to save the model.
- Returns
ModelStore object
-
fit(graph)¶ Fit the model on a graph.
- Parameters
graph – Graph to fit on
-
store(path, key, overwrite=False)¶ Store the model in a file.
- Parameters
path – Path where to store the model
key – Encryption key
overwrite – Whether or not to overwrite pre-existing file
-
-
class
pypgx.api.mllib.UnsupervisedGraphWiseModel(java_graphwise_model, params={})¶ Bases:
pypgx.api.mllib._graphwise_model.GraphWiseModelUnsupervisedGraphWise model object.
-
export()¶ Return a ModelStore object which can be used to save the model.
- Returns
ModelStore object
-
fit(graph)¶ Fit the model on a graph.
- Parameters
graph – Graph to fit on
-
store(path, key, overwrite=False)¶ Store the model in a file.
- Parameters
path – Path where to store the model
key – Encryption key
overwrite – Whether or not to overwrite pre-existing file
-