architecture/architect

Core architect chapter for the architecture surface.

This folder owns the top-level builder entrypoint that turns folderized node, connection, group, layer, and network chapters into named neural network presets.

Read this chapter in three passes:

  1. start with construct() to see how pre-wired primitives become one Network instance,
  2. continue to perceptron() and random() when you want feed-forward and topology-search-friendly builders,
  3. finish with lstm(), gru(), hopfield(), and narx() when you need recurrent presets built from the lower-level architecture chapters.

Example:

const network = Architect.perceptron(2, 4, 1);
const output = network.activate([0, 1]);

architecture/architect/architect.ts

Architect

Provides static methods for constructing predefined neural network architectures.

Architect is the point where the low-level graph primitives stop being raw building blocks and start becoming named network recipes. It assembles nodes, groups, and layers into complete graphs, then normalizes the final Network surface so callers can activate, train, serialize, or evolve the result without manually wiring each primitive.

This boundary matters when you want one of three things:

Example:

const network = Architect.perceptron(2, 4, 1);
const output = network.activate([0, 1]);

default

construct

construct(
  list: (default | default | default)[],
): default

Constructs a network instance from an array of interconnected layers, groups, or nodes.

This method is the bridge between manual graph assembly and a runnable Network. It walks the supplied primitives, collects the unique nodes and connections they reference, infers input/output counts from node types, and folds the result into one normalized network object.

Parameters:

Returns: A network representing the supplied architecture.

enforceMinimumHiddenLayerSizes

enforceMinimumHiddenLayerSizes(
  network: default,
): default

Enforces the minimum hidden layer size rule on a network.

Parameters:

Returns: The same network with hidden layers grown to the minimum size when needed.

gru

gru(
  layers: number[],
): default

Creates a Gated Recurrent Unit network.

Parameters:

Returns: The constructed GRU network.

hopfield

hopfield(
  size: number,
): default

Creates a Hopfield network.

Parameters:

Returns: The constructed Hopfield network.

lstm

lstm(
  layerArgs: (number | { inputToOutput?: boolean | undefined; })[],
): default

Creates a Long Short-Term Memory network.

Parameters:

Returns: The constructed LSTM network.

narx

narx(
  inputSize: number,
  hiddenLayers: number | number[],
  outputSize: number,
  previousInput: number,
  previousOutput: number,
): default

Creates a Nonlinear AutoRegressive network with eXogenous inputs.

Parameters:

Returns: The constructed NARX network.

perceptron

perceptron(
  layers: number[],
): default

Creates a standard multi-layer perceptron network.

The returned network is marked with the public feed-forward topology intent so acyclic enforcement and slab fast-path eligibility stay aligned with the builder users already chose.

Parameters:

Returns: The constructed MLP network.

random

random(
  input: number,
  hidden: number,
  output: number,
  options: { connections?: number | undefined; backconnections?: number | undefined; selfconnections?: number | undefined; gates?: number | undefined; },
): default

Creates a randomly structured network based on node counts and connection options.

Parameters:

Returns: The constructed randomized network.

architecture/architect/architect.errors.ts

Raised when architect construction cannot infer input/output nodes from supplied primitives.

ArchitectInputOutputTypeResolutionError

Raised when architect construction cannot infer input/output nodes from supplied primitives.

ArchitectInvalidGruConfigurationError

Raised when a GRU builder receives too few layer sizes.

ArchitectInvalidLstmConfigurationError

Raised when an LSTM builder receives too few layer sizes.

ArchitectInvalidLstmLayerArgumentsError

Raised when LSTM builder arguments contain invalid layer-size values.

ArchitectInvalidPerceptronConfigurationError

Raised when an MLP builder receives too few layer sizes.

ArchitectZeroInputOutputNodesError

Raised when architect construction produces a network with zero inputs or outputs.

Generated from source JSDoc • GitHub