one-hot-enum

0.0.3 • Public • Published

Build Status

one-hot-enum

one hot encoding enumerations

Installation

Using npm:

npm install one-hot-enum

In Node.js:

var onehot = require('one-hot-enum');

Usage

let list = ['one', 'two', 'three', 'one', 'three', 'three', 'two'];
 
let enumaration = onehot.enumaration(list);
let encoded = onehot.encode(list);
 
console.log(enumaration);
console.log(encoded);

Encoder

Used to generate one hot encoding on the fly.

let encoder = onehot.encoder([]);
_.forEach(list, value => encoder.add(value));
console.log(encoder.getEncoding());
console.log(encoder.getEncodingMap());

License

MIT © Andre Stehle

Package Sidebar

Install

npm i one-hot-enum

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • ansteh