architecture/group

Core group chapter for the architecture surface.

This folder owns the library's first composite graph primitive: a small collection of nodes that can be activated, propagated, wired, gated, and serialized as one architectural block.

Read this chapter in three passes:

  1. start with the Group class overview to understand how the boundary wraps many node-level operations into one reusable building block,
  2. continue to connect() and gate() when you need the structural vocabulary for wiring groups into larger graphs,
  3. finish with disconnect(), clear(), and toJSON() when you want the lifecycle and persistence view for composite primitives.

Example:

const encoderBlock = new Group(4);
const decoderBlock = new Group(4);

encoderBlock.connect(
  decoderBlock,
  methods.groupConnection.ONE_TO_ONE,
);

architecture/group/group.ts

Group

Composite node block for architecture construction.

A group is the first place where the architecture surface stops talking about one primitive at a time and starts exposing small graph motifs. It owns a set of nodes plus the connection bookkeeping needed to treat that set as one wiring target, one wiring source, and one propagation unit.

This makes the boundary useful in three different modes:

Example:

const encoderBlock = new Group(4);
const decoderBlock = new Group(4);

encoderBlock.connect(
  decoderBlock,
  methods.groupConnection.ONE_TO_ONE,
);

default

activate

activate(
  value: number[] | undefined,
): number[]

Activates all nodes in the group.

Parameters:

Returns: Activation value of each node in the group, in order.

clear

clear(): void

Resets the state of all nodes in the group.

Returns: Nothing.

connect

connect(
  target: default | default | default,
  method: unknown,
  weight: number | undefined,
): default[]

Establishes connections from all nodes in this group to a target group, layer, or node.

Parameters:

Returns: All connection objects created during this wiring step.

connections

Stores connection information related to this group. in: Connections coming into nodes in this group from outside. out: Connections going out from nodes in this group to outside. self: Connections between nodes within this same group.

disconnect

disconnect(
  target: default | default,
  twosided: boolean,
): void

Removes connections between nodes in this group and a target group or node.

Parameters:

Returns: Nothing.

gate

gate(
  connections: default | default[],
  method: unknown,
): void

Configures nodes within this group to act as gates for the specified connection set.

Parameters:

Returns: Nothing.

nodes

An array holding all the nodes within this group.

propagate

propagate(
  rate: number,
  momentum: number,
  target: number[] | undefined,
): void

Propagates the error backward through all nodes in the group.

Parameters:

Returns: Nothing.

set

set(
  values: { bias?: number | undefined; squash?: ((x: number, derivate?: boolean | undefined) => number) | undefined; type?: string | undefined; },
): void

Sets specific properties for all nodes within the group.

Parameters:

Returns: Nothing.

toJSON

toJSON(): { size: number; nodeIndices: (number | undefined)[]; connections: { in: number; out: number; self: number; }; }

Serializes the group into a JSON-compatible format, avoiding circular references.

Returns: JSON-friendly representation with node indices and connection counts.

architecture/group/group.errors.ts

Raised when caller-provided group values do not match the number of nodes.

GroupGatingMethodRequiredError

Raised when gating is requested without specifying a gating method.

GroupOneToOneSizeMismatchError

Raised when ONE_TO_ONE group connections are requested for groups of different sizes.

GroupSizeMismatchError

Raised when caller-provided group values do not match the number of nodes.

Generated from source JSDoc • GitHub