From 0e2289344a34cc490beaeb80e2d9e3272afec4fd Mon Sep 17 00:00:00 2001 From: steffen-illium Date: Fri, 11 Jun 2021 14:38:22 +0200 Subject: [PATCH] robustness --- README.md | 25 +++++++++++++++---------- functionalities_test.py | 8 +++++--- journal_robustness.py | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5b2f39d..99d049e 100644 --- a/README.md +++ b/README.md @@ -12,31 +12,36 @@ - there is also a distance matrix for all-to-all particle comparisons (with distance parameter one of: `MSE`, `MAE` (mean absolute error = mean manhattan) and `MIM` (mean position invariant manhattan)) -- [ ] Same Thing with Soup interactionWe would expect the same behaviour...Influence of interaction with near and far away particles. - -- [ ] How are basins / "attractor areas" shaped? - - Weired.... tbc... - +- [ ] Same Thing with Soup interaction. We would expect the same behaviour...Influence of interaction with near and far away particles. + - + - + - [x] Robustness test with a trained NetworkTraining for high quality fixpoints, compare with the "perfect" fixpoint. Average Loss per application step - + - see `journal_robustness.py` for robustness test modeled after cristians robustness-exp (with the exeption that we put noise on the weights). Has `synthetic` bool to switch to hand-modeled perfect fixpoint instead of naturally trained ones. - Also added two difference between the "time-as-fixpoint" and "time-to-verge" (i.e. to divergence / zero). - We might need to consult about the "average loss per application step", as I think application loss get gradually higher the worse the weights get. So the average might not tell us much here. -- [ ] Adjust Self Training so that it favors second order fixpoints-> Second order test implementation (?) +- [x] Adjust Self Training so that it favors second order fixpoints-> Second order test implementation (?) - [x] Barplot over clones -> how many become a fixpoint cs how many diverge per noise level -- [ ] Box-Plot of Avg. Distance of clones from parent +- [x] Box-Plot of Avg. Distance of clones from parent + +- [ ] Search subspace between two fixpoints by linage(10**-5), check were they end up + +- [ ] How are basins / "attractor areas" shaped? + - Weired.... tbc... + - + # Future Todos: - [ ] Find a statistik over weight space that provides a better init function - [ ] Test this init function on a mnist classifier - just for the lolz -- [ ] - + --- ## Notes: diff --git a/functionalities_test.py b/functionalities_test.py index fe672de..374811b 100644 --- a/functionalities_test.py +++ b/functionalities_test.py @@ -24,9 +24,11 @@ def is_identity_function(network: Net, epsilon=pow(10, -5)) -> bool: rtol=0, atol=epsilon) -def is_zero_fixpoint(network: Net) -> bool: - result = bool(len(np.nonzero(network.create_target_weights(network.input_weight_matrix())))) - return not result +def is_zero_fixpoint(network: Net, epsilon=pow(10, -5)) -> bool: + target_data = network.create_target_weights(network.input_weight_matrix().detach().numpy()) + result = np.allclose(target_data, np.zeros_like(target_data), rtol=0, atol=epsilon) + # result = bool(len(np.nonzero(network.create_target_weights(network.input_weight_matrix())))) + return result def is_secondary_fixpoint(network: Net, epsilon: float = pow(10, -5)) -> bool: diff --git a/journal_robustness.py b/journal_robustness.py index 4330614..4d44686 100644 --- a/journal_robustness.py +++ b/journal_robustness.py @@ -225,7 +225,7 @@ if __name__ == "__main__": ST_net_hidden_size = 2 ST_net_learning_rate = 0.04 ST_name_hash = random.getrandbits(32) - ST_synthetic = True + ST_synthetic = False print(f"Running the robustness comparison experiment:") RobustnessComparisonExperiment(