Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ WeightInitializers = "d49dbf32-c5c2-4618-8acc-27bb2598ef2d"
[weakdeps]
CellularAutomata = "878138dc-5b27-11ea-1a71-cb95d38d6b29"
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LIBSVM = "b1bec4e5-fd48-53fe-b0cb-9723c09d164b"
MLJLinearModels = "6ee0df7b-362f-4a72-a706-9e79364fb692"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StateSpaceSets = "40b095a5-5852-4c12-98c7-d43bf788e795"

[extensions]
RCCellularAutomataExt = "CellularAutomata"
RCForwardDiffExt = "ForwardDiff"
RCLIBSVMExt = "LIBSVM"
RCMLJLinearModelsExt = "MLJLinearModels"
RCODEReservoirExt = "DataInterpolations"
Expand All @@ -39,6 +41,7 @@ CellularAutomata = "0.0.6, 0.1"
ConcreteStructs = "0.2.3"
DataInterpolations = "9.0, 10.1"
DifferentialEquations = "8"
ForwardDiff = "0.10, 1"
LIBSVM = "0.8"
LinearAlgebra = "1.10"
LinearSolve = "5.1"
Expand Down Expand Up @@ -68,6 +71,7 @@ julia = "1.10"
CellularAutomata = "878138dc-5b27-11ea-1a71-cb95d38d6b29"
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LIBSVM = "b1bec4e5-fd48-53fe-b0cb-9723c09d164b"
MLJLinearModels = "6ee0df7b-362f-4a72-a706-9e79364fb692"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Expand All @@ -83,4 +87,4 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "SafeTestsets", "SciMLTesting", "CellularAutomata", "DataInterpolations", "DifferentialEquations", "MLJLinearModels", "LIBSVM", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "OrdinaryDiffEqLowOrderRK", "Serialization", "SparseArrays", "StateSpaceSets", "StaticArrays", "Statistics"]
test = ["Test", "SafeTestsets", "SciMLTesting", "CellularAutomata", "DataInterpolations", "DifferentialEquations", "ForwardDiff", "MLJLinearModels", "LIBSVM", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "OrdinaryDiffEqLowOrderRK", "Serialization", "SparseArrays", "StateSpaceSets", "StaticArrays", "Statistics"]
1 change: 1 addition & 0 deletions docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pages = [
"Utilities" => "api/utils.md",
"Train" => "api/train.md",
"Predict" => "api/predict.md",
"Jacobian" => "api/jacobian.md",
"States" => "api/states.md",
"Initializers" => "api/inits.md",
"Developer Interfaces" => "api/developer.md",
Expand Down
7 changes: 7 additions & 0 deletions docs/src/api/jacobian.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Jacobian

```@docs
jacobian
jacobian!
jacobians
```
17 changes: 17 additions & 0 deletions ext/RCForwardDiffExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module RCForwardDiffExt

using ReservoirComputing: ReservoirComputing
using ForwardDiff: ForwardDiff

function forwarddiff_closedloop_jacobian!(
J::AbstractMatrix, esn::ReservoirComputing.ESN, x::AbstractVector, ps
)
ReservoirComputing.__require_esn_closedloop_io(esn)
closed_loop = let esn = esn, ps = ps
state -> first(ReservoirComputing.__closed_loop_step(esn, state, ps))
end
J .= ForwardDiff.jacobian(closed_loop, x)
return J
end

end # module
5 changes: 3 additions & 2 deletions src/ReservoirComputing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ include("models/rmnesn.jl")
include("models/rmnresesn.jl")
include("models/continuous_esn.jl")
include("models/lsm.jl")
include("jacobian.jl")
#conceptors
include("conceptors.jl")
#extensions
Expand Down Expand Up @@ -109,8 +110,8 @@ export band_init, block_diagonal, chaotic_init, cycle_jumps, delay_line, delayli
export add_jumps!, backward_connection!, delay_line!, permute_matrix!, reverse_simple_cycle!,
scale_radius!, self_loop!, simple_cycle!
export @topology
export polynomial_monomials, chebyshev_monomials, predict, QRSolver, QRFactorization,
resetcarry!, return_init_as, train, train!
export polynomial_monomials, chebyshev_monomials, predict, jacobian, jacobian!, jacobians,
QRSolver, QRFactorization, resetcarry!, return_init_as, train, train!
export AdditiveEIESN, DeepESN, DeepReservoir, DelayESN, EIESN, ES2N, ESN, EuSN, HybridESN, InputDelayESN, LIFESN, ResESN, StateDelayESN, SVESM
export NGRC
export RMNESN, RMNResESN
Expand Down
Loading
Loading