Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't fully define noise distribution #98

Closed
jhtu opened this issue Mar 10, 2023 · 6 comments · Fixed by #100
Closed

Can't fully define noise distribution #98

jhtu opened this issue Mar 10, 2023 · 6 comments · Fixed by #100
Assignees

Comments

@jhtu
Copy link

jhtu commented Mar 10, 2023

The Reservoir constructor allows for various noise scalings (like noise_rc) and also the noise distribution (noise_type). However, I don't think there is anyway to further specify the noise. For instance, if we set noise_type='Uniform' and noise_rc=2. then we can draw values from $\text{Unif}(0, 2)$. However, if we want to instead draw values from $\text{Unif}(-1, 1)$, I don't see how we can do that.

The Reservoir class calls either base.forward_internal or base.forward_external, both of which use the reservoir's noise_generator, which in turn calls utils.random.noise. Actually, utils.random.noise accepts **kwargs and would allow for more flexible noise generation. But in base.forward_internal, there is no way to pass in other arguments.

@jhtu
Copy link
Author

jhtu commented Mar 10, 2023

It looks like you can manually set the noise generator after calling the constructor, as so:

reservoir = rpy.nodes.Reservoir(...)
reservoir.hypers['noise_generator'] = partial(
    rpy.utils.random.noise, 
    seed=reservoir.hypers['noise_generator'].keywords['seed'], 
    low=-0.5, 
    high=0.5)

I believe this sets the noise generator to be a uniform distribution with values in [-0.5, 0.5).

@neuronalX
Copy link
Collaborator

Hello,

Could you be a bit more specific, where exactly do you want to add noise?
In the reservoir internal states? In the outputs (i.e. readout)? In the inputs? In some connections weights?

@jhtu
Copy link
Author

jhtu commented Mar 13, 2023

I was trying to add noise in the reservoir hidden state update, as $c \xi$, but with $\xi \sim \text{Unif}(-1, 1)$.

@neuronalX
Copy link
Collaborator

Did you try deriving the reservoir node or the ESN node and adding the noise in the state update equation?

The noise generator you tried is from hyperopt library, which you probably don't need.

@nTrouvain
Copy link
Collaborator

Hello @jhtu,

A noise_kwargs argument is now available in Reservoir. Give it a dictionnary with keyword parameters from Numpy random generator distributions and it should work.

@jhtu
Copy link
Author

jhtu commented Mar 21, 2023

Thanks for the quick fix. This works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants