reservoirpy.mat_gen.cluster#

reservoirpy.mat_gen.cluster = <reservoirpy.mat_gen.Initializer (_cluster) object>[source]#

Create a cluster matrix with given distribution and p_in/p_out parameters. Based on the Erdős-Rényi clustered matrix algorithm.

Parameters:
  • *shape ((int, int), optional) – Shape (row, columns) of the array. Must be a square matrix, i.e. row == columns.

  • cluster (int, optional) – Number of clusters to create within the matrix. Default is 3.

  • p_in (float, optional) – Defines the connectivity within a cluster. Default is 0.1.

  • p_out (float, optional) – Defines the connectivity between clusters. Default is 0.01.

  • sparsity_type ({"csr", "csc", "dense"}, default to "csr") – Format of the output matrix. “csr” and “csc” corresponds to the Scipy sparse matrix formats, and “dense” corresponds to a regular Numpy array.

  • distribution ({"normal", "uniform", "random", "bernoulli"}, default to "normal") – A distribution name from scipy.stats module, such as “norm” or “uniform”. Parameters like loc and scale can be passed to the distribution functions as keyword arguments to this function. Usual distributions for internal weights are scipy.stats.norm with parameters loc and scale to obtain weights following the standard normal distribution, or scipy.stats.uniform with parameters loc=-1 and scale=2 to obtain weights uniformly distributed between -1 and 1. Can also have the value “custom_bernoulli”. In that case, weights will be drawn from a Bernoulli discrete random variable alternating between -1 and 1 and drawing 1 with a probability p (default p parameter to 0.5).

  • dtype (numpy.dtype, default to numpy.float64) – A Numpy numerical type.

  • seed (optional) – Random generator seed. Default to the global value set with reservoirpy.set_seed().

  • **kwargs (optional) – This argument is kept for compatibility reasons. This is not used.

Return type:

numpy array or callable