pyESN icon indicating copy to clipboard operation
pyESN copied to clipboard

Add support for keras models for outputs

Open jonahweissman opened this issue 5 years ago • 1 comments

To follow up on #5, here's what I worked out: Keras layer building turned out to be too much of a challenge for me, so I modified pyESN to optionally accept a Keras model as an input. Now, instead of learning linear weights to map readouts to outputs, it trains the Keras model to do so. If you don't think that this is appropriate to be included in the main code, that's totally fine. I just wanted to share what I did.

Here's mackey.ipynb, modified to use my new functionality. The performance is worse, but it shows how it works. (GitHub won't let me upload .ipynb, so I changed the file extension to .txt. Just change it back to view.)

I added a new test, but it would only catch the most extreme errors. I wasn't sure of what to include in a more useful test. ~~The freq_gen performance test fails both before and after my changes.~~

Also, I'd like to add a .gitignore. Should I open a new PR or can I just add it to this one?

jonahweissman avatar Jul 17 '18 21:07 jonahweissman

I fixed the bug that was causing the freq_gen performance bug. The activation function is applied to the data twice in ESN.predict; once while stepping through states and again to all the outputs before they are returned. I had gotten rid of the second time, but I've added it back in dd03086.

jonahweissman avatar Jul 19 '18 13:07 jonahweissman