Transforms

NHot

class sconce.transforms.NHot(size)[source]

Converts a list of indices to a n-hot encoded vector.

Parameters:size (int) – the size of the returned array

example

>>> l = [3, 7, 2, 1]
>>> t = NHot(size=10)
>>> t(l)
array([0., 1., 1., 1., 0., 0., 0., 1., 0., 0.])