r/AskStatistics • u/SW33TSTUFF • 6d ago
How do I properly compare two randomized algorithms when the evaluation is random too?
Hello everyone,
This is my first time posting here, so I'm sorry if this isn't the right subreddit for this question. I'm working on a personal project on anonymizing graph data and trying to de-anonymize it. The issue is that I'm confused about how to evaluate my results properly, so I would really appreciate your advice.
I came across an existing anonymization algorithm, and I also wrote another algorithm myself. To test them, I used a de-anonymization algorithm to obtain the re-identification rate for each anonymized graph.
My main issue is that randomness shows up in several places.
First, it appears in the anonymization algorithm. Running it with the same input can give different valid output graphs each time, and a seed controls this. Meanwhile, my algorithm uses a parallel solver, so even with a fixed seed, I get different outputs.
Secondly, the re-identification attack also depends on a seed because it reorders the node IDs of the graph.
From my results, what I saw was:
- Attacking the same graph several times usually gives similar scores, but every now and then, a run comes out much higher. I tried 10 attacks per output, and in one case, the re-identification rate ranged from 0.4% to 16%.
- Different outputs from the same method vary a lot. I got three different outputs from the same input, with the same number of modifications, and their mean re-identification rates were 1%, 3%, and 59%.
My questions are:
- What is the right statistical approach I should follow?
- How do I decide how many graphs vs. how many attacks per graph I need? Is there a way to work that out from the variation I already have?
- Since the results are skewed with occasional big spikes. Should I be reporting the mean, the median, or something like the worst case?
- Does it matter that my method's randomness can't be controlled with a seed? Can I still treat the outputs as independent samples?
I'd really appreciate any advice or suggestions. Thanks in advance for any advice!
3
u/richard_sympson PhD Statistics 6d ago
Feed a list of known seeds to the parallel workers so they can each use one to initialize.
2
u/purple_paramecium 6d ago
The paper that you found on the one method— what was the experimental set up they used? How many graphs and how many attacks per graph?
How long does each run take? Is just a second or two, then run a bunch! If each test takes minutes… well how much patience do you have?
2
u/SPSSMadeSimple 6d ago
Your own results already point to the design: the variation between outputs from the same method (1%, 3%, 59% from the same input graph) is much bigger than the variation between attacks on the same output (0.4% to 16%). So spend your compute on more anonymized outputs and more input graphs, not on many attacks per output - three to five attacks per output is plenty to average out the attack noise, and each extra output tells you far more about the method.
Treat it as nested: graphs, then outputs within a graph, then attacks within an output. Don't pool all the attacks as if they were independent runs, because attacks on the same output share that output's quirks. The cleanest comparison is paired: run both methods on the same input graphs, and attack both with the same attack seeds, then compare the paired differences output by output. That strips out the graph-to-graph variation that is otherwise swamping the method difference.
For the skewed scores, report the median and spread (for example the interquartile range or 90th percentile) alongside the mean, not the mean alone. The mean is still the expected re-identification risk, but a single 59% spike is exactly the failure a reader needs to see, so also report how often scores cross a worrying level, say above 10% or 25%.
On the unseeded solver: you can still treat its outputs as independent samples as long as runs don't share state. The missing seed is a reproducibility problem, not a validity problem. Record the solver version and settings, run enough replicates, and keep the pairing on the input graphs and attack seeds, which you can control.