1.5. RectiPy.rectipy.observer
Module that contains rectipy.observer.Observer, the class that is used in RectiPy to store states of the rectipy.Network.rnn_layer.
- class rectipy.observer.Observer(dt: float, record_output: bool = True, record_loss: bool = True, record_vars: list | None = None)[source]
Bases:
object
Class that is used to record state variables, outputs, and losses during calls of Network.train, Network.test, or Network.run.
- matshow(v: str | Tuple[str, str], ax: Axes | None = None, **kwargs) Axes [source]
Create a 2D color plot of variable v.
- Parameters:
v – Tuple that contains the names of the node and the node variable to be plotted.
ax – matplotlib.pyplot.Axes instance in which to plot.
kwargs – Additional keyword arguments for the matplotlib.pyplot.imshow call.
- Returns:
Instance of matplotlib.pyplot.Axes that contains the line plot.
- Return type:
plt.Axes
- plot(y: str | Tuple[str, str], x: str | Tuple[str, str] | None = None, ax: Axes | None = None, **kwargs) Axes [source]
Create a line plot with variable y on the y-axis and x on the x-axis.
- Parameters:
y – Tuple that contains the names of the node and the node variable to be plotted on the y-axis.
x – Tuple that contains the names of the node and the node variable to be plotted on the x-axis. If not provided, y will be plotted against time steps.
ax – matplotlib.pyplot.Axes instance in which to plot.
kwargs – Additional keyword arguments for the matplotlib.pyplot.plot call.
- Returns:
Instance of matplotlib.pyplot.Axes that contains the line plot.
- Return type:
plt.Axes
- record(step: int, output: Tensor, loss: float | Tensor, record_vars: Iterable[Tensor]) None [source]
Performs a single recording steps.
- Parameters:
step – Integration step.
output – Output of the Network model.
loss – Current loss of the Network model.
record_vars – Additional variables of the RNN layer that should be recorded.
- Return type:
None
- property recorded_state_variables: list
RNN state variables that are recorded by this Observer instance.
- property recorded_variables: list
RNN state variables that are recorded by this Observer instance.
- property recordings