Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Latest commit

 

History

History
372 lines (210 loc) · 6.13 KB

File metadata and controls

372 lines (210 loc) · 6.13 KB

Table of Contents

NeuralNetwork

A class to handle neural networks.

Parameters

  • alpha Number learning rate of this network (optional, default 0.1)

Meta

  • since: 1.0.0
  • author: Maxine Michalski

add

Adds an additional layer to this network. Only two layers are supported. Look at tests for examples of layer descriptions.

Parameters

  • layer Object Layer description for creation.

Returns undefined

Meta

  • author: Maxine Michalski

run

Run (forward propagate) through a network.

Parameters

  • inputs Array Array that contains input values

Returns Matrix result of forward propagation

Meta

  • author: Maxine Michalski

train

Trains a network on parameters. For an example of train parameters, look into tests

Parameters

  • params Object Object that describes train parameters and contains train data

Returns undefined

Meta

  • author: Maxine Michalski

Matrix

Matrix class

Parameters

  • rows Number Number of rows, this matrix has
  • columns Number Number of columns, this matrix has

Meta

  • since: 1.0.0
  • author: Maxine Michalski

randomize

Randomize weights

Parameters

  • mu Number Center of gaussian curve
  • std NUmber standard deviation

Returns Float64Array randomized array

Meta

  • author: Maxine Michalski

get

Get a value out of this matrix

Parameters

  • row Number Row of matrix to fetch value from
  • col Number Column of matrix to fetch value from

Returns Number Value of specified cell

Meta

  • author: Maxine Michalski

set

set a value out of this matrix

Parameters

  • row Number Row of matrix to set value of
  • col Number Column of matrix to set value of
  • val Number Value to set cell

Returns undefined

Meta

  • author: Maxine Michalski

save

Saves matrix to a JSON representation

Returns Object JSON representation of Matrix object

Meta

  • author: Maxine Michalski

update

Update matrix with delta values and considering a learning rate alpha

Parameters

  • alpha Number Learning rate to use

Returns undefined

Meta

  • author: Maxine Michalski

load

Loads a matrix from a JSON representation

Parameters

  • json Object JSON representation of a matrix

Returns Matrix restored matrix

Meta

  • author: Maxine Michalski

Graph

Graph class

Parameters

  • needs_backprop Boolean An indicator if this graph needs backpropagation or not (optional, default false)

Meta

  • since: 1.0.0
  • author: Maxine Michalski

backward

A method to backpropagate through a network

Returns undefined

Meta

  • author: Maxine Michalski

mul

Matrix multiplication

Parameters

  • m1 Matrix First matrix to multiplicate
  • m2 Matrix Second matrix to multiplicate

Returns Matrix product of the two matrices

Meta

  • author: Maxine Michalski

add

Adds two matrices together

Parameters

  • m1 Matrix First matrix to add
  • m2 Matrix Second matrix to add

Returns Matrix sum of the two matrices

Meta

  • author: Maxine Michalski

sigmoid

A method to apply the sigmoid (softstep) function on a matrix

Parameters

  • m1 Matrix Matrix to apply sigmoid on

Returns Matrix sigmoid applied matrix

Meta

  • author: Maxine Michalski

tanh

A method to apply the tanh function on a matrix

Parameters

  • m1 Matrix Matrix to apply tanh on

Returns Matrix tanh applied matrix

Meta

  • author: Maxine Michalski

relu

A method to apply the relu function on a matrix

Parameters

  • m1 Matrix Matrix to apply sigmoid on

Returns Matrix relu applied matrix

Meta

  • author: Maxine Michalski