Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinuzziFrancesco committed Feb 27, 2024
1 parent fbb0ceb commit 2165795
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/ReservoirComputing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ for initializer in (:rand_sparse, :delay_line, :delay_line_backward, :cycle_jump
::Type{T}; kwargs...) where {T <: $NType}
return WeightInitializers.__partial_apply($initializer, ((rng, T), (; kwargs...)))
end
@eval ($initializer)(; kwargs...) = WeightInitializers.__partial_apply($initializer, (; kwargs...))
@eval ($initializer)(; kwargs...) = WeightInitializers.__partial_apply(
$initializer, (; kwargs...))
end

#general
Expand Down
5 changes: 2 additions & 3 deletions src/esn/esn_reservoirs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ function rand_sparse(rng::AbstractRNG,
radius = T(1.0),
sparsity = T(0.1),
std = T(1.0)) where {T <: Number}

lcl_sparsity = T(1)-sparsity #consistency with current implementations
reservoir_matrix = sparse_init(rng, T, dims...; sparsity=lcl_sparsity, std=std)
lcl_sparsity = T(1) - sparsity #consistency with current implementations
reservoir_matrix = sparse_init(rng, T, dims...; sparsity = lcl_sparsity, std = std)
rho_w = maximum(abs.(eigvals(reservoir_matrix)))
reservoir_matrix .*= radius / rho_w
if Inf in unique(reservoir_matrix) || -Inf in unique(reservoir_matrix)
Expand Down

0 comments on commit 2165795

Please sign in to comment.