Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
LukyanovKirillML committed Dec 28, 2024
1 parent 72c3752 commit 9db1a40
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nodes": [1415], "metrics_params": {"stability_graph_perturbations_nums": 1, "stability_feature_change_percent": 0.05, "stability_node_removal_percent": 0.05, "consistency_num_explanation_runs": 1}, "num_nodes": 1, "explainer_kwargs": {}}
15 changes: 8 additions & 7 deletions experiments/interpretation_metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import torch

from aux.custom_decorators import timing_decorator
from aux.custom_decorators import timing_decorator, retry
from aux.utils import EXPLAINERS_LOCAL_RUN_PARAMETERS_PATH, EXPLAINERS_INIT_PARAMETERS_PATH, root_dir, \
EVASION_DEFENSE_PARAMETERS_PATH, EVASION_ATTACK_PARAMETERS_PATH, POISON_ATTACK_PARAMETERS_PATH
from explainers.explainers_manager import FrameworkExplainersManager
Expand Down Expand Up @@ -60,15 +60,16 @@ def explainer_run_config_for_node(explainer_name, node_ind, explainer_kwargs=Non
)


@retry(max_tries=5)
@timing_decorator
def run_interpretation_test(explainer_name, dataset_full_name, model_name, iter=0):
steps_epochs = 10
num_explaining_nodes = 1
steps_epochs = 200
num_explaining_nodes = 5
explaining_metrics_params = {
"stability_graph_perturbations_nums": 1,
"stability_graph_perturbations_nums": 3,
"stability_feature_change_percent": 0.05,
"stability_node_removal_percent": 0.05,
"consistency_num_explanation_runs": 1,
"consistency_num_explanation_runs": 3,
}
# steps_epochs = 200
# num_explaining_nodes = 30
Expand Down Expand Up @@ -361,7 +362,7 @@ def calculate_adversial_defence_metrics(
_import_path=EVASION_ATTACK_PARAMETERS_PATH,
_config_class="EvasionAttackConfig",
_config_kwargs={
"epsilon": 0.1 * 1,
"epsilon": 0.05 * 1,
}
)
at_evasion_defense_config = ConfigPattern(
Expand Down Expand Up @@ -463,7 +464,7 @@ def calculate_gnnguard_defence_metrics(
_config_class="PoisonDefenseConfig",
_config_kwargs={
"lr": 0.01,
"train_iters": 100,
"train_iters": 200,
# "model": gnn_model_manager.gnn
}
)
Expand Down
8 changes: 4 additions & 4 deletions metainfo/evasion_defense_parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"EmptyEvasionDefender": {
},
"GradientRegularizationDefender": {
"regularization_strength": ["regularization_strength", "float", 0.1, {"min": 0.0001, "step": 0.01}, "?"]
"regularization_strength": ["regularization_strength", "float", 50, {"min": 0.0001, "step": 0.01}, "?"]
},
"QuantizationDefender": {
"num_levels": ["num_levels", "int", 32, {"min": 2, "step": 1}, "?"]
"num_levels": ["num_levels", "int", 8, {"min": 2, "step": 1}, "?"]
},
"DistillationDefender": {
"temperature": ["temperature", "float", 5.0, {"min": 1, "step": 0.01}, "?"]
},
"AutoEncoderDefender": {
"hidden_dim": ["hidden_dim", "int", 5, {"min": 3, "step": 1}, "?"],
"bottleneck_dim": ["bottleneck_dim", "int", 3, {"min": 1, "step": 1}, "?"],
"hidden_dim": ["hidden_dim", "int", 7, {"min": 3, "step": 1}, "?"],
"bottleneck_dim": ["bottleneck_dim", "int", 5, {"min": 1, "step": 1}, "?"],
"reconstruction_loss_weight": ["reconstruction_loss_weight", "float", 0.1, {"min": 0.0001, "step": 0.01}, "?"]
},
"AdvTraining": {
Expand Down

0 comments on commit 9db1a40

Please sign in to comment.