Skip to content

Commit 921ea90

Browse files
committed
Update rc.py docstrings, but also needs type hints and fixes to confusing method names. Wait for its own PR
1 parent a4132d6 commit 921ea90

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

dabench/model/_rc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def weights_init(self):
170170

171171
def generate(self, state_vec, A=None, Win=None, r0=None):
172172
"""generate reservoir time series from input signal u
173+
173174
Args:
174175
u (array_like): (time_dimension, system_dimension), input signal to
175176
reservoir
@@ -287,16 +288,19 @@ def predict(self, state_vec, delta_t, initial_index=0, n_steps=100,
287288

288289
def readout(self, rt, Wout=None, utm1=None):
289290
"""use Wout to map reservoir state to output
291+
290292
Args:
291293
rt (array_like): 1D or 2D with dims: (Nr,) or (Ntime, Nr)
292294
reservoir state, either passed as single time snapshot,
293295
or as matrix, with reservoir dimension as last index
294296
utm1 (array_like): 1D or 2D with dims: (Nu,) or (Ntime, Nu)
295297
u(t-1) for r(t), only used if readout_method = 'biased',
296298
then Wout*[1, u(t-1), r(t)]=u(t)
299+
297300
Returns:
298301
vt (array_like): 1D or 2D with dims: (Nout,) or (Ntime, Nout)
299302
depending on shape of input array
303+
300304
Todo:
301305
generalize similar to DiffRC
302306
"""
@@ -346,6 +350,7 @@ def _predict_backend(self, n_samples, s_last, u_last, delta_t,
346350
Default is None.
347351
Wout (array_like, optional): Rutput weight matrix. If None,
348352
uses self.Wout. Default is None.
353+
349354
Returns:
350355
y (Data): data object with predicted signal from reservoir
351356
"""
@@ -451,8 +456,8 @@ def _compute_Wout(self, rt, y, update_Wout=True, u=None):
451456
return self.Wout
452457

453458
def _linsolve(self, X, Y, beta=None, **kwargs):
454-
'''Linear solver wrapper
455-
Solve for A in Y = AX
459+
'''Linear solver wrapper for A in Y = AX
460+
456461
Args:
457462
X (matrix) : independent variable
458463
Y (matrix) : dependent variable
@@ -464,9 +469,11 @@ def _linsolve(self, X, Y, beta=None, **kwargs):
464469

465470
def _linsolve_pinv(self, X, Y, beta=None):
466471
"""Solve for A in Y = AX, assuming X and Y are known.
472+
467473
Args:
468474
X : independent variable, square matrix
469475
Y : dependent variable, square matrix
476+
470477
Returns:
471478
A : Solution matrix, rectangular matrix
472479
"""

0 commit comments

Comments
 (0)