Skip to content

peakbook/EchoStateNetworks.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EchoStateNetworks

A julia implementation of Echo State Networks (ESNs).

Usage

using EchoStateNetworks
using LinearAlgebra
using CSV
using Random

T = Float64
data = convert(Array{T},CSV.read(filepath))'

train_range = 1:2000
test_range = 2001:4000
data_range = 1:4000

esn = EchoStateNetwork{T}(Ni=1, No=1, Nr=500,
                          spectral_radius=1.2,
                          sparsity=0.95,
                          leaking_rate=0.99,
                          teacher_forcing=true,
                          rng=MersenneTwister(0x59))

y_train = data[:,train_range]
x_train = ones(T, 1,length(train_range))
y_test = data[:,test_range]
x_test = ones(T, 1,length(test_range))

y_pred = train!(esn, x_train, y_train, reg=1.0e-8, discard=100)
println("train RMSE: $(norm(y_train-y_pred)/sqrt(length(train_range)))")
y_pred = predict!(esn, x_test)
println("test RMSE:  $(norm(y_test-y_pred)/sqrt(length(test_range)))")

ESN_example

References

About

A julia implementation of Echo State Networks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages