pygip.models.attack.CEGA¶
Module Attributes
- class pygip.models.attack.CEGA.CEGA(dataset, attack_node_fraction, model_path=None)[source]¶
Bases:
BaseAttack
- _abc_impl = <_abc_data object>¶
- attack(seed=1, cuda=None, LR=0.001, TGT_LR=0.01, EVAL_EPOCH=10, TGT_EPOCH=10, WARMUP_EPOCH=4, dropout=False, model_performance=True, **kwargs)[source]¶
Execute the attack.
- supported_api_types = {'dgl'}¶
- pygip.models.attack.CEGA.attack0(dataset_name, seed, cuda, attack_node_arg=0.25, file_path='', LR=0.001, TGT_LR=0.01, EVAL_EPOCH=1000, TGT_EPOCH=1000, WARMUP_EPOCH=400, dropout=False, model_performance=True, **kwargs)[source]¶
- pygip.models.attack.CEGA.convert_pyg_to_dgl(pyg_data)[source]¶
Converts a PyTorch Geometric Data object into a DGLGraph.
- Parameters:
pyg_data (torch_geometric.data.Data) – PyTorch Geometric Data object.
- Returns:
The converted DGL graph.
- Return type:
dgl.DGLGraph
- pygip.models.attack.CEGA.get_max_info_entropy_node_set(idx_used, high_score_nodes, labels, batch_size, adj_matrix2, num_class, model_prediction)[source]¶
- pygip.models.attack.CEGA.get_max_nnd_node_dense(idx_used, high_score_nodes, min_distance, distance_aax, num_ones, num_node, adj_matrix2, gamma=1)[source]¶
- pygip.models.attack.CEGA.get_receptive_fields_dense(cur_neighbors, selected_node, weighted_score, adj_matrix2)[source]¶
- pygip.models.attack.CEGA.load_data_from_grain(path='./data', dataset='cora')[source]¶
ind.[:dataset].x => the feature vectors of the training instances (scipy.sparse.csr.csr_matrix) ind.[:dataset].y => the one-hot labels of the labeled training instances (numpy.ndarray) ind.[:dataset].allx => the feature vectors of both labeled and unlabeled training instances (csr_matrix) ind.[:dataset].ally => the labels for instances in ind.dataset_str.allx (numpy.ndarray) ind.[:dataset].graph => the dict in the format {index: [index of neighbor nodes]} (collections.defaultdict) ind.[:dataset].tx => the feature vectors of the test instances (scipy.sparse.csr.csr_matrix) ind.[:dataset].ty => the one-hot labels of the test instances (numpy.ndarray) ind.[:dataset].test.index => indices of test instances in graph, for the inductive setting
- pygip.models.attack.CEGA.perturb_avg(net, sub_g, sub_features, num_perturbations, noise_level)[source]¶
- pygip.models.attack.CEGA.quantile_selection(A, B, C, index_1, index_2, index_3, sub_train_mask, sub_train_mask_new, num_each)[source]¶
- pygip.models.attack.CEGA.rank_centrality(sub_g, sub_train_mask, sub_train_mask_new, num_each, return_rank=True)[source]¶
- pygip.models.attack.CEGA.rank_cluster(net, sub_g, sub_features, labels, total_sub_nodes, sub_train_mask, sub_train_mask_new, num_clusters, num_each, return_rank=True)[source]¶
- pygip.models.attack.CEGA.rank_density(net, sub_g, sub_features, sub_train_mask, sub_train_mask_new, num_each, num_clusters, return_rank=True)[source]¶
- pygip.models.attack.CEGA.rank_diversity(net, sub_g, sub_features, sub_train_mask, sub_train_mask_new, num_each, num_clusters, rho, return_rank=True)[source]¶
- pygip.models.attack.CEGA.rank_entropy(net, sub_g, sub_features, sub_train_mask, sub_train_mask_new, num_each, return_rank=True)[source]¶
- pygip.models.attack.CEGA.rank_perturb(net, sub_g, sub_features, num_perturbations, sub_train_mask, sub_train_mask_new, noise_level, num_each, return_rank=True)[source]¶