immrax.neural#

class immrax.neural.NeuralNetwork(dir: Path = None, load: bool | Path = True, key: PRNGKey = Array([0, 0], dtype=uint32))#

Bases: Module, Control

A fully connected neural network, that extends immrax.Control and eqx.Module. Loads from a directory.

Expects the following in the directory inputted:

  • arch.txt file in the format:

    inputlen numneurons activation numneurons activation … numneurons outputlen

  • if load is True, also expects a model.eqx file, for the weights and biases.

Methods

__call__(x)

Call self as a function.

loadzeros()

Initialize the weights and biases to zero.

u(t, x)

Feedback Control Output of the Neural Network evaluated at x: N(x).

loadnpy

save

Initialize a NeuralNetwork using a directory, of the following form

Parameters:
dirPath, optional

Directory to load from, by default None

loadbool | Path, optional

_description_, by default True

keyjax.random.PRNGKey, optional

_description_, by default jax.random.PRNGKey(0)

Methods

__call__(x)

Call self as a function.

loadzeros()

Initialize the weights and biases to zero.

u(t, x)

Feedback Control Output of the Neural Network evaluated at x: N(x).

loadnpy

save

dir: Path#
out_len: int#
seq: Sequential#
save()#
loadnpy()#
loadzeros()#

Initialize the weights and biases to zero.

u(t: Integer | Float, x: Array) Array#

Feedback Control Output of the Neural Network evaluated at x: N(x).

Parameters:
tUnion[Integer, Float] :
xjax.Array :
Returns:
class immrax.neural.CROWNResult(lC, uC, ld, ud)#

Bases: CROWNResult

Create new instance of CROWNResult(lC, uC, ld, ud)

Methods

__call__(x)

Call self as a function.

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

class immrax.neural.FastlinResult(C, ld, ud)#

Bases: FastlinResult

Create new instance of FastlinResult(C, ld, ud)

Attributes:
lud

Methods

__call__(x)

Call self as a function.

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

property lud#
immrax.neural.crown(f: Callable[[...], Array], out_len: int = None) Callable[[...], CROWNResult]#
immrax.neural.fastlin(f: Callable[[...], Array], out_len: int = None) Callable[[...], FastlinResult]#
class immrax.neural.NNCSystem(olsystem: OpenLoopSystem, control: NeuralNetwork)#

Bases: ControlledSystem

Methods

__call__(*args, **kwargs)

Call self as a function.

compute_trajectory(t0, tf, x0[, inputs, dt, ...])

Computes the trajectory of the system from time t0 to tf with initial condition x0.

f(t, x, w)

Returns the value of the closed loop system

class immrax.neural.NNCEmbeddingSystem(sys: NNCSystem, nn_verifier: Literal['crown', 'fastlin'] = 'crown', nn_locality: Literal['local', 'hybrid'] = 'local', M_locality: Literal['local', 'hybrid'] = 'local', sys_mjacM: None | Callable = None)#

Bases: EmbeddingSystem

Methods

E(t, x, w[, permutations, centers, corners, ...])

The right hand side of the embedding system.

__call__(*args, **kwargs)

Call self as a function.

compute_trajectory(t0, tf, x0[, inputs, dt, ...])

Computes the trajectory of the system from time t0 to tf with initial condition x0.

f(t, x, *args, **kwargs)

The right hand side of the system

sys: NNCSystem#
sys_mjacM: Callable#
nn_verifier: Literal['crown', 'fastlin']#
nn_locality: Literal['local', 'hybrid']#
M_locality: Literal['local', 'hybrid']#
verifier: Callable#
E(t: Interval, x: Array, w: Interval, permutations: Tuple[Permutation] = None, centers: Array | Sequence[Array] | None = None, corners: Tuple[Corner] | None = None, refine: Callable[[Interval], Interval] | None = None, T: Array | None = None, **kwargs)#

The right hand side of the embedding system.

Parameters:
tUnion[Integer, Float]

The time of the embedding system.

xjax.Array

The state of the embedding system.

*args

interval-valued control inputs, disturbance inputs, etc. Depends on parent class.

**kwargs
Returns:
jax.Array

The time evolution of the state on the upper triangle