├── .DS_Store ├── .gitignore ├── LICENSE ├── Manifest.toml ├── Project.toml ├── README.md ├── examples ├── BasicRCExample.jl ├── BasicRC_OptimizationExample.jl ├── platt2022_example.jl └── utilities.jl └── src └── BasicReservoirComputing.jl /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/japlatt/BasicReservoirComputing/f92a6f143689b9d252d25b750aef9d91aa669509/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/julia 2 | # Files generated by invoking Julia with --code-coverage 3 | *.jl.cov 4 | *.jl.*.cov 5 | 6 | # Files generated by invoking Julia with --track-allocation 7 | *.jl.mem 8 | 9 | # System-specific files and directories generated by the BinaryProvider and BinDeps packages 10 | # They contain absolute paths specific to the host computer, and so should not be committed 11 | deps/deps.jl 12 | deps/build.log 13 | deps/downloads/ 14 | deps/usr/ 15 | deps/src/ 16 | 17 | # Build artifacts for creating documentation generated by the Documenter package 18 | docs/build/ 19 | docs/site/ 20 | 21 | # File generated by Pkg, the package manager, based on a corresponding Project.toml 22 | # It records a fixed state of all packages used by the project. As such, it should not be 23 | # committed for packages, but should be committed for applications that require a static 24 | # environment. 25 | Manifest.toml 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Jason Platt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Manifest.toml: -------------------------------------------------------------------------------- 1 | # This file is machine-generated - editing it directly is not advised 2 | 3 | julia_version = "1.7.0" 4 | manifest_format = "2.0" 5 | 6 | [[deps.AbstractFFTs]] 7 | deps = ["ChainRulesCore", "LinearAlgebra"] 8 | git-tree-sha1 = "6f1d9bc1c08f9f4a8fa92e3ea3cb50153a1b40d4" 9 | uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c" 10 | version = "1.1.0" 11 | 12 | [[deps.Adapt]] 13 | deps = ["LinearAlgebra"] 14 | git-tree-sha1 = "af92965fb30777147966f58acb05da51c5616b5f" 15 | uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" 16 | version = "3.3.3" 17 | 18 | [[deps.ArgTools]] 19 | uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" 20 | 21 | [[deps.ArnoldiMethod]] 22 | deps = ["LinearAlgebra", "Random", "StaticArrays"] 23 | git-tree-sha1 = "62e51b39331de8911e4a7ff6f5aaf38a5f4cc0ae" 24 | uuid = "ec485272-7323-5ecc-a04f-4719b315124d" 25 | version = "0.2.0" 26 | 27 | [[deps.ArrayInterface]] 28 | deps = ["Compat", "IfElse", "LinearAlgebra", "Requires", "SparseArrays", "Static"] 29 | git-tree-sha1 = "c933ce606f6535a7c7b98e1d86d5d1014f730596" 30 | uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" 31 | version = "5.0.7" 32 | 33 | [[deps.Artifacts]] 34 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 35 | 36 | [[deps.Base64]] 37 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 38 | 39 | [[deps.BitTwiddlingConvenienceFunctions]] 40 | deps = ["Static"] 41 | git-tree-sha1 = "28bbdbf0354959db89358d1d79d421ff31ef0b5e" 42 | uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b" 43 | version = "0.1.3" 44 | 45 | [[deps.Bzip2_jll]] 46 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 47 | git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2" 48 | uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0" 49 | version = "1.0.8+0" 50 | 51 | [[deps.CEnum]] 52 | git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90" 53 | uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" 54 | version = "0.4.2" 55 | 56 | [[deps.CMAEvolutionStrategy]] 57 | deps = ["Dates", "LinearAlgebra", "Printf", "Random", "Statistics"] 58 | git-tree-sha1 = "142f9745ac11958533956613330ff63e4850a7e6" 59 | uuid = "8d3b24bd-414e-49e0-94fb-163cc3a3e411" 60 | version = "0.2.2" 61 | 62 | [[deps.CPUSummary]] 63 | deps = ["CpuId", "IfElse", "Static"] 64 | git-tree-sha1 = "baaac45b4462b3b0be16726f38b789bf330fcb7a" 65 | uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" 66 | version = "0.1.21" 67 | 68 | [[deps.CRlibm]] 69 | deps = ["CRlibm_jll"] 70 | git-tree-sha1 = "32abd86e3c2025db5172aa182b982debed519834" 71 | uuid = "96374032-68de-5a5b-8d9e-752f78720389" 72 | version = "1.0.1" 73 | 74 | [[deps.CRlibm_jll]] 75 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 76 | git-tree-sha1 = "e329286945d0cfc04456972ea732551869af1cfc" 77 | uuid = "4e9b3aee-d8a1-5a3d-ad8b-7d824db253f0" 78 | version = "1.0.1+0" 79 | 80 | [[deps.Calculus]] 81 | deps = ["LinearAlgebra"] 82 | git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad" 83 | uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9" 84 | version = "0.5.1" 85 | 86 | [[deps.ChainRulesCore]] 87 | deps = ["Compat", "LinearAlgebra", "SparseArrays"] 88 | git-tree-sha1 = "9950387274246d08af38f6eef8cb5480862a435f" 89 | uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" 90 | version = "1.14.0" 91 | 92 | [[deps.ChangesOfVariables]] 93 | deps = ["ChainRulesCore", "LinearAlgebra", "Test"] 94 | git-tree-sha1 = "bf98fa45a0a4cee295de98d4c1462be26345b9a1" 95 | uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" 96 | version = "0.1.2" 97 | 98 | [[deps.ChaosTools]] 99 | deps = ["Clustering", "Combinatorics", "DSP", "DelayEmbeddings", "Distances", "Distributions", "DynamicalSystemsBase", "Entropies", "ForwardDiff", "IntervalRootFinding", "LinearAlgebra", "LombScargle", "Neighborhood", "ProgressMeter", "Random", "Roots", "SpecialFunctions", "StaticArrays", "Statistics", "StatsBase"] 100 | git-tree-sha1 = "9abac08ab5a93a2cb634f83b34551a024df44a88" 101 | uuid = "608a59af-f2a3-5ad4-90b4-758bdf3122a7" 102 | version = "2.8.1" 103 | 104 | [[deps.CloseOpenIntervals]] 105 | deps = ["ArrayInterface", "Static"] 106 | git-tree-sha1 = "f576084239e6bdf801007c80e27e2cc2cd963fe0" 107 | uuid = "fb6a15b2-703c-40df-9091-08a04967cfa9" 108 | version = "0.1.6" 109 | 110 | [[deps.Clustering]] 111 | deps = ["Distances", "LinearAlgebra", "NearestNeighbors", "Printf", "SparseArrays", "Statistics", "StatsBase"] 112 | git-tree-sha1 = "75479b7df4167267d75294d14b58244695beb2ac" 113 | uuid = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5" 114 | version = "0.14.2" 115 | 116 | [[deps.ColorTypes]] 117 | deps = ["FixedPointNumbers", "Random"] 118 | git-tree-sha1 = "024fe24d83e4a5bf5fc80501a314ce0d1aa35597" 119 | uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" 120 | version = "0.11.0" 121 | 122 | [[deps.ColorVectorSpace]] 123 | deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "TensorCore"] 124 | git-tree-sha1 = "3f1f500312161f1ae067abe07d13b40f78f32e07" 125 | uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" 126 | version = "0.9.8" 127 | 128 | [[deps.Colors]] 129 | deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] 130 | git-tree-sha1 = "417b0ed7b8b838aa6ca0a87aadf1bb9eb111ce40" 131 | uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" 132 | version = "0.12.8" 133 | 134 | [[deps.Combinatorics]] 135 | git-tree-sha1 = "08c8b6831dc00bfea825826be0bc8336fc369860" 136 | uuid = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" 137 | version = "1.0.2" 138 | 139 | [[deps.CommonSolve]] 140 | git-tree-sha1 = "68a0743f578349ada8bc911a5cbd5a2ef6ed6d1f" 141 | uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" 142 | version = "0.2.0" 143 | 144 | [[deps.CommonSubexpressions]] 145 | deps = ["MacroTools", "Test"] 146 | git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7" 147 | uuid = "bbf7d656-a473-5ed7-a52c-81e309532950" 148 | version = "0.3.0" 149 | 150 | [[deps.Compat]] 151 | deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] 152 | git-tree-sha1 = "b153278a25dd42c65abbf4e62344f9d22e59191b" 153 | uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" 154 | version = "3.43.0" 155 | 156 | [[deps.CompilerSupportLibraries_jll]] 157 | deps = ["Artifacts", "Libdl"] 158 | uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" 159 | 160 | [[deps.ConstructionBase]] 161 | deps = ["LinearAlgebra"] 162 | git-tree-sha1 = "f74e9d5388b8620b4cee35d4c5a618dd4dc547f4" 163 | uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" 164 | version = "1.3.0" 165 | 166 | [[deps.Contour]] 167 | deps = ["StaticArrays"] 168 | git-tree-sha1 = "9f02045d934dc030edad45944ea80dbd1f0ebea7" 169 | uuid = "d38c429a-6771-53c6-b99e-75d170b6e991" 170 | version = "0.5.7" 171 | 172 | [[deps.CpuId]] 173 | deps = ["Markdown"] 174 | git-tree-sha1 = "32d125af0fb8ec3f8935896122c5e345709909e5" 175 | uuid = "adafc99b-e345-5852-983c-f28acb93d879" 176 | version = "0.3.0" 177 | 178 | [[deps.Crayons]] 179 | git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" 180 | uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" 181 | version = "4.1.1" 182 | 183 | [[deps.DEDataArrays]] 184 | deps = ["ArrayInterface", "DocStringExtensions", "LinearAlgebra", "RecursiveArrayTools", "SciMLBase", "StaticArrays"] 185 | git-tree-sha1 = "5e5f8f363c8c9a2415ef9185c4e0ff6966c87d52" 186 | uuid = "754358af-613d-5f8d-9788-280bf1605d4c" 187 | version = "0.2.2" 188 | 189 | [[deps.DSP]] 190 | deps = ["Compat", "FFTW", "IterTools", "LinearAlgebra", "Polynomials", "Random", "Reexport", "SpecialFunctions", "Statistics"] 191 | git-tree-sha1 = "3e03979d16275ed5d9078d50327332c546e24e68" 192 | uuid = "717857b8-e6f2-59f4-9121-6e50c889abd2" 193 | version = "0.7.5" 194 | 195 | [[deps.DataAPI]] 196 | git-tree-sha1 = "fb5f5316dd3fd4c5e7c30a24d50643b73e37cd40" 197 | uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" 198 | version = "1.10.0" 199 | 200 | [[deps.DataStructures]] 201 | deps = ["Compat", "InteractiveUtils", "OrderedCollections"] 202 | git-tree-sha1 = "3daef5523dd2e769dad2365274f760ff5f282c7d" 203 | uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" 204 | version = "0.18.11" 205 | 206 | [[deps.DataValueInterfaces]] 207 | git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" 208 | uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" 209 | version = "1.0.0" 210 | 211 | [[deps.Dates]] 212 | deps = ["Printf"] 213 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 214 | 215 | [[deps.DelayEmbeddings]] 216 | deps = ["Distances", "Distributions", "LinearAlgebra", "Neighborhood", "Random", "StaticArrays", "Statistics", "StatsBase"] 217 | git-tree-sha1 = "78fe228cf9f8b4f7badc393cd40b6af8de936479" 218 | uuid = "5732040d-69e3-5649-938a-b6b4f237613f" 219 | version = "2.1.0" 220 | 221 | [[deps.DelimitedFiles]] 222 | deps = ["Mmap"] 223 | uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" 224 | 225 | [[deps.DensityInterface]] 226 | deps = ["InverseFunctions", "Test"] 227 | git-tree-sha1 = "80c3e8639e3353e5d2912fb3a1916b8455e2494b" 228 | uuid = "b429d917-457f-4dbc-8f4c-0cc954292b1d" 229 | version = "0.4.0" 230 | 231 | [[deps.DiffEqBase]] 232 | deps = ["ArrayInterface", "ChainRulesCore", "DEDataArrays", "DataStructures", "Distributions", "DocStringExtensions", "FastBroadcast", "ForwardDiff", "FunctionWrappers", "IterativeSolvers", "LabelledArrays", "LinearAlgebra", "Logging", "MuladdMacro", "NonlinearSolve", "Parameters", "PreallocationTools", "Printf", "RecursiveArrayTools", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "Setfield", "SparseArrays", "StaticArrays", "Statistics", "SuiteSparse", "ZygoteRules"] 233 | git-tree-sha1 = "3c55535145325e0e3fa7a397e3a50e5f220d1edc" 234 | uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" 235 | version = "6.83.2" 236 | 237 | [[deps.DiffResults]] 238 | deps = ["StaticArrays"] 239 | git-tree-sha1 = "c18e98cba888c6c25d1c3b048e4b3380ca956805" 240 | uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5" 241 | version = "1.0.3" 242 | 243 | [[deps.DiffRules]] 244 | deps = ["IrrationalConstants", "LogExpFunctions", "NaNMath", "Random", "SpecialFunctions"] 245 | git-tree-sha1 = "dd933c4ef7b4c270aacd4eb88fa64c147492acf0" 246 | uuid = "b552c78f-8df3-52c6-915a-8e097449b14b" 247 | version = "1.10.0" 248 | 249 | [[deps.Distances]] 250 | deps = ["LinearAlgebra", "SparseArrays", "Statistics", "StatsAPI"] 251 | git-tree-sha1 = "3258d0659f812acde79e8a74b11f17ac06d0ca04" 252 | uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" 253 | version = "0.10.7" 254 | 255 | [[deps.Distributed]] 256 | deps = ["Random", "Serialization", "Sockets"] 257 | uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" 258 | 259 | [[deps.Distributions]] 260 | deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"] 261 | git-tree-sha1 = "5a4168170ede913a2cd679e53c2123cb4b889795" 262 | uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" 263 | version = "0.25.53" 264 | 265 | [[deps.DocStringExtensions]] 266 | deps = ["LibGit2"] 267 | git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b" 268 | uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" 269 | version = "0.8.6" 270 | 271 | [[deps.Downloads]] 272 | deps = ["ArgTools", "LibCURL", "NetworkOptions"] 273 | uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" 274 | 275 | [[deps.DynamicalSystems]] 276 | deps = ["ChaosTools", "DelayEmbeddings", "DynamicalSystemsBase", "Entropies", "RecurrenceAnalysis", "Reexport", "Scratch"] 277 | git-tree-sha1 = "5f6afe8c904f66e2f74ad23f032d526e690a3f55" 278 | uuid = "61744808-ddfa-5f27-97ff-6e42cc95d634" 279 | version = "2.3.0" 280 | 281 | [[deps.DynamicalSystemsBase]] 282 | deps = ["DelayEmbeddings", "ForwardDiff", "LinearAlgebra", "SciMLBase", "SimpleDiffEq", "SparseArrays", "StaticArrays", "Statistics"] 283 | git-tree-sha1 = "b9e672332d235e744b0edb2a67a93da6e4dfcd2d" 284 | uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4" 285 | version = "2.7.0" 286 | 287 | [[deps.EarCut_jll]] 288 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 289 | git-tree-sha1 = "3f3a2501fa7236e9b911e0f7a588c657e822bb6d" 290 | uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" 291 | version = "2.2.3+0" 292 | 293 | [[deps.Entropies]] 294 | deps = ["DelayEmbeddings", "Distances", "LinearAlgebra", "Neighborhood", "SparseArrays", "SpecialFunctions", "StaticArrays", "Statistics", "Wavelets"] 295 | git-tree-sha1 = "6da8090e8e49cebf107647b988b536492b8deb74" 296 | uuid = "ed8fcbec-b94c-44b6-89df-898894ad9591" 297 | version = "1.1.2" 298 | 299 | [[deps.ErrorfreeArithmetic]] 300 | git-tree-sha1 = "d6863c556f1142a061532e79f611aa46be201686" 301 | uuid = "90fa49ef-747e-5e6f-a989-263ba693cf1a" 302 | version = "0.5.2" 303 | 304 | [[deps.ExprTools]] 305 | git-tree-sha1 = "56559bbef6ca5ea0c0818fa5c90320398a6fbf8d" 306 | uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" 307 | version = "0.1.8" 308 | 309 | [[deps.FFTW]] 310 | deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] 311 | git-tree-sha1 = "505876577b5481e50d089c1c68899dfb6faebc62" 312 | uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" 313 | version = "1.4.6" 314 | 315 | [[deps.FFTW_jll]] 316 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 317 | git-tree-sha1 = "c6033cc3892d0ef5bb9cd29b7f2f0331ea5184ea" 318 | uuid = "f5851436-0d7a-5f13-b9de-f02708fd171a" 319 | version = "3.3.10+0" 320 | 321 | [[deps.FastBroadcast]] 322 | deps = ["LinearAlgebra", "Polyester", "Static"] 323 | git-tree-sha1 = "b6bf57ec7a3f294c97ae46124705a9e6b906a209" 324 | uuid = "7034ab61-46d4-4ed7-9d0f-46aef9175898" 325 | version = "0.1.15" 326 | 327 | [[deps.FastRounding]] 328 | deps = ["ErrorfreeArithmetic", "LinearAlgebra"] 329 | git-tree-sha1 = "6344aa18f654196be82e62816935225b3b9abe44" 330 | uuid = "fa42c844-2597-5d31-933b-ebd51ab2693f" 331 | version = "0.3.1" 332 | 333 | [[deps.FileIO]] 334 | deps = ["Pkg", "Requires", "UUIDs"] 335 | git-tree-sha1 = "80ced645013a5dbdc52cf70329399c35ce007fae" 336 | uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" 337 | version = "1.13.0" 338 | 339 | [[deps.FillArrays]] 340 | deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"] 341 | git-tree-sha1 = "246621d23d1f43e3b9c368bf3b72b2331a27c286" 342 | uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" 343 | version = "0.13.2" 344 | 345 | [[deps.FiniteDiff]] 346 | deps = ["ArrayInterface", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays"] 347 | git-tree-sha1 = "56956d1e4c1221000b7781104c58c34019792951" 348 | uuid = "6a86dc24-6348-571c-b903-95158fe2bd41" 349 | version = "2.11.0" 350 | 351 | [[deps.FixedPointNumbers]] 352 | deps = ["Statistics"] 353 | git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc" 354 | uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" 355 | version = "0.8.4" 356 | 357 | [[deps.ForwardDiff]] 358 | deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "LinearAlgebra", "LogExpFunctions", "NaNMath", "Preferences", "Printf", "Random", "SpecialFunctions", "StaticArrays"] 359 | git-tree-sha1 = "40d1546a45abd63490569695a86a2d93c2021e54" 360 | uuid = "f6369f11-7733-5829-9624-2563aa707210" 361 | version = "0.10.26" 362 | 363 | [[deps.FreeType]] 364 | deps = ["CEnum", "FreeType2_jll"] 365 | git-tree-sha1 = "cabd77ab6a6fdff49bfd24af2ebe76e6e018a2b4" 366 | uuid = "b38be410-82b0-50bf-ab77-7b57e271db43" 367 | version = "4.0.0" 368 | 369 | [[deps.FreeType2_jll]] 370 | deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] 371 | git-tree-sha1 = "87eb71354d8ec1a96d4a7636bd57a7347dde3ef9" 372 | uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7" 373 | version = "2.10.4+0" 374 | 375 | [[deps.FreeTypeAbstraction]] 376 | deps = ["ColorVectorSpace", "Colors", "FreeType", "GeometryBasics"] 377 | git-tree-sha1 = "b5c7fe9cea653443736d264b85466bad8c574f4a" 378 | uuid = "663a7486-cb36-511b-a19d-713bb74d65c9" 379 | version = "0.9.9" 380 | 381 | [[deps.FunctionWrappers]] 382 | git-tree-sha1 = "241552bc2209f0fa068b6415b1942cc0aa486bcc" 383 | uuid = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e" 384 | version = "1.1.2" 385 | 386 | [[deps.Future]] 387 | deps = ["Random"] 388 | uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" 389 | 390 | [[deps.GeometryBasics]] 391 | deps = ["EarCut_jll", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] 392 | git-tree-sha1 = "83ea630384a13fc4f002b77690bc0afeb4255ac9" 393 | uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326" 394 | version = "0.4.2" 395 | 396 | [[deps.Graphs]] 397 | deps = ["ArnoldiMethod", "Compat", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"] 398 | git-tree-sha1 = "57c021de207e234108a6f1454003120a1bf350c4" 399 | uuid = "86223c79-3864-5bf0-83f7-82e725a168b6" 400 | version = "1.6.0" 401 | 402 | [[deps.HostCPUFeatures]] 403 | deps = ["BitTwiddlingConvenienceFunctions", "IfElse", "Libdl", "Static"] 404 | git-tree-sha1 = "18be5268cf415b5e27f34980ed25a7d34261aa83" 405 | uuid = "3e5b6fbb-0976-4d2c-9146-d79de83f2fb0" 406 | version = "0.1.7" 407 | 408 | [[deps.Hwloc]] 409 | deps = ["Hwloc_jll"] 410 | git-tree-sha1 = "92d99146066c5c6888d5a3abc871e6a214388b91" 411 | uuid = "0e44f5e4-bd66-52a0-8798-143a42290a1d" 412 | version = "2.0.0" 413 | 414 | [[deps.Hwloc_jll]] 415 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 416 | git-tree-sha1 = "303d70c961317c4c20fafaf5dbe0e6d610c38542" 417 | uuid = "e33a78d0-f292-5ffc-b300-72abe9b543c8" 418 | version = "2.7.1+0" 419 | 420 | [[deps.IfElse]] 421 | git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" 422 | uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" 423 | version = "0.1.1" 424 | 425 | [[deps.Inflate]] 426 | git-tree-sha1 = "f5fc07d4e706b84f72d54eedcc1c13d92fb0871c" 427 | uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" 428 | version = "0.1.2" 429 | 430 | [[deps.InlineStrings]] 431 | deps = ["Parsers"] 432 | git-tree-sha1 = "61feba885fac3a407465726d0c330b3055df897f" 433 | uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" 434 | version = "1.1.2" 435 | 436 | [[deps.IntelOpenMP_jll]] 437 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 438 | git-tree-sha1 = "d979e54b71da82f3a65b62553da4fc3d18c9004c" 439 | uuid = "1d5cc7b8-4909-519e-a0f8-d0f5ad9712d0" 440 | version = "2018.0.3+2" 441 | 442 | [[deps.InteractiveUtils]] 443 | deps = ["Markdown"] 444 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 445 | 446 | [[deps.IntervalArithmetic]] 447 | deps = ["CRlibm", "FastRounding", "LinearAlgebra", "Markdown", "Random", "RecipesBase", "RoundingEmulator", "SetRounding", "StaticArrays"] 448 | git-tree-sha1 = "1fa3ba0893ea5611830feedac46b7f95872cbd01" 449 | uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" 450 | version = "0.20.5" 451 | 452 | [[deps.IntervalRootFinding]] 453 | deps = ["ForwardDiff", "IntervalArithmetic", "LinearAlgebra", "Polynomials", "Reexport", "StaticArrays"] 454 | git-tree-sha1 = "b6969692c800cc5b90608fbd3be83189edc5e446" 455 | uuid = "d2bf35a9-74e0-55ec-b149-d360ff49b807" 456 | version = "0.5.10" 457 | 458 | [[deps.Intervals]] 459 | deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"] 460 | git-tree-sha1 = "323a38ed1952d30586d0fe03412cde9399d3618b" 461 | uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5" 462 | version = "1.5.0" 463 | 464 | [[deps.InverseFunctions]] 465 | deps = ["Test"] 466 | git-tree-sha1 = "91b5dcf362c5add98049e6c29ee756910b03051d" 467 | uuid = "3587e190-3f89-42d0-90ee-14403ec27112" 468 | version = "0.1.3" 469 | 470 | [[deps.IrrationalConstants]] 471 | git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151" 472 | uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" 473 | version = "0.1.1" 474 | 475 | [[deps.IterTools]] 476 | git-tree-sha1 = "fa6287a4469f5e048d763df38279ee729fbd44e5" 477 | uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" 478 | version = "1.4.0" 479 | 480 | [[deps.IterativeSolvers]] 481 | deps = ["LinearAlgebra", "Printf", "Random", "RecipesBase", "SparseArrays"] 482 | git-tree-sha1 = "1169632f425f79429f245113b775a0e3d121457c" 483 | uuid = "42fd0dbc-a981-5370-80f2-aaf504508153" 484 | version = "0.9.2" 485 | 486 | [[deps.IteratorInterfaceExtensions]] 487 | git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" 488 | uuid = "82899510-4779-5014-852e-03e436cf321d" 489 | version = "1.0.0" 490 | 491 | [[deps.JLLWrappers]] 492 | deps = ["Preferences"] 493 | git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" 494 | uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" 495 | version = "1.4.1" 496 | 497 | [[deps.LabelledArrays]] 498 | deps = ["ArrayInterface", "ChainRulesCore", "LinearAlgebra", "MacroTools", "StaticArrays"] 499 | git-tree-sha1 = "fbd884a02f8bf98fd90c53c1c9d2b21f9f30f42a" 500 | uuid = "2ee39098-c373-598a-b85f-a56591580800" 501 | version = "1.8.0" 502 | 503 | [[deps.LayoutPointers]] 504 | deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static"] 505 | git-tree-sha1 = "b651f573812d6c36c22c944dd66ef3ab2283dfa1" 506 | uuid = "10f19ff3-798f-405d-979b-55457f8fc047" 507 | version = "0.1.6" 508 | 509 | [[deps.LazyArtifacts]] 510 | deps = ["Artifacts", "Pkg"] 511 | uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" 512 | 513 | [[deps.LibCURL]] 514 | deps = ["LibCURL_jll", "MozillaCACerts_jll"] 515 | uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" 516 | 517 | [[deps.LibCURL_jll]] 518 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] 519 | uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" 520 | 521 | [[deps.LibGit2]] 522 | deps = ["Base64", "NetworkOptions", "Printf", "SHA"] 523 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 524 | 525 | [[deps.LibSSH2_jll]] 526 | deps = ["Artifacts", "Libdl", "MbedTLS_jll"] 527 | uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" 528 | 529 | [[deps.Libdl]] 530 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 531 | 532 | [[deps.LinearAlgebra]] 533 | deps = ["Libdl", "libblastrampoline_jll"] 534 | uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 535 | 536 | [[deps.LogExpFunctions]] 537 | deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] 538 | git-tree-sha1 = "a970d55c2ad8084ca317a4658ba6ce99b7523571" 539 | uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" 540 | version = "0.3.12" 541 | 542 | [[deps.Logging]] 543 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 544 | 545 | [[deps.LombScargle]] 546 | deps = ["FFTW", "LinearAlgebra", "Measurements", "Random", "SpecialFunctions", "Statistics"] 547 | git-tree-sha1 = "d64a0ce7539181136a85fd8fe4f42626387f0f26" 548 | uuid = "fc60dff9-86e7-5f2f-a8a0-edeadbb75bd9" 549 | version = "1.0.3" 550 | 551 | [[deps.LoopVectorization]] 552 | deps = ["ArrayInterface", "CPUSummary", "ChainRulesCore", "CloseOpenIntervals", "DocStringExtensions", "ForwardDiff", "HostCPUFeatures", "IfElse", "LayoutPointers", "LinearAlgebra", "OffsetArrays", "PolyesterWeave", "SIMDDualNumbers", "SLEEFPirates", "SpecialFunctions", "Static", "ThreadingUtilities", "UnPack", "VectorizationBase"] 553 | git-tree-sha1 = "4acc35e95bf18de5e9562d27735bef0950f2ed74" 554 | uuid = "bdcacae8-1622-11e9-2a5c-532679323890" 555 | version = "0.12.108" 556 | 557 | [[deps.MKL]] 558 | deps = ["Artifacts", "Libdl", "LinearAlgebra", "MKL_jll"] 559 | git-tree-sha1 = "e1ad60943045f666863e9112701bc77fd19d946b" 560 | uuid = "33e6dc65-8f57-5167-99aa-e5a354878fb2" 561 | version = "0.5.0" 562 | 563 | [[deps.MKL_jll]] 564 | deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "Pkg"] 565 | git-tree-sha1 = "e595b205efd49508358f7dc670a940c790204629" 566 | uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" 567 | version = "2022.0.0+0" 568 | 569 | [[deps.MacroTools]] 570 | deps = ["Markdown", "Random"] 571 | git-tree-sha1 = "3d3e902b31198a27340d0bf00d6ac452866021cf" 572 | uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" 573 | version = "0.5.9" 574 | 575 | [[deps.ManualMemory]] 576 | git-tree-sha1 = "bcaef4fc7a0cfe2cba636d84cda54b5e4e4ca3cd" 577 | uuid = "d125e4d3-2237-4719-b19c-fa641b8a4667" 578 | version = "0.1.8" 579 | 580 | [[deps.MarchingCubes]] 581 | deps = ["StaticArrays"] 582 | git-tree-sha1 = "5f768e0a0c3875df386be4c036f78c8bd4b1a9b6" 583 | uuid = "299715c1-40a9-479a-aaf9-4a633d36f717" 584 | version = "0.1.2" 585 | 586 | [[deps.Markdown]] 587 | deps = ["Base64"] 588 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 589 | 590 | [[deps.MbedTLS_jll]] 591 | deps = ["Artifacts", "Libdl"] 592 | uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" 593 | 594 | [[deps.Measurements]] 595 | deps = ["Calculus", "LinearAlgebra", "Printf", "RecipesBase", "Requires"] 596 | git-tree-sha1 = "88cd033eb781c698e75ae0b680e5cef1553f0856" 597 | uuid = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" 598 | version = "2.7.1" 599 | 600 | [[deps.Missings]] 601 | deps = ["DataAPI"] 602 | git-tree-sha1 = "bf210ce90b6c9eed32d25dbcae1ebc565df2687f" 603 | uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" 604 | version = "1.0.2" 605 | 606 | [[deps.Mmap]] 607 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 608 | 609 | [[deps.Mocking]] 610 | deps = ["Compat", "ExprTools"] 611 | git-tree-sha1 = "29714d0a7a8083bba8427a4fbfb00a540c681ce7" 612 | uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" 613 | version = "0.7.3" 614 | 615 | [[deps.MozillaCACerts_jll]] 616 | uuid = "14a3606d-f60d-562e-9121-12d972cd8159" 617 | 618 | [[deps.MuladdMacro]] 619 | git-tree-sha1 = "c6190f9a7fc5d9d5915ab29f2134421b12d24a68" 620 | uuid = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" 621 | version = "0.2.2" 622 | 623 | [[deps.MutableArithmetics]] 624 | deps = ["LinearAlgebra", "SparseArrays", "Test"] 625 | git-tree-sha1 = "ba8c0f8732a24facba709388c74ba99dcbfdda1e" 626 | uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" 627 | version = "1.0.0" 628 | 629 | [[deps.NaNMath]] 630 | git-tree-sha1 = "737a5957f387b17e74d4ad2f440eb330b39a62c5" 631 | uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" 632 | version = "1.0.0" 633 | 634 | [[deps.NearestNeighbors]] 635 | deps = ["Distances", "StaticArrays"] 636 | git-tree-sha1 = "ded92de95031d4a8c61dfb6ba9adb6f1d8016ddd" 637 | uuid = "b8a86587-4115-5ab1-83bc-aa920d37bbce" 638 | version = "0.4.10" 639 | 640 | [[deps.Neighborhood]] 641 | deps = ["Distances", "NearestNeighbors", "Random", "Test"] 642 | git-tree-sha1 = "1159fcaf3b72923cf623b2748f238a5115ed2623" 643 | uuid = "645ca80c-8b79-4109-87ea-e1f58159d116" 644 | version = "0.2.3" 645 | 646 | [[deps.NetworkOptions]] 647 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 648 | 649 | [[deps.NonlinearSolve]] 650 | deps = ["ArrayInterface", "FiniteDiff", "ForwardDiff", "IterativeSolvers", "LinearAlgebra", "RecursiveArrayTools", "RecursiveFactorization", "Reexport", "SciMLBase", "Setfield", "StaticArrays", "UnPack"] 651 | git-tree-sha1 = "aeebff6a2a23506e5029fd2248a26aca98e477b3" 652 | uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" 653 | version = "0.3.16" 654 | 655 | [[deps.OffsetArrays]] 656 | deps = ["Adapt"] 657 | git-tree-sha1 = "043017e0bdeff61cfbb7afeb558ab29536bbb5ed" 658 | uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" 659 | version = "1.10.8" 660 | 661 | [[deps.OpenBLAS_jll]] 662 | deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] 663 | uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" 664 | 665 | [[deps.OpenLibm_jll]] 666 | deps = ["Artifacts", "Libdl"] 667 | uuid = "05823500-19ac-5b8b-9628-191a04bc5112" 668 | 669 | [[deps.OpenSpecFun_jll]] 670 | deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] 671 | git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" 672 | uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" 673 | version = "0.5.5+0" 674 | 675 | [[deps.OrderedCollections]] 676 | git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c" 677 | uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" 678 | version = "1.4.1" 679 | 680 | [[deps.PDMats]] 681 | deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] 682 | git-tree-sha1 = "e8185b83b9fc56eb6456200e873ce598ebc7f262" 683 | uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" 684 | version = "0.11.7" 685 | 686 | [[deps.Parameters]] 687 | deps = ["OrderedCollections", "UnPack"] 688 | git-tree-sha1 = "34c0e9ad262e5f7fc75b10a9952ca7692cfc5fbe" 689 | uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a" 690 | version = "0.12.3" 691 | 692 | [[deps.Parsers]] 693 | deps = ["Dates"] 694 | git-tree-sha1 = "3b429f37de37f1fc603cc1de4a799dc7fbe4c0b6" 695 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 696 | version = "2.3.0" 697 | 698 | [[deps.Pkg]] 699 | deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] 700 | uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" 701 | 702 | [[deps.Polyester]] 703 | deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Requires", "Static", "StrideArraysCore", "ThreadingUtilities"] 704 | git-tree-sha1 = "8d95a735921204f5d551ac300b20d802a150433a" 705 | uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" 706 | version = "0.6.8" 707 | 708 | [[deps.PolyesterWeave]] 709 | deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] 710 | git-tree-sha1 = "7e597df97e46ffb1c8adbaddfa56908a7a20194b" 711 | uuid = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad" 712 | version = "0.1.5" 713 | 714 | [[deps.Polynomials]] 715 | deps = ["Intervals", "LinearAlgebra", "MutableArithmetics", "RecipesBase"] 716 | git-tree-sha1 = "a1f7f4e41404bed760213ca01d7f384319f717a5" 717 | uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" 718 | version = "2.0.25" 719 | 720 | [[deps.PreallocationTools]] 721 | deps = ["Adapt", "ArrayInterface", "ForwardDiff", "LabelledArrays"] 722 | git-tree-sha1 = "6c138c8510111fa47b5d2ed8ada482d97e279bee" 723 | uuid = "d236fae5-4411-538c-8e31-a6e3d9e00b46" 724 | version = "0.2.4" 725 | 726 | [[deps.Preferences]] 727 | deps = ["TOML"] 728 | git-tree-sha1 = "47e5f437cc0e7ef2ce8406ce1e7e24d44915f88d" 729 | uuid = "21216c6a-2e73-6563-6e65-726566657250" 730 | version = "1.3.0" 731 | 732 | [[deps.Printf]] 733 | deps = ["Unicode"] 734 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 735 | 736 | [[deps.ProgressMeter]] 737 | deps = ["Distributed", "Printf"] 738 | git-tree-sha1 = "d7a7aef8f8f2d537104f170139553b14dfe39fe9" 739 | uuid = "92933f4c-e287-5a05-a399-4b506db050ca" 740 | version = "1.7.2" 741 | 742 | [[deps.QuadGK]] 743 | deps = ["DataStructures", "LinearAlgebra"] 744 | git-tree-sha1 = "78aadffb3efd2155af139781b8a8df1ef279ea39" 745 | uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" 746 | version = "2.4.2" 747 | 748 | [[deps.REPL]] 749 | deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] 750 | uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" 751 | 752 | [[deps.Random]] 753 | deps = ["SHA", "Serialization"] 754 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 755 | 756 | [[deps.RecipesBase]] 757 | git-tree-sha1 = "6bf3f380ff52ce0832ddd3a2a7b9538ed1bcca7d" 758 | uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" 759 | version = "1.2.1" 760 | 761 | [[deps.RecurrenceAnalysis]] 762 | deps = ["DelayEmbeddings", "DelimitedFiles", "Distances", "Graphs", "LinearAlgebra", "Random", "SparseArrays", "StaticArrays", "Statistics", "UnicodePlots"] 763 | git-tree-sha1 = "e282fe5aa73960f7bb55113803c530e5b88ae94c" 764 | uuid = "639c3291-70d9-5ea2-8c5b-839eba1ee399" 765 | version = "1.8.0" 766 | 767 | [[deps.RecursiveArrayTools]] 768 | deps = ["Adapt", "ArrayInterface", "ChainRulesCore", "DocStringExtensions", "FillArrays", "LinearAlgebra", "RecipesBase", "Requires", "StaticArrays", "Statistics", "ZygoteRules"] 769 | git-tree-sha1 = "bfe14f127f3e7def02a6c2b1940b39d0dabaa3ef" 770 | uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" 771 | version = "2.26.3" 772 | 773 | [[deps.RecursiveFactorization]] 774 | deps = ["LinearAlgebra", "LoopVectorization", "Polyester", "StrideArraysCore", "TriangularSolve"] 775 | git-tree-sha1 = "a9a852c7ebb08e2a40e8c0ab9830a744fa283690" 776 | uuid = "f2c3362d-daeb-58d1-803e-2bc74f2840b4" 777 | version = "0.2.10" 778 | 779 | [[deps.Reexport]] 780 | git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" 781 | uuid = "189a3867-3050-52da-a836-e630ba90ab69" 782 | version = "1.2.2" 783 | 784 | [[deps.Requires]] 785 | deps = ["UUIDs"] 786 | git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" 787 | uuid = "ae029012-a4dd-5104-9daa-d747884805df" 788 | version = "1.3.0" 789 | 790 | [[deps.Rmath]] 791 | deps = ["Random", "Rmath_jll"] 792 | git-tree-sha1 = "bf3188feca147ce108c76ad82c2792c57abe7b1f" 793 | uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa" 794 | version = "0.7.0" 795 | 796 | [[deps.Rmath_jll]] 797 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] 798 | git-tree-sha1 = "68db32dff12bb6127bac73c209881191bf0efbb7" 799 | uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" 800 | version = "0.3.0+0" 801 | 802 | [[deps.Roots]] 803 | deps = ["CommonSolve", "Printf", "Setfield"] 804 | git-tree-sha1 = "838b60ee62bebc794864c880a47e331e00c47505" 805 | uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" 806 | version = "1.4.1" 807 | 808 | [[deps.RoundingEmulator]] 809 | git-tree-sha1 = "40b9edad2e5287e05bd413a38f61a8ff55b9557b" 810 | uuid = "5eaf0fd0-dfba-4ccb-bf02-d820a40db705" 811 | version = "0.2.1" 812 | 813 | [[deps.SHA]] 814 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 815 | 816 | [[deps.SIMDDualNumbers]] 817 | deps = ["ForwardDiff", "IfElse", "SLEEFPirates", "VectorizationBase"] 818 | git-tree-sha1 = "62c2da6eb66de8bb88081d20528647140d4daa0e" 819 | uuid = "3cdde19b-5bb0-4aaf-8931-af3e248e098b" 820 | version = "0.1.0" 821 | 822 | [[deps.SIMDTypes]] 823 | git-tree-sha1 = "330289636fb8107c5f32088d2741e9fd7a061a5c" 824 | uuid = "94e857df-77ce-4151-89e5-788b33177be4" 825 | version = "0.1.0" 826 | 827 | [[deps.SLEEFPirates]] 828 | deps = ["IfElse", "Static", "VectorizationBase"] 829 | git-tree-sha1 = "ac399b5b163b9140f9c310dfe9e9aaa225617ff6" 830 | uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa" 831 | version = "0.6.32" 832 | 833 | [[deps.SciMLBase]] 834 | deps = ["ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "RecipesBase", "RecursiveArrayTools", "StaticArrays", "Statistics", "Tables", "TreeViews"] 835 | git-tree-sha1 = "a5305dca1b3ebf83d9c92e2fa244424f1bdb1627" 836 | uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" 837 | version = "1.31.0" 838 | 839 | [[deps.Scratch]] 840 | deps = ["Dates"] 841 | git-tree-sha1 = "0b4b7f1393cff97c33891da2a0bf69c6ed241fda" 842 | uuid = "6c6a2e73-6563-6170-7368-637461726353" 843 | version = "1.1.0" 844 | 845 | [[deps.Serialization]] 846 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 847 | 848 | [[deps.SetRounding]] 849 | git-tree-sha1 = "d7a25e439d07a17b7cdf97eecee504c50fedf5f6" 850 | uuid = "3cc68bcd-71a2-5612-b932-767ffbe40ab0" 851 | version = "0.2.1" 852 | 853 | [[deps.Setfield]] 854 | deps = ["ConstructionBase", "Future", "MacroTools", "Requires"] 855 | git-tree-sha1 = "38d88503f695eb0301479bc9b0d4320b378bafe5" 856 | uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46" 857 | version = "0.8.2" 858 | 859 | [[deps.SharedArrays]] 860 | deps = ["Distributed", "Mmap", "Random", "Serialization"] 861 | uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" 862 | 863 | [[deps.SimpleDiffEq]] 864 | deps = ["DiffEqBase", "MuladdMacro", "RecursiveArrayTools", "Reexport", "StaticArrays"] 865 | git-tree-sha1 = "f8711f4e31bc8c10e59fd698bef155ab9278a50a" 866 | uuid = "05bca326-078c-5bf0-a5bf-ce7c7982d7fd" 867 | version = "1.5.1" 868 | 869 | [[deps.SimpleTraits]] 870 | deps = ["InteractiveUtils", "MacroTools"] 871 | git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" 872 | uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" 873 | version = "0.9.4" 874 | 875 | [[deps.Sockets]] 876 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 877 | 878 | [[deps.SortingAlgorithms]] 879 | deps = ["DataStructures"] 880 | git-tree-sha1 = "b3363d7460f7d098ca0912c69b082f75625d7508" 881 | uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" 882 | version = "1.0.1" 883 | 884 | [[deps.SparseArrays]] 885 | deps = ["LinearAlgebra", "Random"] 886 | uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" 887 | 888 | [[deps.SpecialFunctions]] 889 | deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] 890 | git-tree-sha1 = "5ba658aeecaaf96923dce0da9e703bd1fe7666f9" 891 | uuid = "276daf66-3868-5448-9aa4-cd146d93841b" 892 | version = "2.1.4" 893 | 894 | [[deps.Static]] 895 | deps = ["IfElse"] 896 | git-tree-sha1 = "2114b1d8517764a8c4625a2e97f40640c7a301a7" 897 | uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" 898 | version = "0.6.1" 899 | 900 | [[deps.StaticArrays]] 901 | deps = ["LinearAlgebra", "Random", "Statistics"] 902 | git-tree-sha1 = "cd56bf18ed715e8b09f06ef8c6b781e6cdc49911" 903 | uuid = "90137ffa-7385-5640-81b9-e52037218182" 904 | version = "1.4.4" 905 | 906 | [[deps.Statistics]] 907 | deps = ["LinearAlgebra", "SparseArrays"] 908 | uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" 909 | 910 | [[deps.StatsAPI]] 911 | deps = ["LinearAlgebra"] 912 | git-tree-sha1 = "c82aaa13b44ea00134f8c9c89819477bd3986ecd" 913 | uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" 914 | version = "1.3.0" 915 | 916 | [[deps.StatsBase]] 917 | deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] 918 | git-tree-sha1 = "8977b17906b0a1cc74ab2e3a05faa16cf08a8291" 919 | uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" 920 | version = "0.33.16" 921 | 922 | [[deps.StatsFuns]] 923 | deps = ["ChainRulesCore", "InverseFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] 924 | git-tree-sha1 = "5950925ff997ed6fb3e985dcce8eb1ba42a0bbe7" 925 | uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" 926 | version = "0.9.18" 927 | 928 | [[deps.StrideArraysCore]] 929 | deps = ["ArrayInterface", "CloseOpenIntervals", "IfElse", "LayoutPointers", "ManualMemory", "Requires", "SIMDTypes", "Static", "ThreadingUtilities"] 930 | git-tree-sha1 = "70d9007ff05440058c0301985b2275edc2b2ce25" 931 | uuid = "7792a7ef-975c-4747-a70f-980b88e8d1da" 932 | version = "0.3.3" 933 | 934 | [[deps.StructArrays]] 935 | deps = ["Adapt", "DataAPI", "StaticArrays", "Tables"] 936 | git-tree-sha1 = "57617b34fa34f91d536eb265df67c2d4519b8b98" 937 | uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" 938 | version = "0.6.5" 939 | 940 | [[deps.SuiteSparse]] 941 | deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] 942 | uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" 943 | 944 | [[deps.TOML]] 945 | deps = ["Dates"] 946 | uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" 947 | 948 | [[deps.TableTraits]] 949 | deps = ["IteratorInterfaceExtensions"] 950 | git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" 951 | uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" 952 | version = "1.0.1" 953 | 954 | [[deps.Tables]] 955 | deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] 956 | git-tree-sha1 = "5ce79ce186cc678bbb5c5681ca3379d1ddae11a1" 957 | uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" 958 | version = "1.7.0" 959 | 960 | [[deps.Tar]] 961 | deps = ["ArgTools", "SHA"] 962 | uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" 963 | 964 | [[deps.TensorCore]] 965 | deps = ["LinearAlgebra"] 966 | git-tree-sha1 = "1feb45f88d133a655e001435632f019a9a1bcdb6" 967 | uuid = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50" 968 | version = "0.1.1" 969 | 970 | [[deps.Test]] 971 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 972 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 973 | 974 | [[deps.ThreadingUtilities]] 975 | deps = ["ManualMemory"] 976 | git-tree-sha1 = "f8629df51cab659d70d2e5618a430b4d3f37f2c3" 977 | uuid = "8290d209-cae3-49c0-8002-c8c24d57dab5" 978 | version = "0.5.0" 979 | 980 | [[deps.TimeZones]] 981 | deps = ["Dates", "Downloads", "InlineStrings", "LazyArtifacts", "Mocking", "Printf", "RecipesBase", "Serialization", "Unicode"] 982 | git-tree-sha1 = "0a359b0ee27e4fbc90d9b3da1f48ddc6f98a0c9e" 983 | uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" 984 | version = "1.7.3" 985 | 986 | [[deps.TreeViews]] 987 | deps = ["Test"] 988 | git-tree-sha1 = "8d0d7a3fe2f30d6a7f833a5f19f7c7a5b396eae6" 989 | uuid = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7" 990 | version = "0.3.0" 991 | 992 | [[deps.TriangularSolve]] 993 | deps = ["CloseOpenIntervals", "IfElse", "LayoutPointers", "LinearAlgebra", "LoopVectorization", "Polyester", "Static", "VectorizationBase"] 994 | git-tree-sha1 = "b8d08f55b02625770c09615d96927b3a8396925e" 995 | uuid = "d5829a12-d9aa-46ab-831f-fb7c9ab06edf" 996 | version = "0.1.11" 997 | 998 | [[deps.UUIDs]] 999 | deps = ["Random", "SHA"] 1000 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 1001 | 1002 | [[deps.UnPack]] 1003 | git-tree-sha1 = "387c1f73762231e86e0c9c5443ce3b4a0a9a0c2b" 1004 | uuid = "3a884ed6-31ef-47d7-9d2a-63182c4928ed" 1005 | version = "1.0.2" 1006 | 1007 | [[deps.Unicode]] 1008 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 1009 | 1010 | [[deps.UnicodePlots]] 1011 | deps = ["ColorTypes", "Contour", "Crayons", "Dates", "FileIO", "FreeTypeAbstraction", "LinearAlgebra", "MarchingCubes", "NaNMath", "Printf", "SparseArrays", "StaticArrays", "StatsBase", "Unitful"] 1012 | git-tree-sha1 = "30cdd71bd78478ba19835466c6e2a52ad776d800" 1013 | uuid = "b8865327-cd53-5732-bb35-84acbb429228" 1014 | version = "2.11.1" 1015 | 1016 | [[deps.Unitful]] 1017 | deps = ["ConstructionBase", "Dates", "LinearAlgebra", "Random"] 1018 | git-tree-sha1 = "b649200e887a487468b71821e2644382699f1b0f" 1019 | uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" 1020 | version = "1.11.0" 1021 | 1022 | [[deps.VectorizationBase]] 1023 | deps = ["ArrayInterface", "CPUSummary", "HostCPUFeatures", "Hwloc", "IfElse", "LayoutPointers", "Libdl", "LinearAlgebra", "SIMDTypes", "Static"] 1024 | git-tree-sha1 = "9d1b533f597d87ce9b4abd36a2ce4664f08e08ed" 1025 | uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f" 1026 | version = "0.21.29" 1027 | 1028 | [[deps.Wavelets]] 1029 | deps = ["DSP", "FFTW", "LinearAlgebra", "Reexport", "SpecialFunctions", "Statistics"] 1030 | git-tree-sha1 = "52e87ecea56e02e0672c7f3c9fd9ca03915d7e1b" 1031 | uuid = "29a6e085-ba6d-5f35-a997-948ac2efa89a" 1032 | version = "0.9.4" 1033 | 1034 | [[deps.Zlib_jll]] 1035 | deps = ["Libdl"] 1036 | uuid = "83775a58-1f1d-513f-b197-d71354ab007a" 1037 | 1038 | [[deps.ZygoteRules]] 1039 | deps = ["MacroTools"] 1040 | git-tree-sha1 = "8c1a8e4dfacb1fd631745552c8db35d0deb09ea0" 1041 | uuid = "700de1a5-db45-46bc-99cf-38207098b444" 1042 | version = "0.2.2" 1043 | 1044 | [[deps.libblastrampoline_jll]] 1045 | deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] 1046 | uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" 1047 | 1048 | [[deps.nghttp2_jll]] 1049 | deps = ["Artifacts", "Libdl"] 1050 | uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" 1051 | 1052 | [[deps.p7zip_jll]] 1053 | deps = ["Artifacts", "Libdl"] 1054 | uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" 1055 | -------------------------------------------------------------------------------- /Project.toml: -------------------------------------------------------------------------------- 1 | name = "BasicReservoirComputing" 2 | uuid = "4a4a54cb-0a73-4437-978b-99751ad1ba7d" 3 | authors = ["Jason Platt <1763platt@gmail.com>"] 4 | version = "1.0.0" 5 | 6 | [deps] 7 | ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d" 8 | CMAEvolutionStrategy = "8d3b24bd-414e-49e0-94fb-163cc3a3e411" 9 | ChaosTools = "608a59af-f2a3-5ad4-90b4-758bdf3122a7" 10 | Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" 11 | DynamicalSystems = "61744808-ddfa-5f27-97ff-6e42cc95d634" 12 | LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 13 | MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2" 14 | Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" 15 | Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 16 | SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BasicReservoirComputing 2 | Implementation of a reservoir computer with functions to optimize the parameters and calculate the Lyapunov exponents 3 | 4 | Please cite if using this code: 5 | >Platt, J. A., Penny, S. G., Smith, T. A., Chen, T.-C., & Abarbanel, H. D. I. (2022). A Systematic Exploration of Reservoir Computing for Forecasting Complex Spatiotemporal Dynamics. arXiv http://arxiv.org/abs/2201.08910 6 | 7 | Examples are found under the examples folder in the github repo. 8 | 9 | To install the package should be registered. 10 | ```Julia 11 | import Pkg 12 | Pkg.add("BasicReservoirComputing") 13 | ``` 14 | 15 | if not then add from github 16 | ```Julia 17 | import Pkg 18 | Pkg.add("git@github.com:japlatt/DynamicalRC.git") 19 | ``` 20 | 21 | ## Basic Functionality 22 | The code is built around the rc object 23 | 24 | ```Julia 25 | struct rc 26 | """Structure holding the rc parameters and matrixes 27 | 28 | Args: 29 | D::Int : Input system Dimension 30 | N::Int : Reservoir Dimension 31 | SR::Float : Spectral Radius 32 | ρA::Float : Density of A 33 | α::Float : Leak Rate 34 | σ::Float : Input Strength 35 | random_state::Int : Random seed 36 | σb::Float : Bias 37 | β::Float : Tikhonov regularization 38 | (params)::NamedTuple : Named tuple with fields SR, α, σ, σb, β 39 | """ 40 | function rc(D, N, ρA, Δt, SR, α, σ, σb, β; 41 | random_state=111111) 42 | end 43 | function rc(D, N, ρA, Δt, params::NamedTuple; random_state=111111) 44 | rng = MersenneTwister(random_state) 45 | end 46 | end 47 | ``` 48 | To initialize the rc we can either specify all the parameters or pass in a few along with a named tuple which contains the fields (SR, α, σ, σb, β). This functionality is mainly to help with integration with the optimization code 49 | 50 | Once the rc has been initialized we can use the function train_RC 51 | ```Julia 52 | function train_RC(rc::rc, u; spinup = 100, readout = false) 53 | """Train the rc 54 | 55 | This function sets the matrix rc.Wout 56 | u ∈ D×T 57 | r ∈ N×T 58 | 59 | Args: 60 | rc : reservoir computer 61 | u : Array of data of shape D×Time 62 | spinup : Amount of data to use for spinup 63 | Returns: 64 | if readout=true: Wout*r, the readout of the rc training data 65 | else: return the last state of r, can be used to predict 66 | forward from the training data 67 | """ 68 | ``` 69 | which takes in the rc and the training data u. u is a matrix of equally spaced data of shape (D, Time). Training will set the field Wout in the rc. 70 | 71 | We can do a single forecast over nsteps. 72 | ```Julia 73 | function forecast_RC(rc::rc, nsteps; uspin=nothing, r0 = nothing) 74 | """Forecast nsteps forward in time from the end of uspin or from rc state r0 75 | 76 | Make sure to train the RC before forecasting. Requires either uspin or r0. 77 | If both are provided will use uspin to set r0. 78 | """ 79 | ``` 80 | The functionality is that we can either give a reservoir state r0 to start the forecast or some data uspin in order to "spin up" the reservoir. See the paper for more discussion. If we'd like to test an ensemble off different test data then we can use test_RC() to return an array of valid prediction time. 81 | ```Julia 82 | function test_RC(rc::rc, test_arr; ϵ=0.3, spinup=100) 83 | """Test the RC on all the forecasts in test_arr 84 | 85 | Args: 86 | rc : reservoir computer 87 | test_arr : array of forecasts DxT 88 | 89 | Returns: 90 | valid prediction time of all the tests 91 | """ 92 | ``` 93 | See the paper for the formula as to how this is calculated. 94 | 95 | ## Optimization 96 | In order for the RC to be useful we must find the correct parameters for the RC for the given problem. Here we use an optimization routine, again see paper for details. 97 | ```Julia 98 | opt_lower_bounds = @with_kw (SR_lb = 0.01, α_lb = 0.0, σ_lb = 1e-12, σb_lb = 0.0, β_lb = 1e-12) 99 | opt_upper_bounds = @with_kw (SR_ub = 2.0, α_ub = 1.0, σ_ub = 1.0, σb_ub = 4.0, β_ub = 2.0) 100 | 101 | struct opt 102 | """Optimization object 103 | 104 | Args: 105 | train_data, valid_data_list, spinup_steps, N, ρA 106 | lb::NamedTuple : use opt_lower_bounds to set lower bounds on params 107 | ub::NamedTuple : use opt_upped_bounds to set upper bounds on params 108 | """ 109 | ``` 110 | The opt object takes in some DxT shaped training data, a list of DxT validation data and arguments for spinup steps, reservoir size/density and lower/upper bounds. There are convenience functions for the lower and upper bounds which can be passed in with the changes specified e.g., lb = opt_lower_bounds(SR_lb = 0.5) and the rest set to default. 111 | 112 | The optimization works using the algorithm CMAES but will hopefully be extended at some point to use any global optimization algorithm. 113 | 114 | Now just call the algorithm 115 | ```Julia 116 | function (f::opt)(;maxtime=200, popsize = 15, multithread = false) 117 | """Call future forecasting optimization routine 118 | 119 | This routine optimizes the rc by looking at a number of long term forecasts 120 | of the data and comparing them. 121 | """ 122 | ``` 123 | so if optimization = opt(train_data, valid_data_list, spinup_steps, N, ρA) then just call optimization() to get the best parameters. Multithreading can be a bit temperamental on some systems, make sure to initialize julia with multiple threads "julia -t2" if using this option. maxtime and popsize may need to be adjusted depending on the difficulty of the problem. 124 | 125 | An example from the examples folder is shown below 126 | ```Julia 127 | function opt_rc(N, train_data, valid_data; Δt = 0.01) 128 | """Find the RC parameters through optimization""" 129 | # define some parameters 130 | nspin = 200 131 | ρA = 0.02 132 | D = size(train_data)[1] 133 | multithread = Threads.nthreads() > 1 ? true : false 134 | 135 | # Optimize the RC 136 | rc_opt = opt(train_data, valid_data, nspin, N, ρA, 137 | lb = opt_lower_bounds(), ub = opt_upper_bounds()) 138 | params, cost = rc_opt(maxtime=200, multithread=multithread) 139 | return params 140 | end 141 | ``` 142 | 143 | ## Lyapunov Exponents 144 | One way to check the fidelity of the RC is to check that its Lyapunov exponents match those of the input data. See the paper or 145 | >Jason A. Platt et al. "Robust forecasting using predictive generalized synchronization in reservoir computing". In: Chaos 31 (2021), p. 123118. URL: . 146 | for a more detailed description. 147 | 148 | The routine here is 149 | ```Julia 150 | function Global_LEs(rc::rc, u, nspin; num_exp = 1, renorm_steps=10) 151 | """Find the Lyapunov Exponents of the rc 152 | 153 | Args: 154 | rc : reservoir computer 155 | u : input data, must be enough for the estimate. Shorter=less accurate 156 | nspin : spinup steps to use 157 | num_exp : number of exponents to compute out of N 158 | renorm_steps : How many steps before renormalizing using QR decomposition 159 | Returns: 160 | Lyapunov Exponents : Array 161 | """ 162 | ``` 163 | calculated with the help of DynamicalSystems.jl . u is the data over which the estimate is done. renorm_steps can help speed up the computation but will reduce accuracy if one is looking for the short term exponents. Warning: the finite time LEs are not invariant over the attractor. num_exp chooses the number of LEs to calculate. 164 | 165 | We also expose the Tangent linear model TLM()/TLM!() in case one has need of it. For instance in data assimilation algorithms. 166 | 167 | ## Possible Bugs 168 | There may be an issue with the matrix solve and multithreading. This is sometimes solved by using MKL as a backend for the matrix operations but not always. Still trying to track this one down. If you run into issues you can try changing this. 169 | -------------------------------------------------------------------------------- /examples/BasicRCExample.jl: -------------------------------------------------------------------------------- 1 | using Plots 2 | using Random 3 | using DifferentialEquations 4 | using LinearAlgebra 5 | using DynamicalSystems 6 | using Parameters 7 | using BasicReservoirComputing 8 | 9 | include("utilities.jl") 10 | 11 | function test_rc(system::DynamicalSystem, params::NamedTuple; Δt = 0.01) 12 | D=length(system.u0) 13 | utrain, utest_arr = make_data(system; train_time = 100, test_time = 25, n_test = 100) 14 | 15 | @unpack N, SR, ρA, α, σ, β, σb, nspin = params 16 | 17 | # Build and Train RC 18 | reservoir = rc(D, N, ρA, Δt, SR, α, σ, σb, β) 19 | train_RC(reservoir, utrain, spinup=nspin) 20 | 21 | # Forecast RC 22 | utrue = utest_arr[1][:, nspin:end] 23 | nsteps = size(utrue)[2] 24 | upred = forecast_RC(reservoir, nsteps, uspin = utest_arr[1][:, 1:nspin]) 25 | t = collect(0:nsteps-1)*Δt 26 | 27 | p1 = plot_prediction(t, upred, utrue) 28 | 29 | # Test on many points 30 | vpt = test_RC(reservoir, utest_arr; ϵ=0.3, spinup=nspin) 31 | p2 = histogram(vpt, legend=false, 32 | overwrite_figure=false) 33 | xlabel!(p2, "Valid Prediction Time") 34 | pfinal = plot(p1, p2, layout = (1, 2), show=true) 35 | display(pfinal) 36 | return reservoir 37 | end 38 | 39 | params = (N=200, σ=0.084, α=0.6, SR=0.8, ρA=0.02, β=8.5e-8, σb=1.6, nspin=200) 40 | system = Systems.lorenz() 41 | reservoir = test_rc(system, params); -------------------------------------------------------------------------------- /examples/BasicRC_OptimizationExample.jl: -------------------------------------------------------------------------------- 1 | using LinearAlgebra 2 | using DynamicalSystems 3 | using Parameters 4 | using Plots 5 | using MKL 6 | using BasicReservoirComputing 7 | include("utilities.jl") 8 | 9 | function opt_rc(N, train_data, valid_data; Δt = 0.01) 10 | """Find the RC parameters through optimization""" 11 | # define some parameters 12 | nspin = 200 13 | ρA = 0.02 14 | D = size(train_data)[1] 15 | multithread = Threads.nthreads() > 1 ? true : false 16 | 17 | # Optimize the RC 18 | rc_opt = opt(train_data, valid_data, nspin, N, ρA, 19 | lb = opt_lower_bounds(), ub = opt_upper_bounds()) 20 | params, cost = rc_opt(maxtime=200, multithread=multithread) 21 | return params 22 | end 23 | 24 | function test_rc(system::DynamicalSystem, params::NamedTuple; Δt = 0.01) 25 | """Test the rc on the given system with params""" 26 | D=length(system.u0) 27 | utrain, utest_arr = make_data(system; train_time = 100, test_time = 25, n_test = 100) 28 | 29 | @unpack N, SR, ρA, α, σ, β, σb, nspin = params 30 | 31 | # Build and Train RC 32 | reservoir = rc(D, N, ρA, Δt, SR, α, σ, σb, β) 33 | train_RC(reservoir, utrain, spinup=nspin) 34 | 35 | # Forecast RC 36 | utrue = utest_arr[1][:, nspin:end] 37 | nsteps = size(utrue)[2] 38 | upred = forecast_RC(reservoir, nsteps, uspin = utest_arr[1][:, 1:nspin]) 39 | t = collect(0:nsteps-1)*Δt 40 | 41 | p1 = plot_prediction(t, upred, utrue) 42 | 43 | # Test on many points 44 | vpt = test_RC(reservoir, utest_arr; ϵ=0.3, spinup=nspin) 45 | p2 = histogram(vpt, legend=false, 46 | overwrite_figure=false, 47 | show=false) 48 | xlabel!(p2, "Valid Prediction Time") 49 | pfinal = plot(p1, p2, layout = (1, 2), show=true) 50 | display(pfinal) 51 | return reservoir 52 | end 53 | 54 | # First make some data 55 | system = Systems.lorenz() 56 | Δt = 0.01 57 | train_time=100 58 | valid_time = 15 59 | n_valid = 15 60 | utrain, uvalid_arr = make_data(system; train_time = train_time, 61 | test_time = valid_time, n_test = n_valid, 62 | Δt = Δt) 63 | 64 | # Now find the best parameters 65 | N=200 66 | params = opt_rc(N, utrain, uvalid_arr) 67 | 68 | # Test the RC with the optimized params 69 | reservoir = test_rc(system, merge(params, (N=N, ρA=0.02, nspin=200))) 70 | 71 | # See how the lyapunov exponents compare 72 | renorm = 10 # speeds up the calculation by not doing QR renormalization every step 73 | nspin = 200 74 | 75 | rc_LEs = Global_LEs(reservoir, utrain, nspin, 76 | num_exp = length(system.u0), 77 | renorm_steps=renorm) 78 | sys_LEs = lyapunovspectrum(system, 10000) 79 | println("rc_LEs = $rc_LEs") 80 | println("system_LEs = $sys_LEs") -------------------------------------------------------------------------------- /examples/platt2022_example.jl: -------------------------------------------------------------------------------- 1 | using Plots 2 | using Random 3 | using DifferentialEquations 4 | using LinearAlgebra 5 | using DynamicalSystems 6 | using Parameters 7 | using BasicReservoirComputing 8 | 9 | include("utilities.jl") 10 | 11 | @inline @inbounds function colpitts_eom(x, p, t) 12 | α = p[1]; Γ = p[2]; q = p[3]; η = p[4] 13 | du1 = α*x[2] 14 | du2 = -Γ*(x[1] + x[3]) - q*x[2] 15 | du3 = η*(x[2] + 1 - exp(-x[1])) 16 | return SVector{3}(du1, du2, du3) 17 | end 18 | 19 | @inline @inbounds function colpitts_jac(x, p, t) 20 | α = p[1]; Γ = p[2]; q = p[3]; η = p[4] 21 | J = @SMatrix [0 α 0; 22 | -Γ -q -Γ; 23 | η*exp(-x[1]) η 0] 24 | return J 25 | end 26 | 27 | @inline @inbounds function CL63_eom(x, p, t) 28 | xe,ye,ze, xt,yt,zt, xo,yo,zo = x 29 | sigma, rho, beta, S, k1, k2, tau, c, ce, cz = p 30 | 31 | dxedt = sigma*(ye - xe) - ce*(S*xt + k1) 32 | dyedt = rho*xe - ye - xe*ze + ce*(S*yt + k1) 33 | dzedt = xe*ye - beta*ze 34 | 35 | # Tropical atmosphere system 36 | dxtdt = sigma*(yt - xt) - c*(S*xo + k2) - ce*(S*xe + k1) 37 | dytdt = rho*xt - yt - xt*zt + c*(S*yo + k2) + ce*(S*ye + k1) 38 | dztdt = xt*yt - beta*zt + cz*zo 39 | 40 | # Tropical ocean system 41 | dxodt = tau*sigma*(yo - xo) - c*(xt + k2) 42 | dyodt = tau*rho*xo - tau*yo - tau*S*xo*zo + c*(yt + k2) 43 | dzodt = tau*S*xo*yo - tau*beta*zo - cz*zt 44 | return SVector{9}(dxedt,dyedt,dzedt, 45 | dxtdt,dytdt,dztdt, 46 | dxodt,dyodt,dzodt) 47 | end 48 | 49 | @inline @inbounds function CL63_jac(x, p, t) 50 | xe,ye,ze, xt,yt,zt, xo,yo,zo = x 51 | σ, ρ, β, S, k1, k2, τ, c, ce, cz = p 52 | J = @SMatrix [-σ σ 0 -ce*S 0 0 0 0 0; 53 | ρ-ze -1 -xe 0 ce*S 0 0 0 0; 54 | ye xe -β 0 0 0 0 0 0; 55 | -ce*S 0 0 -σ σ 0 -c*S 0 0; 56 | 0 ce*S 0 ρ-zt -1 -xt 0 c*S 0; 57 | 0 0 0 yt xt -β 0 0 cz; 58 | 0 0 0 -c 0 0 -τ*σ τ*σ 0; 59 | 0 0 0 0 c 0 τ*(σ-S*zo) -τ -τ*S*xo; 60 | 0 0 0 0 0 -cz τ*S*yo τ*S*xo -τ*β] 61 | return J 62 | end 63 | 64 | function test_rc(system::DynamicalSystem, params::NamedTuple; 65 | Δt = 0.01, train_time=100, test_time = 50, n_test = 100) 66 | D=length(system.u0) 67 | utrain, utest_arr = make_data(system; train_time = train_time, 68 | test_time = test_time, n_test = n_test) 69 | 70 | @unpack N, SR, ρA, α, σ, β, σb, nspin = params 71 | 72 | # Build and Train RC 73 | reservoir = rc(D, N, ρA, Δt, SR, α, σ, σb, β) 74 | train_RC(reservoir, utrain, spinup=nspin) 75 | 76 | # Forecast RC 77 | utrue = utest_arr[1][:, nspin:end] 78 | nsteps = size(utrue)[2] 79 | upred = forecast_RC(reservoir, nsteps, uspin = utest_arr[1][:, 1:nspin]) 80 | t = collect(0:nsteps-1)*Δt 81 | 82 | p1 = plot_prediction(t, upred, utrue) 83 | 84 | # Test on many points 85 | vpt = test_RC(reservoir, utest_arr; ϵ=0.3, spinup=nspin) 86 | p2 = histogram(vpt, legend=false, 87 | overwrite_figure=false, bins = 15) 88 | xlabel!(p2, "Valid Prediction Time") 89 | pfinal = plot(p1, p2, layout = (1, 2), show=true) 90 | display(pfinal) 91 | return reservoir 92 | end 93 | 94 | CL63 = (σ = 0.007, α = 1.00, SR = 0.01, β = 2.201375e-08, σb = 0.66, 95 | N = 2000, ρA = 0.02, nspin = 200) 96 | L63 = (σ = 0.084,α = 0.60, SR = 0.80, β = 8.493901e-08, σb = 1.60, 97 | N = 800, ρA = 0.02, nspin = 200) 98 | L9610d = (σ = 0.005, α = 0.72, SR = 0.21, β = 7.640822e-09, σb = 1.47, 99 | N = 2000, ρA = 0.02, nspin = 200) 100 | L965d = (σ = 0.060, α = 0.70, SR = 0.58, β = 6.332524e-09, σb = 1.59, 101 | N = 800, ρA = 0.02, nspin = 200) 102 | colpitts = (σ = 0.100, α = 1.00, SR = 1.20, β = 1.000000e-08, σb = 2.00, 103 | N = 800, ρA = 0.02, nspin = 200) 104 | rossler = (σ = 0.066, α = 0.47, SR = 0.50, β = 2.101845e-09, σb = 1.23, 105 | N = 800, ρA = 0.02, nspin = 200) 106 | 107 | sys_L63 = Systems.lorenz() 108 | sys_L965d = Systems.lorenz96(5, F=8.0) 109 | sys_L9610d = Systems.lorenz96(10, F=8.0) 110 | sys_rossler = Systems.roessler() 111 | sys_colpitts = ContinuousDynamicalSystem(colpitts_eom, 112 | rand(3), 113 | [5.0, 0.08, 0.7, 6.3], 114 | colpitts_jac) 115 | sys_CL63 = ContinuousDynamicalSystem(CL63_eom, 116 | [-3.1, -3.1, 20.7, -3.1, -3.1, 20.7, -3.1, -3.1, 20.7], 117 | [10, 28, 8/3., 1, 10, -11, 0.1, 1, 0.08, 1], 118 | CL63_jac) 119 | # change arguments to test different systems 120 | trained_reservoir = test_rc(sys_L63, L63, test_time = 25); -------------------------------------------------------------------------------- /examples/utilities.jl: -------------------------------------------------------------------------------- 1 | using Plots 2 | using Random 3 | using DifferentialEquations 4 | using DynamicalSystems 5 | 6 | function make_data(system::DynamicalSystem; 7 | train_time = 100, nspin=500, test_time = 15, n_test = 10, Δt=0.01) 8 | """make training and testing data from the dynamical system""" 9 | options = (alg = Vern9(), abstol = 1e-12,reltol=1e-12) 10 | D = length(system.u0) 11 | train_data = trajectory(system, train_time, system.u0.*rand(D).+rand(D); 12 | Δt=Δt, 13 | Ttr=nspin, diffeq=options) 14 | test_data = Matrix{Float64}[] 15 | for i in 1:n_test 16 | data = trajectory(system, test_time, system.u0.*rand(D).+rand(D); 17 | Δt=Δt, 18 | Ttr=nspin, diffeq=options) 19 | push!(test_data, collect(Matrix(data)')) 20 | end 21 | return collect(Matrix(train_data)'), test_data 22 | end 23 | 24 | function plot_prediction(time, upred, utrue) 25 | """Plotting function""" 26 | p = [] 27 | D = size(upred)[1] 28 | for i in 1:D 29 | if i == 1 30 | px = plot(time, upred[1, :], label="RC") 31 | plot!(px, time, utrue[1, :], label="Truth") 32 | else 33 | px = plot(time, upred[i, :]) 34 | plot!(px, time, utrue[i, :], legend=false) 35 | end 36 | ylabel!(px, "X$i") 37 | if i!=D xticks!(px, Int[]) end 38 | push!(p, px) 39 | end 40 | 41 | xlabel!(p[end], "Time") 42 | return plot(p..., layout=(D, 1), link=:x) 43 | end -------------------------------------------------------------------------------- /src/BasicReservoirComputing.jl: -------------------------------------------------------------------------------- 1 | module BasicReservoirComputing 2 | """Basic implementation of a Reservoir computer 3 | 4 | Author: Jason Platt 5 | Email: 1763platt@gmail.com 6 | """ 7 | 8 | module RC 9 | 10 | export rc, train_RC, test_RC, forecast_RC, TLM!, Global_LEs 11 | 12 | using SparseArrays 13 | using LinearAlgebra 14 | using Random 15 | using ArnoldiMethod 16 | using DynamicalSystems 17 | using Parameters 18 | using Distributions 19 | 20 | 21 | if (Threads.nthreads() > 1) & !Sys.isapple() 22 | using MKL 23 | end 24 | 25 | struct rc 26 | """Structure holding the rc parameters and matrixes 27 | 28 | Args: 29 | D::Int : Input system Dimension 30 | N::Int : Reservoir Dimension 31 | SR::Float : Spectral Radius 32 | ρA::Float : Density of A 33 | α::Float : Leak Rate 34 | σ::Float : Input Strength 35 | random_state::Int : Random seed 36 | σb::Float : Bias 37 | β::Float : Tikhonov regularization 38 | (params)::NamedTuple : Named tuple with fields SR, α, σ, σb, β 39 | """ 40 | D::Int # Input System Dimension 41 | N::Int # Reservoir Dimension 42 | SR::Float64 # Spectral Radius of A 43 | ρA::Float64 # Density of A 44 | α::Float64 # Leak Rate 45 | σ::Float64 # Input Strength 46 | σb::Float64 # Input Bias 47 | β::Float64 # Tikhonov Regularization 48 | A::SparseMatrixCSC{Float64, Int64} # Adjacency Matrix 49 | Win::Array{Float64,2} # Input Matrix 50 | Wout::Array{Float64,2} # Output Matrix 51 | W::Array{Float64,2} # A + Win Wout 52 | rng::MersenneTwister # Random Number Generator 53 | climstd::Vector{Float64} # climatological standard deviation 54 | Δt::Float64 # Time step of the data/RC 55 | function rc(D, N, ρA, Δt, SR, α, σ, σb, β; 56 | random_state=111111) 57 | @assert SR > 0 58 | # Random number generator 59 | rng = MersenneTwister(random_state) 60 | 61 | # Initialize the connectivity matrix/Win and allocate memory 62 | A, Win, Wout, W, climstd = initialize_weights(D, N, SR, ρA, σ, rng) 63 | new(D, N, SR, ρA, α, σ, σb, β, A, Win, Wout, W, rng, climstd, Δt) 64 | end 65 | function rc(D, N, ρA, Δt, params::NamedTuple; random_state=111111) 66 | rng = MersenneTwister(random_state) 67 | @unpack SR, α, σ, σb, β = params 68 | @assert SR > 0 69 | A, Win, Wout, W, climstd = initialize_weights(D, N, SR, ρA, σ, rng) 70 | new(D, N, SR, ρA, α, σ, σb, β, A, Win, Wout, W, rng, climstd, Δt) 71 | end 72 | end 73 | 74 | function initialize_weights(D, N, SR, ρA, σ, rng) 75 | """Initialize the adjacency matrix, Win and allocate memory""" 76 | A = get_connection_matrix(N, ρA, SR, rng) 77 | Win = rand(rng, Uniform(-σ, σ), N, D) 78 | Wout = Array{Float64}(undef, (D, N)) 79 | W = Array{Float64}(undef, (N, N)) 80 | climstd = Vector{Float64}(undef, D) 81 | return A, Win, Wout, W, climstd 82 | end 83 | 84 | function get_connection_matrix(N, ρA, SR, rng) 85 | """Initialize A and rescale maximal eigenvalue""" 86 | uni = Uniform(-1.0, 1.0) 87 | rf(rng, N) = rand(rng, uni, N) 88 | A = sprand(rng, N, N, ρA, rf) 89 | λs, _ = partialeigen(partialschur(A, nev=1, tol=1e-3, which=LM())[1]) 90 | maxeig = abs(λs[1]) 91 | A = A.*(SR/maxeig) 92 | return A 93 | end 94 | 95 | function train_RC(rc::rc, u; spinup = 100, readout = false) 96 | """Train the rc 97 | 98 | This function sets the matrix rc.Wout 99 | u ∈ D×T 100 | r ∈ N×T 101 | 102 | Args: 103 | rc : reservoir computer 104 | u : Array of data of shape D×Time 105 | spinup : Amount of data to use for spinup 106 | Returns: 107 | if readout=true: Wout*r, the readout of the rc training data 108 | else: return the last state of r, can be used to predict 109 | forward from the training data 110 | """ 111 | @assert size(u)[1] == rc.D 112 | r = generate(rc, u) 113 | @views compute_Wout(rc, r[:, 1+spinup:end], u[:, 1+spinup:end]) 114 | rc.W[:, :] .= rc.Win*rc.Wout .+ rc.A 115 | rc.climstd[:] .= vec(std(u, dims=2)) 116 | if readout == true return rc.Wout*r end 117 | return r[:, end] 118 | end 119 | 120 | function forecast_RC(rc::rc, nsteps; uspin=nothing, r0 = nothing) 121 | """Forecast nsteps forward in time from the end of uspin or from rc state r0 122 | 123 | Make sure to train the RC before forecasting. Requires either uspin or r0. 124 | If both are provided will use uspin to set r0. 125 | """ 126 | if !isnothing(uspin) 127 | @assert size(uspin)[1] == rc.D 128 | rspin = generate(rc, uspin) 129 | r0 = rspin[:, end] 130 | end 131 | @assert !isnothing(r0) 132 | 133 | rfc = Array{Float64}(undef, (rc.N, nsteps)) 134 | rfc[:, 1] = r0 135 | 136 | for t in 1:nsteps-1 137 | @views @inbounds @fastmath auto_rc!(rfc[:, t+1], rc, rfc[:, t]) 138 | end 139 | return rc.Wout*rfc 140 | end 141 | 142 | function test_RC(rc::rc, test_arr; ϵ=0.3, spinup=100) 143 | """Test the RC on all the forecasts in test_arr 144 | 145 | Args: 146 | rc : reservoir computer 147 | test_arr : array of forecasts DxT 148 | 149 | Returns: 150 | valid prediction time of all the tests 151 | """ 152 | vpt = Float64[] 153 | for (i,test) in enumerate(test_arr) 154 | @assert size(test)[1] == rc.D 155 | utest = test[:, spinup:end] 156 | nsteps = size(utest)[2] 157 | upred = forecast_RC(rc, nsteps, uspin = test[:, 1:spinup]) 158 | 159 | diff = sqrt.(mean(((utest .- upred)./rc.climstd).^2, dims=1)) 160 | 161 | thresh = vec(diff .> ϵ) 162 | idx = findfirst(thresh) 163 | if isnothing(idx) idx = length(thresh) end 164 | push!(vpt, idx*rc.Δt) 165 | end 166 | return vpt 167 | end 168 | 169 | function auto_rc!(rtp1, rc::rc, rt) 170 | rtp1[:] .= rc.α.*tanh.(rc.A*rt .+ rc.Win*rc.Wout*rt .+ rc.σb).+(1 .- rc.α).*rt 171 | end 172 | 173 | function driven_rc!(rtp1, rc::rc, rt, ut) 174 | rtp1[:] .= rc.α.*tanh.(rc.A*rt .+ rc.Win*ut .+ rc.σb).+(1 .- rc.α).*rt 175 | end 176 | 177 | 178 | function generate(rc::rc, u) 179 | """Generate hidden RC states on input data u""" 180 | T = size(u)[2] 181 | r = Array{Float64}(undef, (rc.N, T)) 182 | r[:, 1] = zeros(rc.N) 183 | for t in 2:T 184 | @views @inbounds @fastmath driven_rc!(r[:, t], rc, r[:, t-1], u[:, t-1]) 185 | end 186 | return r 187 | end 188 | 189 | function compute_Wout(rc::rc, r, u) 190 | """Linear regression to find Wout""" 191 | try 192 | rc.Wout[:, :] .= (Symmetric(r*r'+rc.β*I)\(r*u'))' 193 | catch e 194 | println("Training Failed") 195 | println(e) 196 | end 197 | end 198 | 199 | function TLM(rc, r) 200 | """The tangent linear model maps how perturbations 201 | to the model evolve in time. 202 | """ 203 | t0 = rc.α.*(1 .- tanh.(rc.W*r .+ rc.σb).^2) 204 | Q = t0.*rc.W 205 | Q[diagind(Q)].+=(1 - rc.α) 206 | return Q 207 | end 208 | 209 | function TLM!(Q, rc, r) 210 | """The tangent linear model maps how perturbations 211 | to the model evolve in time. 212 | """ 213 | t0 = rc.α.*(1 .- tanh.(rc.W*r .+ rc.σb).^2) 214 | Q[:, :] .= t0.*rc.W 215 | Q[diagind(Q)].+=(1 - rc.α) 216 | end 217 | 218 | function Global_LEs(rc::rc, u, nspin; num_exp = 1, renorm_steps=10) 219 | """Find the Lyapunov Exponents of the rc 220 | 221 | Args: 222 | rc : reservoir computer 223 | u : input data, must be enough for the estimate. length(u)>renorm_steps*num_evals+nspin 224 | nspin : spinup steps to use 225 | num_exp : number of exponents to compute out of N 226 | renorm_steps : How many steps before renormalizing using QR decomposition 227 | num_evals : Number of renormalization steps to conduct 228 | Returns: 229 | Lyapunov Exponents : Array 230 | """ 231 | function f!(xnew, x, p, t) 232 | driven_rc!(xnew, rc, x, @view(p[1][:, t+1])) 233 | end 234 | function fJac!(Jnew, x, p, t) 235 | TLM!(Jnew, rc, x) 236 | end 237 | num_evals = trunc(Int, (size(u)[2]-nspin)/renorm_steps) 238 | DS = DiscreteDynamicalSystem(f!, zeros(rc.N), [u], fJac!) 239 | return lyapunovspectrum(DS, num_evals, num_exp, Δt = renorm_steps, Ttr = nspin)/rc.Δt 240 | end 241 | end 242 | 243 | module Opt 244 | 245 | export opt, opt_lower_bounds, opt_upper_bounds 246 | 247 | using ..RC 248 | using LinearAlgebra 249 | using Parameters 250 | using CMAEvolutionStrategy 251 | 252 | if (Threads.nthreads() > 1) & !Sys.isapple() 253 | using MKL 254 | end 255 | 256 | opt_lower_bounds = @with_kw (SR_lb = 0.01, α_lb = 0.0, σ_lb = 1e-12, σb_lb = 0.0, β_lb = 1e-12) 257 | opt_upper_bounds = @with_kw (SR_ub = 2.0, α_ub = 1.0, σ_ub = 1.0, σb_ub = 4.0, β_ub = 2.0) 258 | 259 | struct opt 260 | """Optimization object 261 | 262 | Args: 263 | train_data, valid_data_list, spinup_steps, N, ρA 264 | lb::NamedTuple : use opt_lower_bounds to set lower bounds on params 265 | ub::NamedTuple : use opt_upped_bounds to set upper bounds on params 266 | """ 267 | lb::Array{Float64, 1} # lower bounds 268 | ub::Array{Float64, 1} # upped bounds 269 | train_data::Array{Float64, 2} # Training data D×T 270 | valid_data_list::Array{AbstractArray{Float64,2},1} # List of validation data 271 | spinup_steps::Int64 # Number of spinup steps 272 | N::Int64 # rc size 273 | ρA::Float64 # density of A 274 | function opt(train_data, valid_data_list, spinup_steps, N, ρA; 275 | lb = opt_lower_bounds(), ub = opt_upper_bounds()) 276 | @unpack SR_lb, α_lb, σ_lb, σb_lb, β_lb = lb 277 | @unpack SR_ub, α_ub, σ_ub, σb_ub, β_ub = ub 278 | lb = [SR_lb, α_lb, log(σ_lb), σb_lb, log(β_lb)] 279 | ub = [SR_ub, α_ub, log(σ_ub), σb_ub, log(β_ub)] 280 | @assert lb < ub 281 | @assert ρA <= 1.0 282 | @assert ρA >= 0.0 283 | new(lb, ub, train_data, valid_data_list, spinup_steps, N, ρA) 284 | end 285 | end 286 | 287 | function (f::opt)(;maxtime=200, popsize = 15, multithread = false) 288 | """Call future forecasting optimization routine 289 | 290 | This routine optimizes the rc by looking at a number of long term forecasts 291 | of the data and comparing them. 292 | """ 293 | if multithread 294 | @assert Threads.nthreads() > 1 295 | end 296 | function Loss(data, spinup_steps, rc::rc) 297 | """Loss function over 1 forecast""" 298 | uspin = @view data[:, 1:spinup_steps] 299 | utrue = @view data[:, f.spinup_steps:end] 300 | Ttrue = size(utrue)[2] 301 | upred = forecast_RC(rc, Ttrue; uspin=uspin) 302 | err = upred.-utrue 303 | weight = exp.(-(1:Ttrue)./Ttrue) 304 | return norm(err.*weight') 305 | end 306 | 307 | function obj(θ) 308 | """Objective function to optimize""" 309 | θ = untransform(θ) 310 | SR, α, logσ, σb, logβ = θ 311 | D, _ = size(f.train_data) 312 | reservoir = rc(D, f.N, f.ρA, 1.0, SR, α, exp(logσ), σb, exp(logβ)) 313 | train_RC(reservoir, f.train_data) 314 | n_valid = length(f.valid_data_list) 315 | loss = zeros(n_valid) 316 | for i in 1:n_valid 317 | @inbounds @views loss[i] = Loss(f.valid_data_list[i], f.spinup_steps, reservoir) 318 | end 319 | return sum(loss) 320 | end 321 | 322 | function untransform(θ::AbstractArray{Float64, 1}) 323 | return f.lb + (f.ub - f.lb).*θ/10 324 | end 325 | 326 | function transform(θ::Array{Float64, 1}) 327 | θ[:] .= clamp.(10*(θ - f.lb)./(f.ub - f.lb), 0.0, 10.0) 328 | end 329 | 330 | x0 = (f.ub + f.lb)/2 331 | x0 = transform(x0) 332 | obj(x0) 333 | result = minimize(obj, x0, 4; 334 | lower = zeros(5), 335 | upper = 10.0*ones(5), 336 | popsize = popsize, 337 | multi_threading = multithread, 338 | verbosity = 1, 339 | seed = rand(UInt), 340 | maxtime = maxtime) 341 | 342 | xopt = xbest(result) 343 | xopt = untransform(xopt) 344 | xopt = (SR = xopt[1], α = xopt[2], σ = exp(xopt[3]), σb = xopt[4], β = exp(xopt[5])) 345 | return xopt, fbest(result) 346 | end 347 | end 348 | using .RC 349 | using .Opt 350 | export rc, train_RC, test_RC, forecast_RC, TLM!, Global_LEs, opt, opt_lower_bounds, opt_upper_bounds 351 | 352 | end 353 | --------------------------------------------------------------------------------