Group

new Group (sizeopt) open an issue

A group instance denotes a group of nodes. Beware: once a group has been used to construct a network, the groups will fall apart into individual nodes. They are purely for the creation and development of networks.

Parameters:
Name Type Default Description
size number <optional> 0

Amount of nodes to build group with

Example
      Copy
      let { Group } = require("@liquid-carrot/carrot");

// A group with 5 nodes
let A = new Group(5);
    
Properties:
Name Type Attributes Default Description
nodes Array.<Nodes> <optional>
[]

All nodes within the group

incoming Array.<Connection> <optional>
[]

Incoming connections

outgoing Array.<Connection> <optional>
[]

Outgoing connections

connections_self Array.<Connection> <optional>
[]

Self connections

Source:

Methods

(static) activate (inputs) → {Array.<number>} open an issue

Activates all the nodes (neurons) in the group

Parameters:
Name Type Description
inputs Array.<number>

Array of inputs (numbers) for the group - order matters.

Returns:

Squashed output values

Example
      Copy
      let { Group } = require("@liquid-carrot/carrot");

let group = new Group(3);

group.activate([1, 0, 1]);
    
Source:

(static) clear () → {Group} open an issue

Clear the context of the nodes in this group

Returns:

The group itself

Source:

(static) connect (target, method, weight) → {Array.<Connection>} open an issue

Connects the nodes in this group to nodes in another group or just a node

Parameters:
Name Type Description
target Group | Layer | Node

Node(s) to form connections to

method connection

Connection Method, determines how the nodes in this group will connect to the target (e.g. one-to-one, all-to-all)

weight number

Weight of the connection(s)

Returns:

The formed connections

Example
      Copy
      let { Group } = require("@liquid-carrot/carrot");

let A = new Group(4);
let B = new Group(5);

A.connect(B, methods.connection.ALL_TO_ALL); // specifying a method is optional
    
Source:

(static) disconnect (target, twosidedopt) open an issue

INCOMPLETE Disconnects all nodes from this group from another given group/node.

Parameters:
Name Type Default Description
target Group | Node

Node(s) to remove connections to/from

twosided boolean <optional> false

Set to true, to disconnect both to and from connections simultaneously (applies to two-sided Connections only)

Source:

(static) gate (connections, method) open an issue

Make nodes from this group gate the given connection(s) between two other groups. You have to specify a Gating Method

Parameters:
Name Type Description
connections Array.<Connection> | Connection

Connections to gate

method gating

Gating Method

Source:

(static) propagate (targetopt, optionsopt) → {Array.<{responsibility: number, projected: number, gated: number}>} open an issue

Will backpropagate all the node in the group -- make sure the group receives input from another group or node.

Momentum adds a fraction of the previous weight update to the current one. If you combine a high learning rate with a lot of momentum, you will rush past the minimum with huge steps. It is therefore often necessary to reduce the global learning rate ยต when using a lot of momentum (m close to 1).

Parameters:
Name Type Description
target number | Array.<number> <optional>

Ideal value(s) - required for output nodes

options
Properties
Name Type Default Description
rate number <optional>

Learning rate

momentum number <optional>

Momentum adds a fraction of the previous weight update to the current one. When the gradient keeps pointing in the same direction, this will increase the size of the steps taken towards the minimum.

update boolean <optional> true
Returns:

The errors created by backpropagating

Example
      Copy
      let { Group } = require("@liquid-carrot/carrot");

let A = new Group(2);
let B = new Group(3);

// Connects group A to group B - creating a "little network"
A.connect(B);

// Activates the "little network"
A.activate([1,0]);
B.activate();

// Teaches the network
B.propagate([0,1,0.2]);
A.propagate();
    
Source:

(static) set (values) open an issue

Sets the value of a property for every node

Parameters:
Name Type Description
values

A configuration object

Properties
Name Type Description
bias number

Weight bias

squash activation

Activation function

Example
      Copy
      let { Group } = require("@liquid-carrot/carrot");

var group = new Group(4);

// All nodes in 'group' now have a bias of 1
group.set({bias: 1});
    
Source: