zemlyansky / autoencoder

Autoencoder.js
5 stars 2 forks source link
autoencoder dimensionality-reduction feature-extraction neural-network

Autoencoder

A simple autoencoder module for experimentation and dimensionality reduction. Supports automatic scaling

Autoencoder

Install and load

Install from npm:

npm install autoencoder

Then load with require:

const Autoencoder = require('autoencoder')

Create new autoencoder

Autoencoder supports two ways of a model initialization:

Activation functions: relu, tanh, sigmoid

As other neural nets, autoencoder is very sensitive to input scaling. To make it easier the scaling is enabled by default, you can control it with an extra parameter scale that takes true or false

Train autoencoder

ae.fit(X, {
  'batchSize': 100,
  'iterations': 5000,
  'method': 'adagrad', // (default 'adagrad')
  'stepSize': 0.01,
})

Optimization methods: sgd, adagrad, adam

Encode, Decode, Predict

const Y = ae.encode(X)
const Xd = ae.decode(Y)
const Xp = ae.predict(X) // Similar to ae.decode(ae.encode(X))

Web demo (dimensionality reduction)

Try the package in the browser on StatSim Vis. Choose a CSV file, change a dimensionality reduction method to Autoencoder, then click Run.