What the parameter in PerturbedAdditive means

Hi.
There’s a function in InferOpt package named PerturbedAdditive.
I’m curious about a parameter.

co_layer = PerturbedAdditive(knapsack_maximizer; ε=10.0, nb_samples=10)

For codes above, what does “ε=10.0” mean?
And I know that it will give 10 random numbers from the distribution N(0,1). If I want to fetch from N(0,2), what should I do?

Could you kindly provide me with the ε meaning and example code?
Thank you

In this function, ε is the scaling of the perturbation, which corresponds to the standard deviation for a Gaussian variable. So your code will actually perturb the knapsack_maximizer with nb_samples=10 random numbers from the distribution N(0, ε^2).
Ping @BatyLeo

1 Like

Thank you for replying!
I understood. But I tried with the code.

printf(co_player)

And I got print like this:

PerturbedAdditive(pctsp, 10.0, 10, MersenneTwister, nothing, Normal(0, 1))

It indicates that it produced a distribution N(0,1) rather than N(0,10) ?

You should read the documentation ?PerturbedAdditive. ε is the standard deviation in the normal random variable case. The perturbation keyword, which is what you are seeing printed with Normal(0, 1), is the base sampling distribution for that perturbation (which defaults to perturbation=nothing or equivalent Normal(0, 1)).

2 Likes

Thank you !
I see.
It means we fetch one random number z from distribution N(0,1) first. Then, we mutiple z with ε as our final perturbation?
I think I fully understood now.
Thanks

1 Like

Hi, here is the full formula behind the hood:
\text{co_layer}(\theta) = \dfrac{1}{\text{nb_samples}} \sum\limits_{i=1}^{\text{nb_samples}} \text{knapsack_maximizer}(\theta + \varepsilon Z_i),
where Z_i are sampled from Normal(0, 1).

2 Likes

Thank you! I understand!
This is an execellent answer!