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> rand_hyper(5, 5)
5×5 Matrix{Float32}:
 0.0        0.286061   0.124822   0.0227793   0.714702
 0.286061   0.0        0.583359   0.0170896   0.192062
 0.124822   0.583359   0.0        0.0156618   0.0656493
 0.0227793  0.0170896  0.0156618  0.0         0.00776529
 0.714702   0.192062   0.0656493  0.00776529  0.0

With row-wise sparsification (keep top 2 entries per row):

julia> rand_hyper(5, 5; top_k=2)
5×5 Matrix{Float32}:
 0.0        0.321022   0.0       0.0  0.802048
 0.321022   0.0        0.654653  0.0  0.0
 0.140077   0.654653   0.0       0.0  0.0
 0.0255632  0.0191781  0.0       0.0  0.0
 0.802048   0.215535   0.0       0.0  0.0

 Returning a sparse matrix:

 julia> using SparseArrays

julia> rand_hyper(5, 5; top_k=2, return_sparse=true)
5×5 SparseMatrixCSC{Float32, Int64} with 10 stored entries:
  ⋅         0.321022    ⋅         ⋅   0.802048
 0.321022    ⋅         0.654653   ⋅    ⋅ 
 0.140077   0.654653    ⋅         ⋅    ⋅ 
 0.0255632  0.0191781   ⋅         ⋅    ⋅ 
 0.802048   0.215535    ⋅         ⋅    ⋅ 
source

References