Home Reference Source Repository
import {NeuralNetwork} from 'viktor/lib/NeuralNetwork/NeuralNetwork.js'
public class | source

NeuralNetwork

Class representing a Neural Network

Constructor Summary

Public Constructor
public

constructor(inputNodes: Int, hiddenNodes: Int, outputNodes: Int, learningRate: Int)

Create a NeuralNetwork

Method Summary

Public Methods
public

Returns a copy of the NeuralNetwork

public

eval(inputArr: array[number]): object

Evaluate inputs based on the current state of the NeuralNetwork

public

train(inputArr: array[number], targetArr: array[number]): object

Train the NeuralNetwork

Public Constructors

public constructor(inputNodes: Int, hiddenNodes: Int, outputNodes: Int, learningRate: Int) source

Create a NeuralNetwork

Params:

NameTypeAttributeDescription
inputNodes Int

The number of input nodes

hiddenNodes Int

The number of hidden nodes

outputNodes Int

The number of output nodes

learningRate Int

The learning rate for training

Public Methods

public copy(): NeuralNetwork source

Returns a copy of the NeuralNetwork

Return:

NeuralNetwork

A NeuralNetwork object

public eval(inputArr: array[number]): object source

Evaluate inputs based on the current state of the NeuralNetwork

Params:

NameTypeAttributeDescription
inputArr array[number]

A single dimensional array of number inputs

Return:

object

An object containing matricies representing the input, hidden node outputs, and final outputs

public train(inputArr: array[number], targetArr: array[number]): object source

Train the NeuralNetwork

Params:

NameTypeAttributeDescription
inputArr array[number]

A single dimensional array of number inputs

targetArr array[number]

A single dimensional array of numbers representing expected outputs

Return:

object

An object containing properties representing errors between the Network's output and target outputs and errors in the hidden node layer