pygip.models.attack.Realistic

Classes

DGLEdgePredictor(*args, **kwargs)

DGL version of edge prediction module

DGLSurrogateModel(*args, **kwargs)

DGL version of surrogate model

RealisticAttack(dataset, attack_node_fraction)

DGL-based GNN model extraction attack

class pygip.models.attack.Realistic.DGLEdgePredictor(*args: Any, **kwargs: Any)[source]

Bases: Module

DGL version of edge prediction module

forward(graph, features)[source]
predict_edges(node_embeddings, node_pairs)[source]

Predict edge existence probability

class pygip.models.attack.Realistic.DGLSurrogateModel(*args: Any, **kwargs: Any)[source]

Bases: Module

DGL version of surrogate model

forward(graph, features)[source]
class pygip.models.attack.Realistic.RealisticAttack(dataset, attack_node_fraction, model_path=None, hidden_dim=64, threshold_s=0.7, threshold_a=0.5)[source]

Bases: BaseAttack

DGL-based GNN model extraction attack

_abc_impl = <_abc_data object>
add_potential_edges(candidate_edges, labeled_nodes)[source]

Add potential edges based on edge prediction results

attack()[source]

Execute model extraction attack

compute_cosine_similarity(features)[source]

Compute cosine similarity of node features

evaluate_attack(enhanced_graph)[source]

Evaluate attack performance

generate_candidate_edges(labeled_nodes, unlabeled_nodes)[source]

Generate candidate edge set

simulate_target_model_queries(query_nodes, error_rate=0.15)[source]

Simulate target model queries with a certain proportion of incorrect labels

supported_api_types = {'dgl'}
supported_datasets = {}
train_edge_predictor(labeled_nodes, predicted_labels, epochs=100)[source]

Train edge prediction model

train_surrogate_model(enhanced_graph, labeled_nodes, predicted_labels, epochs=200)[source]

Train surrogate model