# Class: ANN

## ANN()

#### new ANN()

MaiaScript Artificial Neural Network (ANN) library.

Source:
  - ANN.js, line 24

### Methods

#### createANN(topology, numVertices, numEdges, edgeProbability, averageDegree, ni, no, nl, nhu) → {object}

Creates an untrained artificial neural network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topology` | string | Graph topology. It can be: complete, random, small world, scale-free, hybrid or mlp.
`numVertices` | number | Number of vertices.
`numEdges` | number | Number of edges.
`edgeProbability` | number | Edge probability.
`averageDegree` | number | Number of input neurons.
`ni` | number | Number of input neurons.
`no` | number | Number of output neurons.
`nl` | number | Number of layers.
`nhu` | number | Number of hidden units.

Source:
  - ANN.js, line 49

##### Returns:

A neural network.

Type
  object

#### getLabels(ANNMatrix) → {object}

Returns the labels of an adjacency matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ANNMatrix` | object | Adjacency matrix.

Source:
  - ANN.js, line 360

##### Returns:

The labels of an adjacency matrix.

Type
  object

#### learn(ANNMatrix, inMatrix, outMatrix, ni, no, lRate, AF, OAF) → {object}

Trains an artificial neural network, represented as an adjacency matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ANNMatrix` | object | Adjacency matrix.
`inMatrix` | object | Input data for training.
`outMatrix` | object | Output data for training.
`ni` | number | Number of input neurons.
`no` | number | Number of output neurons.
`lRate` | number | Learning rate.
`AF` | string | Activation function. It can be: linear, logistic or tanh.
`OAF` | string | Activation function of the last layer. It can be: linear, logistic or tanh.

Source:
  - ANN.js, line 383

##### Returns:

Trained neural network.

Type
  object

#### prepare(ANNMatrix, randomize, allowLoops, negativeWeights) → {object}

It prepares a neural network, represented as an adjacency matrix, replacing cells with value one (1), with random real numbers.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ANNMatrix` | object | Adjacency matrix.
`randomize` | boolean | Fill cells with random real numbers.
`allowLoops` | boolean | Allow loops.
`negativeWeights` | boolean | Allow negative weights.

Source:
  - ANN.js, line 541

##### Returns:

Matrix filled with random numbers.

Type
  object

#### setLabels(ANNMatrix, labels) → {object}

Sets the labels of an adjacency matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ANNMatrix` | object | Adjacency matrix.
`labels` | object | Matrix labels.

Source:
  - ANN.js, line 593

##### Returns:

The adjacency matrix

Type
  object

#### think(ANNMatrix, inMatrix, ni, no, AF, OAF, OF, OFC) → {object}

It processes incoming data using a trained neural network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ANNMatrix` | object | adjacency matrix.
`inMatrix` | object | Input data for training.
`ni` | number | Number of input neurons.
`no` | number | Number of output neurons.
`AF` | string | Activation function. It can be: linear, logistic or tanh.
`OAF` | string | Activation function of the last layer. It can be: linear, logistic or tanh.
`OF` | string | Output function. It can be: linear, step, or none.
`OFC` | object | Output function coefficients.

Source:
  - ANN.js, line 617

##### Returns:

Trained neural network.

Type
  object

#### training(ANNMatrix, inMatrix, outMatrix, lRate, AF, OAF, OF, OFC, maxEpochs, minimumCorrectness, callback, interval) → {object}

Train an artificial neural network, represented as an adjacency matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ANNMatrix` | object | Adjacency matrix.
`inMatrix` | object | Input data for training.
`outMatrix` | object | Output data for training.
`lRate` | number | Learning rate.
`AF` | string | Activation function. It can be: linear, logistic or tanh.
`OAF` | string | Activation function of the last layer. It can be: linear, logistic or tanh.
`OF` | string | Output function. It can be: linear, step or none.
`OFC` | string | Output function coefficients.
`maxEpochs` | number | Maximum number of epochs.
`minimumCorrectness` | number | Minimum correctness.
`callback` | function | Callback function.
`interval` | number | Interval between calls from the callback function.

Source:
  - ANN.js, line 765

##### Returns:

Trained neural network.

Type
  object

#### (inner) init()

Creates the attributes of the class.

Source:
  - ANN.js, line 30