one hot encoding enumerations
npm install one-hot-enum
Using npm:
``js`
npm install one-hot-enum
In Node.js:
`js`
var onehot = require('one-hot-enum');
`js
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);
`
`js``
let encoder = onehot.encoder([]);
_.forEach(list, value => encoder.add(value));
console.log(encoder.getEncoding());
console.log(encoder.getEncodingMap());
MIT © Andre Stehle