0.0.3 • Published 8 years ago
one-hot-enum v0.0.3
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