Skip to content

Commit 38217ed

Browse files
style: comply with sciml style
style: comply with sciml style
2 parents 10befc8 + 95683a1 commit 38217ed

21 files changed

+208
-213
lines changed

.JuliaFormatter.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
style = "sciml"
22
format_markdown = false
3-
whitespace_in_kwargs = false
4-
margin = 92
5-
indent = 4
6-
format_docstrings = true
7-
separate_kwargs_with_semicolon = true
8-
always_for_in = true
9-
annotate_untyped_fields_with_any = false
3+
format_docstrings = true

docs/make.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
using Documenter, ReservoirComputing
22

3-
cp("./docs/Manifest.toml", "./docs/src/assets/Manifest.toml"; force=true)
4-
cp("./docs/Project.toml", "./docs/src/assets/Project.toml"; force=true)
3+
cp("./docs/Manifest.toml", "./docs/src/assets/Manifest.toml"; force = true)
4+
cp("./docs/Project.toml", "./docs/src/assets/Project.toml"; force = true)
55

66
ENV["PLOTS_TEST"] = "true"
77
ENV["GKSwstype"] = "100"
88
include("pages.jl")
99
mathengine = Documenter.MathJax()
1010

11-
makedocs(; modules=[ReservoirComputing],
12-
sitename="ReservoirComputing.jl",
13-
clean=true, doctest=false, linkcheck=true,
14-
format=Documenter.HTML(;
11+
makedocs(; modules = [ReservoirComputing],
12+
sitename = "ReservoirComputing.jl",
13+
clean = true, doctest = false, linkcheck = true,
14+
format = Documenter.HTML(;
1515
mathengine,
16-
assets=["assets/favicon.ico"],
17-
canonical="https://docs.sciml.ai/ReservoirComputing/stable/"),
18-
pages=pages
16+
assets = ["assets/favicon.ico"],
17+
canonical = "https://docs.sciml.ai/ReservoirComputing/stable/"),
18+
pages = pages
1919
)
2020

21-
deploydocs(; repo="github.com/SciML/ReservoirComputing.jl.git",
22-
push_preview=true)
21+
deploydocs(; repo = "github.com/SciML/ReservoirComputing.jl.git",
22+
push_preview = true)

src/esn/deepesn.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ enhanced by the depth provided by multiple reservoir layers.
5959
train_data = rand(Float32, 3, 100)
6060
6161
# Create a DeepESN with specific parameters
62-
deepESN = DeepESN(train_data, 3, 100; depth=3, washout=100)
62+
deepESN = DeepESN(train_data, 3, 100; depth = 3, washout = 100)
6363
```
6464
"""
65-
function DeepESN(train_data::AbstractArray, in_size::Int, res_size::Int; depth::Int=2,
66-
input_layer=fill(scaled_rand, depth), bias=fill(zeros32, depth),
67-
reservoir=fill(rand_sparse, depth), reservoir_driver::AbstractDriver=RNN(),
68-
nla_type::NonLinearAlgorithm=NLADefault(),
69-
states_type::AbstractStates=StandardStates(), washout::Int=0,
70-
rng::AbstractRNG=Utils.default_rng(), matrix_type=typeof(train_data))
65+
function DeepESN(train_data::AbstractArray, in_size::Int, res_size::Int; depth::Int = 2,
66+
input_layer = fill(scaled_rand, depth), bias = fill(zeros32, depth),
67+
reservoir = fill(rand_sparse, depth), reservoir_driver::AbstractDriver = RNN(),
68+
nla_type::NonLinearAlgorithm = NLADefault(),
69+
states_type::AbstractStates = StandardStates(), washout::Int = 0,
70+
rng::AbstractRNG = Utils.default_rng(), matrix_type = typeof(train_data))
7171
if states_type isa AbstractPaddedStates
7272
in_size = size(train_data, 1) + 1
7373
train_data = vcat(adapt(matrix_type, ones(1, size(train_data, 2))),

src/esn/esn.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ julia> train_data = rand(Float32, 10, 100) # 10 features, 100 time steps
5050
0.4463 0.334423 0.444679 0.311695 0.0494497 0.27171 0.214925
5151
0.987182 0.898593 0.295241 0.233098 0.789699 0.453692 0.759205
5252
53-
julia> esn = ESN(train_data, 10, 300; washout=10)
53+
julia> esn = ESN(train_data, 10, 300; washout = 10)
5454
ESN(10 => 300)
5555
```
5656
"""
5757
function ESN(train_data::AbstractArray, in_size::Int, res_size::Int;
58-
input_layer=scaled_rand, reservoir=rand_sparse, bias=zeros32,
59-
reservoir_driver::AbstractDriver=RNN(),
60-
nla_type::NonLinearAlgorithm=NLADefault(),
61-
states_type::AbstractStates=StandardStates(),
62-
washout::Int=0, rng::AbstractRNG=Utils.default_rng(),
63-
matrix_type=typeof(train_data))
58+
input_layer = scaled_rand, reservoir = rand_sparse, bias = zeros32,
59+
reservoir_driver::AbstractDriver = RNN(),
60+
nla_type::NonLinearAlgorithm = NLADefault(),
61+
states_type::AbstractStates = StandardStates(),
62+
washout::Int = 0, rng::AbstractRNG = Utils.default_rng(),
63+
matrix_type = typeof(train_data))
6464
if states_type isa AbstractPaddedStates
6565
in_size = size(train_data, 1) + 1
6666
train_data = vcat(adapt(matrix_type, ones(1, size(train_data, 2))),
@@ -82,7 +82,7 @@ function ESN(train_data::AbstractArray, in_size::Int, res_size::Int;
8282
end
8383

8484
function (esn::AbstractEchoStateNetwork)(prediction::AbstractPrediction,
85-
output_layer::AbstractOutputLayer; last_state=esn.states[:, [end]],
85+
output_layer::AbstractOutputLayer; last_state = esn.states[:, [end]],
8686
kwargs...)
8787
return obtain_esn_prediction(esn, prediction, last_state, output_layer;
8888
kwargs...)
@@ -120,15 +120,15 @@ julia> train_data = rand(Float32, 10, 100) # 10 features, 100 time steps
120120
0.133498 0.451058 0.0761995 0.90421 0.994212 0.332164 0.545112
121121
0.214467 0.791524 0.124105 0.951805 0.947166 0.954244 0.889733
122122
123-
julia> esn = ESN(train_data, 10, 300; washout=10)
123+
julia> esn = ESN(train_data, 10, 300; washout = 10)
124124
ESN(10 => 300)
125125
126126
julia> output_layer = train(esn, rand(Float32, 3, 90))
127127
OutputLayer successfully trained with output size: 3
128128
```
129129
"""
130130
function train(esn::AbstractEchoStateNetwork, target_data::AbstractArray,
131-
training_method=StandardRidge(); kwargs...)
131+
training_method = StandardRidge(); kwargs...)
132132
states_new = esn.states_type(esn.nla_type, esn.states, esn.train_data[:, 1:end])
133133
return train(training_method, states_new, target_data; kwargs...)
134134
end

0 commit comments

Comments
 (0)