from1hot
- ketos.data_handling.data_handling.from1hot(value)[source]
Converts the one hot label to binary format
- Args:
- value: scalar or numpy.array | int or float
The label to be converted.
- Returns:
- output: int or numpy array (dtype=int64)
An int representing the category if ‘value’ has 1 dimension or an array of m ints if values is an n by m array.
- Example:
>>> from ketos.data_handling.data_handling import from1hot >>> >>> from1hot(np.array([0,0,0,1,0])) 3 >>> from1hot(np.array([[0,0,0,1,0], ... [0,1,0,0,0]])) array([3, 1])