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

Fitted states for ESN? #92

Open
sdwfrost opened this issue May 15, 2021 · 6 comments
Open

Fitted states for ESN? #92

sdwfrost opened this issue May 15, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@sdwfrost
Copy link

While there's an ESNpredict function, and it's possible to add the exact input state onto the state of ESN, would it be possible to add an `ESNfitted' function that returns the (predicted) state for the input/training data?

@MartinuzziFrancesco
Copy link
Collaborator

This would make for a very interesting addition! Instead of a new function I could add a return_states boolean to ESNpredict that the user would toggle if they want the actual prediction or the trained states. Even an option of having both could be useful. From an user's perspective do you think this could flow better?

@sdwfrost
Copy link
Author

Arguments for a separate function is that for getting the trained states, all one needs is a call like ESNfitted(esn, W_out::AbstractArray{Float64}) - one doesn't need the prediction length, plus there's less chance of confusion in what the output is.

@MartinuzziFrancesco
Copy link
Collaborator

I am sorry, actually misread the initial post. I thought that you were looking for the fitted states for the prediction data. The fitted states for the input/training data can be accessed in the ESN struct: using the example in the readme one can fit the esn like so

esn = ESN(approx_res_size,
    train,
    degree,
    radius,
    activation = activation, #default = tanh
    alpha = alpha, #default = 1.0
    sigma = sigma, #default = 0.1
    nla_type = nla_type, #default = NLADefault()
    extended_states = extended_states #default = false
    )

and after to access the states you can call the states field of the ESN struct

esn.states
# 300×5000 Matrix{Float64}

@sdwfrost
Copy link
Author

Hi, I think we're talking at crossed purposes. What I'd like is the readout for the input data (on the same scale as the observations), not just the internal states of the ESN (i.e. after applying a NLA and the activation). You're not going to get an exact match between the readout of the ESN to the training data due to the use of penalties (and perhaps an underparameterized or poorly parameterized network).

@MartinuzziFrancesco
Copy link
Collaborator

ESNfitted is now merged into main and will be available in ReservoirComputing 0.6.3. Sorry again for my initial confusion, and thanks for the interesting idea for an addition to the package!

I am going to leave this issue open for the moment, since the other ESN variations could use a dispatch for this function, that for the moment has not been added

@sdwfrost
Copy link
Author

Thanks @MartinuzziFrancesco. It seems to work well; I've updated my sine-curve gist to incorporate the fitted output - please feel free to use this example if it helps.

@MartinuzziFrancesco MartinuzziFrancesco added the enhancement New feature or request label Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants