Skip to content

jackbackes/char-rnn.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

char-rnn.js

A javaScript port of https://github.com/karpathy/char-rnn

Instructions

npm install char-rnn

Create a new Network:

const CharRnn = require("./char-rnn");
const Memory = require("./memory");
const Linalg = require("./linalg");
const Lstm = require("./lstm");


const networkMemory = new Memory(buffer: a Buffer, metadata: a json representation of the buffer);

const linalg = new Linalg(networkMemory);

const params = {affines, nNodes, nLayers, vocab, ivocab}
// ^^^ there are more steps here. see load.js file for more information.

const model = new LSTM(linalg, params);
const myNetwork = new CharRNN(model)

CharRnn

The CharRNN constructor. Instantiates an object that represents the neural network.

Parameters

  • model LSTM is aliased by model.

CharRnn.prototype.getState

Gets the network state. Calls LSTM.prototype.makeState or LSTM.prototype.copyState, which returns a Vector.

Parameters

  • str
  • initialState

CharRnn.prototype.score

A prototype method, CharRnn#score

Parameters

  • str
  • initialState

CharRnn.prototype.sample

A prototype method, CharRnn#sample

Parameters

  • state

Vector

Vector is instantiated using a Float32Array.

Linalg

Object to perform Linear Algebra

Parameters

load

takes a dat and json file with the same filename, and returns an instance of the CharRnn Model.

Parameters

Returns CharRnn [description]

LSTM

Returns an LSTM Object. See documentation. More about long short-term memory on Wikipedia.

Parameters

Returns Object

Memory

Memory Object

Parameters

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%