pygip.models.defense.atom package

Submodules

pygip.models.defense.atom.ATOM module

class pygip.models.defense.atom.ATOM.ATOM(dataset, attack_node_fraction=0)[source]

Bases: BaseDefense

_abc_impl = <_abc_data object>
_load_data_and_model(dataset, batch_size=16, seed=0, lamb=0)[source]
defend()[source]

Execute the defense mechanism.

supported_api_types = {'pyg'}
supported_datasets = {'CiteSeer', 'Cora', 'PubMed'}
class pygip.models.defense.atom.ATOM.FusionGRU(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(h_it, h_it_m1, hidden_state)[source]
process_sequence(inputs, hidden_state=None)[source]
class pygip.models.defense.atom.ATOM.GCN(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(x, edge_index)[source]
class pygip.models.defense.atom.ATOM.Memory[source]

Bases: object

clear()[source]
store(custom_states, action, log_prob, reward, done, entropy, probs=None, masks=None)[source]
class pygip.models.defense.atom.ATOM.PPOAgent(*args: Any, **kwargs: Any)[source]

Bases: Module

select_action(state)[source]
update(memory)[source]
class pygip.models.defense.atom.ATOM.PolicyNetwork(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(state)[source]
class pygip.models.defense.atom.ATOM.SequencesDataset(*args: Any, **kwargs: Any)[source]

Bases: Dataset

class pygip.models.defense.atom.ATOM.StateTransformMLP(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(prob_factor)[source]
class pygip.models.defense.atom.ATOM.TargetGCN(trained_model, data)[source]

Bases: object

get_embedding()[source]
predict(query_indices)[source]
pygip.models.defense.atom.ATOM.average_pooling_with_neighbors(model, data, node_idx)[source]
pygip.models.defense.atom.ATOM.average_pooling_with_neighbors_batch(model, data, node_indices)[source]
pygip.models.defense.atom.ATOM.build_loaders(csv_path='attack_CiteSeer.csv', batch_size=16, drop_last=True, seed=42)[source]
pygip.models.defense.atom.ATOM.collate_fn_no_pad(batch)[source]
pygip.models.defense.atom.ATOM.compute_embedding_batch(target_model, data, k_core_values_graph, max_k_core, node_indices, lamb=1.0)[source]
pygip.models.defense.atom.ATOM.compute_returns_and_advantages(memory, gamma=0.99, lam=0.95)[source]
pygip.models.defense.atom.ATOM.custom_reward_function(predicted, label, predicted_distribution=None)[source]
pygip.models.defense.atom.ATOM.get_node_embedding(model, data, node_idx)[source]
pygip.models.defense.atom.ATOM.get_one_hop_neighbors(data, node_idx)[source]
pygip.models.defense.atom.ATOM.k_core_decomposition(graph)[source]
pygip.models.defense.atom.ATOM.load_data_and_model(csv_path, batch_size, seed, data_path, lamb)[source]
pygip.models.defense.atom.ATOM.precompute_all_node_embeddings(target_model, data, k_core_values_graph, max_k_core, lamb=1.0)[source]
pygip.models.defense.atom.ATOM.precompute_simple_embeddings(target_model, data)[source]
pygip.models.defense.atom.ATOM.preprocess_sequences(df)[source]
pygip.models.defense.atom.ATOM.set_seed(seed)[source]
pygip.models.defense.atom.ATOM.simple_embedding_batch(target_model, data, node_indices)[source]
pygip.models.defense.atom.ATOM.split_and_adjust(dataset_sequences, seed)[source]
pygip.models.defense.atom.ATOM.test_model(agent, gru, mlp_transform, test_loader, target_model, data, all_embeddings, hidden_size, device)[source]
pygip.models.defense.atom.ATOM.train_gcn(model, data, optimizer, criterion, epochs=200, verbose=True)[source]

Module contents