Skip to content
one hot enumarations
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json
test.js

README.md

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

You can’t perform that action at this time.