Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 0 additions & 3 deletions ext/RCCellularAutomataExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ end

function encoding(rm::RandomMaps, input_vector, tot_encoded_vector)
input_size = size(input_vector, 1)
#single_encoded_size = Int(size(tot_encoded_vector, 1)/permutations)
new_tot_enc_vec = copy(tot_encoded_vector)

for i in 1:(rm.permutations)
Expand Down Expand Up @@ -52,7 +51,6 @@ end

function init_maps(input_size, permutations, mapped_vector_size)
maps = Array{Int}(undef, permutations, input_size)
#tot_size = input_size*permutations

for i in 1:permutations
maps[i, :] = mapping(input_size, mapped_vector_size)
Expand All @@ -62,7 +60,6 @@ function init_maps(input_size, permutations, mapped_vector_size)
end

function mapping(input_size, mapped_vector_size)
#sample(1:mapped_vector_size, input_size; replace=false)
return randperm(mapped_vector_size)[1:input_size]
end

Expand Down
2 changes: 1 addition & 1 deletion src/ReservoirComputing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using LinearAlgebra: eigvals, eigen, I, Diagonal, diag, mul!, Symmetric, norm,
using LinearSolve: LinearProblem, solve, QRFactorization
using LuxCore: AbstractLuxLayer, AbstractLuxContainerLayer, AbstractLuxWrapperLayer,
setup, apply, replicate
import LuxCore: initialparameters, initialstates, statelength, outputsize
import LuxCore: initialparameters, initialstates, parameterlength, statelength, outputsize
using NNlib: tanh_fast
using Random: Random, AbstractRNG, randperm
using SciMLBase: AbstractLinearAlgorithm, AbstractSciMLAlgorithm, successful_retcode
Expand Down
2 changes: 2 additions & 0 deletions src/extensions/reca.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,7 @@ A linear [`LinearReadout`](@ref) maps these features to `out_dims`.
Default is none.
- `readout_activation`: Activation applied by the readout
Default is `identity`.
- `readout_in_dims`: Readout input width for a custom dimension-changing
modifier. `nothing` infers the width for `Extend`. Default: `nothing`.
"""
RECA(::Any...) = error("RECA requires CellularAutomata.jl; use it to enable this constructor.")
1 change: 0 additions & 1 deletion src/generics.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const BoolType = Union{StaticBool, Bool, Val{true}, Val{false}}
const InputType = Tuple{<:AbstractArray, Tuple{<:AbstractArray}}
const IntegerType = Union{Integer, StaticInt}
const RCFields = (:cells, :state_modifiers, :readout)

__quote_keys(t) = Expr(:tuple, (QuoteNode(s) for s in t)...)

Expand Down
27 changes: 10 additions & 17 deletions src/inits/inits_components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ Adds a delay line in the `reservoir_matrix`, with given `shift` and

# Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `reservoir_matrix`: matrix to be changed.
- `weight`: weight to add as a delay line. Can be either a single number
or an array.
Expand Down Expand Up @@ -453,8 +452,7 @@ Adds a backward connection in the `reservoir_matrix`, with given `shift` and

# Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `reservoir_matrix`: matrix to be changed.
- `weight`: weight to add as a backward connection. Can be either a single number
or an array.
Expand Down Expand Up @@ -525,8 +523,7 @@ Adds a simple cycle in the `reservoir_matrix`, with given

# Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `reservoir_matrix`: matrix to be changed.
- `weight`: weight to add as a simple cycle. Can be either a single number
or an array.
Expand Down Expand Up @@ -587,8 +584,7 @@ Adds a reverse simple cycle in the `reservoir_matrix`, with given

# Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `reservoir_matrix`: matrix to be changed.
- `weight`: weight to add as a simple cycle. Can be either a single number
or an array.
Expand Down Expand Up @@ -650,8 +646,7 @@ Adds jumps to a given `reservoir_matrix` with chosen `weight` and determined `ju

# Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `reservoir_matrix`: matrix to be changed.
- `weight`: weight to add as a simple cycle. Can be either a single number
or an array.
Expand Down Expand Up @@ -755,13 +750,13 @@ end
"""
self_loop!([rng], reservoir_matrix, weight; signs = nothing)

Adds jumps to a given `reservoir_matrix` with chosen `weight` and determined `jump_size`.
`weight` can be either a number or an array.
Sets the diagonal of `reservoir_matrix` to `weight`, adding a self loop to each node.
`weight` can be a number, a vector of length `size(reservoir_matrix, 1)`, or a function
`weight(rng, n)` returning such a vector.

# Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `reservoir_matrix`: matrix to be changed.
- `weight`: weight to add as a self loop. Can be either a single number
or an array.
Expand Down Expand Up @@ -833,9 +828,7 @@ to a permutation matrix.
## Arguments

- `rng`: Random number generator used when `permutation_matrix === nothing`.
Default is typically `Utils.default_rng()` from
[WeightInitializers](https://lux.csail.mit.edu/stable/api/Building_Blocks/WeightInitializers)
(if you provide a wrapper method without `rng`).
Default is `Xoshiro(1234)` when using the wrapper method without `rng`.
- `reservoir_matrix`: The reservoir weight matrix to be permuted.
- `permutation_matrix`: A square permutation matrix of matching size. If `nothing`,
a random permutation is used.
Expand Down
24 changes: 8 additions & 16 deletions src/inits/inits_input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ a range defined by `scaling`.

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -100,8 +99,7 @@ additional reservoir node. An `ArgumentError` is thrown if `res_size < in_size`.

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -226,8 +224,7 @@ inspired by [Lu2017](@cite). Blocks are distributed as in

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -306,8 +303,7 @@ networks [Pathak2018](@cite).

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -387,8 +383,7 @@ An optional sign pattern controls which weights have their signs flipped.

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -477,8 +472,7 @@ applying:

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -556,8 +550,7 @@ the logistic map recurrence:
```

## Arguments
- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down Expand Up @@ -637,8 +630,7 @@ If the provided number of rows does not match `factor * in_size`
the number of rows is overridden.

## Arguments
- `rng`: Random number generator. Default is `Utils.default_rng()`
from WeightInitializers.
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Type of the elements in the reservoir matrix.
Default is `Float32`.
- `dims`: Dimensions of the matrix. Should follow `res_size x in_size`.
Expand Down
3 changes: 1 addition & 2 deletions src/inits/inits_lsm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ can be scaled to `radius`.

## Arguments

- `rng`: Random number generator. Default is `Utils.default_rng()` from
[WeightInitializers](https://lux.csail.mit.edu/stable/api/Building_Blocks/WeightInitializers).
- `rng`: Random number generator. Default is `Xoshiro(1234)`.
- `T`: Element type. Default is `Float32`.
- `dims`: Square matrix dimensions.

Expand Down
Loading
Loading