Skip to content

Commit 8e07b99

Browse files
docs: move reca tutorials over to ReservoirCellularAutomata
1 parent 8ac9971 commit 8e07b99

File tree

7 files changed

+83
-69
lines changed

7 files changed

+83
-69
lines changed

docs/pages.jl

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
pages = [
22
"ReservoirComputing.jl" => "index.md",
33
"General Settings" => Any[
4-
"Changing Training Algorithms" => "general/different_training.md",
5-
"Altering States" => "general/states_variation.md",
6-
"Generative vs Predictive" => "general/predictive_generative.md"],
4+
"Changing Training Algorithms"=>"general/different_training.md",
5+
"Altering States"=>"general/states_variation.md",
6+
"Generative vs Predictive"=>"general/predictive_generative.md"],
77
"Echo State Network Tutorials" => Any[
8-
"Lorenz System Forecasting" => "esn_tutorials/lorenz_basic.md",
8+
"Lorenz System Forecasting"=>"esn_tutorials/lorenz_basic.md",
99
#"Mackey-Glass Forecasting on GPU" => "esn_tutorials/mackeyglass_basic.md",
10-
"Using Different Layers" => "esn_tutorials/change_layers.md",
11-
"Using Different Reservoir Drivers" => "esn_tutorials/different_drivers.md",
10+
"Using Different Layers"=>"esn_tutorials/change_layers.md",
11+
"Using Different Reservoir Drivers"=>"esn_tutorials/different_drivers.md",
1212
#"Using Different Training Methods" => "esn_tutorials/different_training.md",
13-
"Deep Echo State Networks" => "esn_tutorials/deep_esn.md",
14-
"Hybrid Echo State Networks" => "esn_tutorials/hybrid.md"],
15-
"Reservoir Computing with Cellular Automata" => "reca_tutorials/reca.md",
16-
"API Documentation" => Any["Training Algorithms" => "api/training.md",
17-
"States Modifications" => "api/states.md",
18-
"Prediction Types" => "api/predict.md",
19-
"Echo State Networks" => "api/esn.md",
20-
"ESN Initializers" => "api/inits.md",
21-
"ESN Drivers" => "api/esn_drivers.md",
22-
"ESN Variations" => "api/esn_variations.md"]
13+
"Deep Echo State Networks"=>"esn_tutorials/deep_esn.md",
14+
"Hybrid Echo State Networks"=>"esn_tutorials/hybrid.md"],
15+
"API Documentation" => Any["Training Algorithms"=>"api/training.md",
16+
"States Modifications"=>"api/states.md",
17+
"Prediction Types"=>"api/predict.md",
18+
"Echo State Networks"=>"api/esn.md",
19+
"ESN Initializers"=>"api/inits.md",
20+
"ESN Drivers"=>"api/esn_drivers.md",
21+
"ESN Variations"=>"api/esn_variations.md"]
2322
]

docs/src/reca_tutorials/reca.md

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pages = [
22
"ReservoirCellularAutomata.jl" => "index.md",
3+
"Solving the 5 bit memory task" => "reca_tutorials/fbmt.md",
34
"API Manual" => "api/reca.md"
45
]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Reservoir Computing using Cellular Automata
2+
3+
Reservoir Computing based on Cellular Automata ReCA
4+
[Yilmaz2014](@cite) [Margem2017](@cite) proposes the advantage of storing the reservoir
5+
states as binary data. Less parameter tuning represents another advantage of this model.
6+
The architecture implemented in ReservoirCellularAutomata.jl follows [Nichele2017](@cite)
7+
which builds on top of the original implementation, improving the results.
8+
It is strongly suggested to go through the paper to get a solid understanding of the model
9+
before delving into experimentation with the code.
10+
11+
To showcase how to use these models, this page illustrates the performance of
12+
ReCA in the 5 bit memory task.
13+
14+
## 5 bit memory task
15+
16+
The data can be read as follows:
17+
18+
```@example reca
19+
using DelimitedFiles
20+
21+
input = readdlm("./5bitinput.txt", ',', Float64)
22+
output = readdlm("./5bitoutput.txt", ',', Float64)
23+
```
24+
25+
To use a ReCA model, it is necessary to define the rule one intends to use. To do so,
26+
ReservoirCellularAutomata.jl leverages
27+
[CellularAutomata.jl](https://github.com/MartinuzziFrancesco/CellularAutomata.jl).
28+
All the functionalities of CellularAutomata.jl are reexported in ReservoirCellularAutomata.
29+
30+
```@example reca
31+
using ReservoirCellularAutomata
32+
33+
ca = DCA(90)
34+
```
35+
36+
To define the ReCA model, it suffices to call:
37+
38+
```@example reca
39+
reca = RECA(input, ca;
40+
generations=16,
41+
input_encoding=RandomMapping(16, 40))
42+
```
43+
44+
After this, the training can be performed with the chosen method.
45+
46+
```@example reca
47+
output_layer = train(reca, output, StandardRidge(0.00001))
48+
```
49+
50+
The prediction in this case will be a `Predictive()` with the input data
51+
equal to the training data. In addition, to test the 5 bit memory task,
52+
a conversion from Float to Bool is necessary
53+
(at the moment, we are aware of a bug that doesn't allow boolean
54+
input data to the RECA models):
55+
56+
```@example reca
57+
prediction = reca(Predictive(input), output_layer)
58+
final_pred = convert(AbstractArray{Float32}, prediction .> 0.5)
59+
60+
final_pred == output
61+
```

lib/ReservoirCellularAutomata/src/ReservoirCellularAutomata.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ using CellularAutomata: CellularAutomaton
44
using Random: randperm
55
using Reexport: @reexport
66
using ReservoirComputing
7+
@reexport using CellularAutomata
78
@reexport import ReservoirComputing: NLADefault, NLAT1, NLAT2, NLAT3, PartialSquare,
8-
ExtendedSquare,
9-
StandardStates, ExtendedStates, PaddedStates,
10-
PaddedExtendedStates, StandardRidge, Generative,
11-
Predictive, OutputLayer
9+
ExtendedSquare,
10+
StandardStates, ExtendedStates, PaddedStates,
11+
PaddedExtendedStates, StandardRidge, Generative,
12+
Predictive, OutputLayer
1213
import ReservoirComputing: train, AbstractReservoirComputer, AbstractOutputLayer,
13-
obtain_prediction, next_state_prediction!
14+
obtain_prediction, next_state_prediction!
1415

1516
include("reca.jl")
1617
include("reca_input_encodings.jl")

0 commit comments

Comments
 (0)