rand_hyper

ReservoirComputing.rand_hyperFunction
rand_hyper([rng], [T], dims...;
    poincare_dim=2, disk_radius=0.99, top_k=0, sigma=1.0, radius=1.0, return_sparse=false)

Create a hyperbolic embedding reservoir matrix using the HYPER construction as described in (Singh et al., 2025).

This initializer samples reservoir nodes in a Poincaré ball of dimension poincare_dim, computes geometry-aware kernel weights, optionally sparsifies the rows to keep the top top_k connections, and scales the spectral radius to radius.

Arguments

  • rng: Random number generator. Default is Utils.default_rng()from WeightInitializers.
  • T: Type of the elements in the reservoir matrix. Default is Float32.
  • dims: Dimensions of the reservoir matrix.

Keyword arguments

  • poincare_dim: Dimension of the Poincaré ball. Default is 2
  • disk_radius: Maximum Euclidean radius of nodes in the Poincaré ball. Default is 0.99
  • top_k: Number of largest entries to keep per row (integer). Default is 0
  • sigma: Kernel width controlling decay of weights based on hyperbolic distance. Default is 1.0
  • radius: Target spectral radius after scaling. Default is 1.0
  • return_sparse: flag for returning a sparse matrix. true requires SparseArrays to be loaded. Default is false

Examples

Default call:

julia> rng = MersenneTwister(123);

julia> dense_matrix = rand_hyper(rng, 5, 5; top_k=2);

julia> sparse_matrix = rand_hyper(MersenneTwister(123), 5, 5;
           top_k=2, return_sparse=true);

julia> size(dense_matrix) == size(sparse_matrix) == (5, 5) &&
       all(count(!iszero, dense_matrix[i, :]) <= 2 for i in axes(dense_matrix, 1)) &&
       sparse_matrix isa SparseMatrixCSC{Float32}
true
source

References