Open Agustin-Picard opened 1 year ago
None
agustin-martin.picard@irt-saintexupery.com
There are constants in the tests for the boundary_based module whose origin is not clear.
boundary_based
Ex: the influence_computed_expected variable in the following test.
influence_computed_expected
def test_compute_influence_values(): model = Sequential() model.add(Input(shape=(3,))) model.add(Dense(2, kernel_initializer=tf.constant_initializer([[1, 1, 1], [0, 0, 0]]), bias_initializer=tf.constant_initializer([4.0, 0.0]))) calculator = WeightsBoundaryCalculator(model) inputs_train = tf.zeros((1, 3)) targets_train = tf.one_hot(tf.zeros((1,), dtype=tf.int32), 2) train_set = tf.data.Dataset.from_tensor_slices((inputs_train, targets_train)).batch(1) influence_computed_score = calculator._compute_influence_values(train_set) # modify the bias term to get equal logits influence_computed_expected = tf.convert_to_tensor([[-np.sqrt(2.0) * 2.0]], dtype=tf.float32) assert tf.reduce_max(tf.abs(influence_computed_expected - influence_computed_score)) < 1E-6
The same happens in the test for the other boundary method.
We expect tests to be clear to maximize maintainability in the long term. This sometimes means explaining how the expected value is calculated.
v0.1.0
- OS: - Python version: - Tensorflow version: - Packages used version:
No response
N/A
Module
None
Contact Details
agustin-martin.picard@irt-saintexupery.com
Current Behavior
There are constants in the tests for the
boundary_based
module whose origin is not clear.Ex: the
influence_computed_expected
variable in the following test.The same happens in the test for the other boundary method.
Expected Behavior
We expect tests to be clear to maximize maintainability in the long term. This sometimes means explaining how the expected value is calculated.
Version
v0.1.0
Environment
Relevant log output
No response
To Reproduce
N/A