nnlib
GPU-accelerated, C/C++ neural network library.
Functions
onehot_encode.cpp File Reference

Source file containing the definition of the oneHotEncode() method. More...

#include "onehot_encode.h"
#include <exceptions/unsupported_operation_exception.h>
#include <set>

Functions

int indexOf (float value, const std::set< float > &set)
 Return the index of a value in a set. More...
 
sTensor oneHotEncode (const sTensor &vector)
 One hot encode a vector of data. More...
 

Detailed Description

Source file containing the definition of the oneHotEncode() method.

Author
Jan Warchocki
Date
07 March 2022

Function Documentation

◆ indexOf()

int indexOf ( float  value,
const std::set< float > &  set 
)

Return the index of a value in a set.

Parameters
valueThe value to look for.
setThe set to look for value in.
Returns
The index of value in set or -1 if the value is not found.

◆ oneHotEncode()

sTensor oneHotEncode ( const sTensor &  vector)

One hot encode a vector of data.

Parameters
vectorThe vector to encode.
Returns
Matrix corresponding to the one hot encoded vector.
Examples
MNIST.