Repository: understandable-machine-intelligence-lab/Quantus
Issue: Duplicated random and uniform options for perturb_baseline
Root cause: Architectural Constraint

Subject: Random number generation

The `random` and `uniform` values for the `perturb_baseline` parameter in the metrics are semantically overlapping. While both return the same values, the `random` function is more restrictive regarding its bounds.

Giving the user the option between `random` and `uniform` can be confusing, it would be preferable to only offer `uniform` instead.

https://github.com/understandable-machine-intelligence-lab/Quantus/blob/1ecb500195f985f7b7a6a7086cba82219d76c6c6/quantus/helpers/utils.py#L78-L79

<img width="685" alt="image" src="https://user-images.githubusercontent.com/14152377/161719735-4dfdc735-fceb-46a9-b30c-d825e583a88f.png">


I agree with this. can uniform be kept, and the bounds be made optionalparameters with default values 0 and 1? this would nicely collapse both cases.

further remark: why use the python built-in random number generator instead e.g. numpy? this is a question out of curiosity, not a suggestion, gut feeling says numpy might be faster when pulling lots of random values, which we usually will do in eg. perturbation tests.

further remarks on the module referenced by @rodrigobdz:
"black" is not necessarily arr.min(), 
"white" is not necessarily arr.max().

think rgb-color images (where values only describe location x channe voxels. or time series data.
I advise to disambiguate and call it "max", "min", "zero", etc. max/min values might also be per-channel

an option to pass custom baseline values might be of interest (which somehow align with some axes of the input space via broadcasting) 


Thank you both.

I agree that keeping the uniform option is better.

I've excluded the "random" option now, plus changed to `np.random` instead of `random` as well as added a deprecation warning incl. a description of how to achieve the same results with `uniform` as with `random`.

Please see PR/ commit here: https://github.com/understandable-machine-intelligence-lab/Quantus/pull/114/commits/704e39292a0a35124c8f17b38b73320e762683d1

@rodrigobdz do you want to take a look?

@annahedstroem I like that you added a deprecation notice for `random` 💯.


Here are a few occurrences still pending removal/modification in the same file:
https://github.com/understandable-machine-intelligence-lab/Quantus/blob/704e39292a0a35124c8f17b38b73320e762683d1/quantus/helpers/utils.py#L3

https://github.com/understandable-machine-intelligence-lab/Quantus/blob/704e39292a0a35124c8f17b38b73320e762683d1/quantus/helpers/utils.py#L95

`random` occurrences scattered around in the project. Some of these are unused imports:

![image](https://user-images.githubusercontent.com/14152377/163400686-11fb2922-cd08-41b8-a508-0c95345989b9.png)

![image](https://user-images.githubusercontent.com/14152377/163400846-0aa79443-0430-49b1-a20f-a03b64ad9017.png)


The fixes in `utils.py` were fixed in commits after. I've now also removed the import of random in all source code files.

I've left it in the tutorials as we might be using the random in other operations there.

Thank you @rodrigobdz 

If there is no further comment, I'll close the issue.

Thanks, we can close the issue then.