Trusted-AI/adversarial-robustness-toolbox

Depreciated function name 'binom_test' of scipy.

Closed this issue · 1 comments

Describe the bug
Depreciated function name 'binom_test' of scipy being called while running predict method of TensorFlowV2RandomizedSmoothing object. The function scipy.stats.binom_test() was removed from SciPy 1.12.0.

To Reproduce

  1. Create a TensorFlowV2Classifier classifier
classifier = TensorFlowV2Classifier(
    model=model,
    nb_classes=NUM_LABELS,
    input_shape=INPUT_SHAPE,
    loss_object=tf.keras.losses.CategoricalCrossentropy(from_logits=False),
    optimizer=tf.keras.optimizers.Adam(learning_rate=LR),
    clip_values=(0, 1)
) 
  1. Create a TensorFlowV2RandomizedSmoothing object using the classifier object
classifier_rs_025 = TensorFlowV2RandomizedSmoothing(model = classifier.model,
    nb_classes=NUM_LABELS,
    input_shape=INPUT_SHAPE,
    loss_object=tf.keras.losses.CategoricalCrossentropy(from_logits=False),
    optimizer=tf.keras.optimizers.Adam(learning_rate=LR),
    clip_values=(0, 1),
    sample_size=100,
    scale=0.25
)
  1. Call the predict method on a subset of images
    classifier_rs_025.predict(imgs_sub_test)

  2. See error

Expected behavior
Return predictions for the input images

Screenshots
image_2024-11-02_153654604

System information (please complete the following information):

  • Used Kaggle notebook

Note:

Proposed Solution:
Change The function name from binom_test to binomtest and handle the way the inputs and ouputs are returned

This solution worked out for me and i would like to contribute

Hi @Ashuradhipathi Thank you very much for raising this issue and working on a solution!