API Reference
This section documents the Python API for rclib. The C++ core is wrapped efficiently to provide a seamless experience.
Reservoirs
rclib.reservoirs
Reservoir configurations.
RandomSparse
Random Sparse Reservoir configuration.
Source code in python/rclib/reservoirs.py
__init__(n_neurons, spectral_radius, sparsity=0.1, leak_rate=1.0, input_scaling=1.0, *, include_bias=False, seed=42, spectral_radius_method='power_iteration', bias_scaling=1.0)
Initialize the Random Sparse Reservoir.
Args:
n_neurons: Number of neurons in the reservoir.
spectral_radius: Spectral radius of the reservoir weight matrix.
sparsity: Sparsity of the reservoir weight matrix (0.0 to 1.0).
leak_rate: Leaking rate of the neurons.
input_scaling: Scaling factor for the input weights.
include_bias: Whether to include a bias term: one constant input per neuron, drawn
uniformly from [-1, 1] and multiplied by bias_scaling.
seed: Random seed for weights initialization.
spectral_radius_method: How the spectral radius of the random weight matrix is
found before it is scaled to spectral_radius. "power_iteration" (default)
estimates it by seeded power iteration, typically to within 0.3%. "dense"
computes it exactly from all eigenvalues of the matrix, which costs
O(n_neurons^3) time and O(n_neurons^2) memory, so it is meant for small
reservoirs.
bias_scaling: Scaling factor for the bias, set apart from input_scaling: the bias
lies in [-bias_scaling, bias_scaling]. The draws do not depend on it, so the same
seed gives the same recurrent and input weights at every bias_scaling, and 1
(default) gives the unscaled bias. Without include_bias it has no effect.
Source code in python/rclib/reservoirs.py
Nvar
NVAR Reservoir configuration.
Source code in python/rclib/reservoirs.py
__init__(num_lags, polynomial_order=1)
Initialize the NVAR Reservoir.
Args: num_lags: Number of time lags to include. polynomial_order: Maximum monomial degree to include. The default of 1 preserves a linear delay embedding.
Source code in python/rclib/reservoirs.py
RewardModulated
Reward-modulated reservoir configuration: random sparse recurrence that learns from rewards.
The neurons integrate a potential v and fire at the rate r = tanh(v)::
v = (1 - leak_rate) * v + leak_rate * (u @ W_in + bias + r_prev @ W_res) + noise
where the exploration noise of the rule enters only exploring steps (ESN.act), outside the
leak. ESN.reinforce then changes the existing recurrent synapses from the neurons in
plastic_presynaptic to those in plastic_postsynaptic. With leak_rate 1 and no noise
this is a RandomSparse reservoir with the same weights. A model without a readout returns
the rates from ESN.act, so designated neurons can serve as outputs.
Source code in python/rclib/reservoirs.py
__init__(n_neurons, spectral_radius, sparsity=0.1, leak_rate=1.0, input_scaling=1.0, *, rule, include_bias=False, seed=42, spectral_radius_method='power_iteration', bias_scaling=1.0, plastic_presynaptic=None, plastic_postsynaptic=None)
Initialize the reward-modulated reservoir.
Args:
n_neurons: Number of neurons in the reservoir.
spectral_radius: Spectral radius of the initial recurrent weights.
sparsity: Sparsity of the recurrent weights (0.0 to 1.0); the pattern stays fixed.
leak_rate: Leak rate of the potential, in (0, 1].
input_scaling: Scaling factor for the input weights.
rule: The learning rule, a learning.RewardModulatedHebbian.
include_bias: Whether to include a bias, as in RandomSparse.
seed: Random seed for the weights, as in RandomSparse.
spectral_radius_method: "power_iteration" or "dense", as in RandomSparse.
bias_scaling: Scaling factor for the bias, as in RandomSparse.
plastic_presynaptic: Neurons whose outgoing synapses learn; None means all.
plastic_postsynaptic: Neurons whose incoming synapses learn; None means all.
Source code in python/rclib/reservoirs.py
Readouts
rclib.readouts
Readout configurations.
Ridge
Ridge Regression Readout configuration.
Source code in python/rclib/readouts.py
__init__(alpha, *, include_bias, solver='auto', tolerance=1e-10)
Initialize the Ridge Readout.
Args: alpha: Regularization parameter. include_bias: Whether to include a bias term. solver: Solver to use ("auto", "cholesky", "dual_cholesky", "conjugate_gradient", "conjugate_gradient_implicit"). tolerance: Convergence tolerance for iterative solvers (CG).
Source code in python/rclib/readouts.py
Rls
Recursive Least Squares (RLS) Readout configuration.
Source code in python/rclib/readouts.py
__init__(lambda_, delta, *, include_bias, solver='rank1_update', forgetting_method='exponential')
Initialize the RLS Readout.
Args:
lambda_: Forgetting factor (0.0 to 1.0).
delta: Initial value for the covariance matrix diagonal.
include_bias: Whether to include a bias term.
solver: Solver type ("rank1_update" or "rank_k_update").
"rank1_update" is traditional sequential RLS.
"rank_k_update" is optimized for mini-batches using Woodbury identity.
forgetting_method: How each sample forgets the old information when
lambda_ < 1 ("exponential" or "directional"). "exponential"
discounts it in every direction, so directions that the inputs do
not excite wind up: the covariance grows there as lambda_**-n
until the weights are lost. "directional" discounts it only along
each sample's input, so those directions keep it. At lambda_ = 1
the two are the same.
Source code in python/rclib/readouts.py
Lms
Least Mean Squares (LMS) Readout configuration.
Source code in python/rclib/readouts.py
__init__(learning_rate, *, include_bias)
Initialize the LMS Readout.
Args: learning_rate: Learning rate for the LMS algorithm. include_bias: Whether to include a bias term.
Source code in python/rclib/readouts.py
RewardModulated
Reward-modulated readout configuration: a linear readout that learns from rewards.
The output is x @ W (plus a bias row) and, while exploring, the exploration noise of the
rule. ESN.act explores and records the eligibility, and ESN.reinforce changes W.
The weights start at zero at the first act; get_readout().setWeights can set them
first. ESN.fit and ESN.partial_fit do not apply to this readout.
Source code in python/rclib/readouts.py
__init__(n_outputs, rule, *, include_bias)
Initialize the reward-modulated readout.
Args:
n_outputs: Number of outputs.
rule: The learning rule, a learning.RewardModulatedHebbian.
include_bias: Whether to include a bias term, a constant input of 1 with a plastic weight.
Source code in python/rclib/readouts.py
Learning from Rewards
rclib.learning
Configurations of reward-modulated Hebbian learning.
A reward-modulated component (readouts.RewardModulated) adds exploration noise to the
potentials of its post-synaptic units, correlates pre-synaptic activity with a post-synaptic
signal into an eligibility, and changes its weights in proportion to the eligibility and a
modulator derived from the reward. In the row-vector convention of rclib, with the weights of
shape (n_pre, n_post)::
S(y) = sign(y) * |y| ** eligibility_power
e = trace_decay * e + S(pre).T @ S(post) (update="online", every exploring row)
E = E + S(pre).T @ S(post) (update="trial", cleared by each update)
dW = eta * m * e, eta * m * E, or eta * m * inv(C + decorrelation * I) @ E
m = R - R_avg ("difference") or 1 if R > R_avg else 0 ("heaviside")
where post is the injected noise, the potential minus its average before the row
("high_pass"), or the potential itself, C sums pre.T @ pre over the trial, and
R_avg is the reward baseline of the reward's key before that reward. The presets
:func:legenstein2010, :func:hoerzer2014, :func:miconi2017 and :func:burms2015 give the
settings of four published variants.
RewardModulatedHebbian
dataclass
A reward-modulated Hebbian rule.
Attributes:
| Name | Type | Description |
|---|---|---|
learning_rate |
float
|
Learning rate |
exploration |
Exploration
|
The exploration noise. |
post |
str
|
Post-synaptic signal: |
post_decay |
float
|
Decay in |
eligibility_power |
float
|
Exponent |
update |
str
|
|
trace_decay |
float
|
Decay in |
modulator |
str
|
|
baseline |
Baseline
|
The reward baseline. |
learning_rate_decay_steps |
(float, optional)
|
|
max_update |
(float, optional)
|
Clip of each weight change to |
decorrelation |
(float, optional)
|
Ridge term |
Source code in python/rclib/learning.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
__post_init__()
Validate the settings.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a setting is out of range or settings conflict. |
TypeError
|
If |
Source code in python/rclib/learning.py
Exploration
dataclass
Exploration noise added to the potentials of the post-synaptic units.
Attributes:
| Name | Type | Description |
|---|---|---|
distribution |
str
|
|
amplitude |
float
|
Scale of the noise. With 0 nothing is perturbed: a rule whose post-synaptic signal is the
noise then learns nothing, but |
probability |
float
|
Probability in |
seed |
int
|
Seed of the noise in |
Source code in python/rclib/learning.py
__post_init__()
Validate the settings.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a setting is out of range. |
Source code in python/rclib/learning.py
Baseline
dataclass
The reward baseline R_avg a reward is compared with, kept per integer key.
The first reward of a key with an "ema" or "window" baseline becomes its own baseline,
so its modulator is zero.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
str
|
|
decay |
float
|
Decay in |
window |
int
|
Number of rewards in |
Source code in python/rclib/learning.py
__post_init__()
Validate the settings.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a setting is out of range. |
Source code in python/rclib/learning.py
legenstein2010(learning_rate, **overrides)
The exploratory Hebbian (EH) rule of Legenstein et al. (2010).
Every unit's potential gets uniform noise in every row; the post-synaptic signal is the
potential minus its exponential average (post_decay 0.8), and the modulator is the reward
minus its exponential average (decay 0.8). The weights change at every rewarded row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rate
|
float
|
The learning rate. |
required |
**overrides
|
Any
|
Settings of :class: |
{}
|
Returns:
| Type | Description |
|---|---|
RewardModulatedHebbian
|
The rule. |
References
Legenstein, R., Chase, S. M., Schwartz, A. B., & Maass, W. (2010). A reward-modulated Hebbian learning rule can explain experimentally observed network reorganization in a brain control task. The Journal of Neuroscience, 30(25), 8400-8410.
Source code in python/rclib/learning.py
hoerzer2014(learning_rate, **overrides)
The EH rule with a binary modulator of Hoerzer et al. (2014).
Meant for a readout whose noisy output is fed back into a chaotic reservoir. The output gets
uniform noise in every row, the post-synaptic signal is its first difference (post_decay
0), and the weights change only when the reward beats its exponential average (decay 0.8):
the modulator is 1 or 0. Hoerzer et al. let the learning rate decay over training; set
learning_rate_decay_steps to do the same.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rate
|
float
|
The learning rate. |
required |
**overrides
|
Any
|
Settings of :class: |
{}
|
Returns:
| Type | Description |
|---|---|
RewardModulatedHebbian
|
The rule. |
References
Hoerzer, G. M., Legenstein, R., & Maass, W. (2014). Emergence of complex computational structures from chaotic neural networks through reward-modulated Hebbian learning. Cerebral Cortex, 24(3), 677-690.
Source code in python/rclib/learning.py
miconi2017(learning_rate, **overrides)
The rule of Miconi (2017) for recurrent weights learning from a delayed reward.
Each neuron's potential gets a sparse uniform kick (probability 0.003, amplitude 0.5 per row).
The eligibility sums the cube of the Hebbian product of the previous rate and the potential
minus its fast average over the trial; the cube keeps the large products of the kicks and
suppresses the small ones of the network's relaxation. One update per trial uses the reward
minus its exponential average for the trial's key (decay 0.33), clipped to 1e-4 per weight.
Use it with reservoirs.RewardModulated, whose potential-leak dynamics it assumes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rate
|
float
|
The learning rate. |
required |
**overrides
|
Any
|
Settings of :class: |
{}
|
Returns:
| Type | Description |
|---|---|
RewardModulatedHebbian
|
The rule. |
References
Miconi, T. (2017). Biologically plausible learning in recurrent neural networks reproduces neural dynamics observed during cognitive tasks. eLife, 6, e20899.
Source code in python/rclib/learning.py
burms2015(learning_rate, **overrides)
The decorrelated trial rule of Burms et al. (2015).
Every unit gets Gaussian noise (standard deviation 0.05) in every row, and the eligibility
correlates the pre-synaptic activity with this known noise over the trial. One update per trial
uses inv(C + I) @ E, which decorrelates correlated pre-synaptic activity such as redundant
sensors, and the reward minus the mean of the last 50 rewards of the trial's key. Pass
modulator="heaviside" for the variant that learns only from better-than-expected trials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rate
|
float
|
The learning rate. |
required |
**overrides
|
Any
|
Settings of :class: |
{}
|
Returns:
| Type | Description |
|---|---|
RewardModulatedHebbian
|
The rule. |
References
Burms, J., Caluwaerts, K., & Dambre, J. (2015). Reward-modulated Hebbian plasticity as leverage for partially embodied control in compliant robotics. Frontiers in Neurorobotics, 9, 9.
Source code in python/rclib/learning.py
Model
rclib.model
Model module for Reservoir Computing.
ESN
Echo State Network (ESN) model.
Source code in python/rclib/model.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | |
__getstate__()
Support pickle and copy.deepcopy.
Every instance attribute is kept, including ones added by users or subclasses; the C++ model is stored as bytes in the model file format. Unpickling can run arbitrary code, so only unpickle data you trust.
Source code in python/rclib/model.py
__init__(connection_type='serial')
Initialize the ESN model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection_type
|
str
|
The type of connection between reservoirs ("serial" or "parallel"). Default is "serial". |
'serial'
|
Source code in python/rclib/model.py
__setstate__(state)
Restore a model pickled by getstate.
Source code in python/rclib/model.py
act(x, *, explore=True)
Step the model through x row by row to learn from rewards.
With explore, the reward-modulated components add exploration noise and record each
row's eligibility for the next :meth:reinforce; without it every step is noise-free and
no learning state changes, which equals :meth:predict_online. A model without a readout
returns the reservoir states, whose designated neurons can serve as outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
Input rows, one per time step. |
required |
explore
|
bool
|
Whether to explore and record eligibility. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The output of each row: the readout's, or the reservoir states without a readout. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the inputs are not finite or do not fit the widths the model is locked to. |
RuntimeError
|
If a reservoir object is listed twice, or a row's output or eligibility is not finite. A failing row changes no learning state and keeps the rows before it. |
Source code in python/rclib/model.py
add_reservoir(reservoir)
Add a reservoir to the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reservoir
|
Any
|
The reservoir object to add. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the reservoir type is unsupported. |
ValueError
|
If a RandomSparse reservoir has an unsupported spectral_radius_method. |
Source code in python/rclib/model.py
clear_eligibility()
Zero the eligibility of the reward-modulated components, for example after an aborted trial.
fit(x, y, washout_len=0)
Fit the model to the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
Input data. |
required |
y
|
ArrayLike
|
Target data. |
required |
washout_len
|
int
|
Number of initial samples to discard. Default is 0. |
0
|
Source code in python/rclib/model.py
fit_sequences(inputs, targets, washout_len=0)
Fit the readout once on several independent sequences, such as episodes.
Each sequence starts from reset reservoirs and discards its own first
washout_len samples. The remaining reservoir states and targets of all
sequences are stacked and the readout is fitted once, so nothing carries over
from one sequence to the next. With a single sequence this equals :meth:fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Sequence[ArrayLike]
|
Input data, one 2-D array of shape (n_samples_i, n_inputs) per sequence, for example a list of arrays. Sequences may differ in length but not in width. |
required |
targets
|
Sequence[ArrayLike]
|
Target data, one 2-D array of shape (n_samples_i, n_outputs) per sequence, with as many rows as the matching input sequence. |
required |
washout_len
|
int
|
Number of initial samples to discard from each sequence. Default is 0. |
0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a single 2-D array is passed instead of a sequence of arrays, if there are no sequences or unequal numbers of input and target sequences, or if a sequence is empty, its inputs and targets differ in length, its width differs from the first sequence's, or its input width differs from the one the reservoirs are locked to by earlier input. Messages name the sequence index. |
IndexError
|
If |
RuntimeError
|
If the model has no reservoir or no readout. |
Notes
These checks run before the model changes. Afterwards the reservoirs hold their states at the end of the last sequence.
Source code in python/rclib/model.py
get_readout()
Get the readout object, such as a fitted ridge readout to read its weights from.
Returns:
| Type | Description |
|---|---|
Any
|
The C++ readout object. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no readout is set. |
Source code in python/rclib/model.py
get_reservoir(index)
Get the reservoir object at the specified index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The index of the reservoir. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The C++ reservoir object. |
Source code in python/rclib/model.py
load(path)
classmethod
Load a model saved by :meth:save or by C++ Model::save.
Only load files from sources you trust: the format contains no executable code, but it is parsed by native code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or PathLike
|
Model file to read. |
required |
Returns:
| Type | Description |
|---|---|
ESN
|
The restored model, including its reservoir states. |
Raises:
| Type | Description |
|---|---|
SerializationError
|
If the file cannot be read or is not a valid model file. |
Source code in python/rclib/model.py
modulate(modulator)
Update the reward-modulated components with the modulator given directly.
This applies dW = eta * modulator * eligibility without a baseline, so any critic,
such as a temporal-difference error, can drive learning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modulator
|
float
|
The modulator |
required |
Source code in python/rclib/model.py
partial_fit(x, y)
Update the model with a single sample (online learning).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
Input data sample. If None, the reservoir state is not advanced (useful if predict_online was already called). |
required |
y
|
ArrayLike
|
Target data sample. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no reservoir or readout is set. |
Source code in python/rclib/model.py
predict(x, *, reset_state_before_predict=True)
Predict using the trained model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
Input data. |
required |
reset_state_before_predict
|
bool
|
Whether to reset the reservoir state before prediction. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The predicted values. |
Source code in python/rclib/model.py
predict_generative(prime_data, n_steps)
Generative prediction.
Advances the reservoirs through prime_data (if any), then generates
n_steps outputs, feeding each output back as the next input. Every
generated output, including the last, advances the reservoirs, so a following
call with empty prime_data continues the sequence: generating a steps
and then b steps equals generating a + b steps. With n_steps == 0
no output is fed back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prime_data
|
ArrayLike
|
Initial data to prime the reservoir. |
required |
n_steps
|
int
|
Number of steps to generate. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The generated data. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a generated output cannot be fed back because its width differs from
the input width the reservoirs are locked to (also for |
Source code in python/rclib/model.py
predict_online(x)
Predict in online mode (updating state).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
Input data. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The predicted values. |
Source code in python/rclib/model.py
reinforce(reward, *, key=0, baseline=None)
Update the reward-modulated components for a reward.
Each component compares the reward with its baseline for key (see
learning.Baseline), or with baseline when given, and changes its weights in
proportion to the eligibility recorded by :meth:act. The update applies to every
component or to none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reward
|
float
|
The reward. |
required |
key
|
int
|
The baseline to use and update, such as a trial type. Default is 0. |
0
|
baseline
|
float
|
A baseline to use instead of the internal one, which is then left unchanged. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the reward or baseline is not finite. |
RuntimeError
|
If the model has no reward-modulated component, a component has not explored since its last update, or the update would not be finite. |
Source code in python/rclib/model.py
reset_reservoirs()
save(path)
Save the model to a file.
The file holds the configuration, the trained weights and the current
reservoir states, so a loaded model continues exactly where this one
stopped. It can also be loaded from C++ with Model::load. An existing
file at path is replaced in one step and is left unchanged if saving
fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or PathLike
|
Destination file. |
required |
Raises:
| Type | Description |
|---|---|
SerializationError
|
If the model lacks a reservoir or readout, is internally inconsistent, or the file cannot be written. |
Source code in python/rclib/model.py
set_readout(readout)
Set the readout for the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
readout
|
Any
|
The readout object to set. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the readout type is unsupported. |