one_hot_errormachine.Rd
One Hot Encoding with Error machine
one_hot_errormachine(Z, size = NULL)
a vector of size N, where Z[i] value indicate the cluster membership of observation i.
optional parameter, indicating the number of classes (avoid some empty class problems).
Z a matrix N x K One-Hot-Encoded by rows, where K is the number of clusters.
Z <- sample(1:4,10,replace=TRUE)
Z_OHE <- one_hot_errormachine(Z)
print(Z_OHE)
#> [,1] [,2] [,3] [,4]
#> [1,] 2.225074e-308 2.225074e-308 1.000000e+00 2.225074e-308
#> [2,] 2.225074e-308 1.000000e+00 2.225074e-308 2.225074e-308
#> [3,] 2.225074e-308 2.225074e-308 2.225074e-308 1.000000e+00
#> [4,] 2.225074e-308 2.225074e-308 2.225074e-308 1.000000e+00
#> [5,] 2.225074e-308 2.225074e-308 2.225074e-308 1.000000e+00
#> [6,] 2.225074e-308 1.000000e+00 2.225074e-308 2.225074e-308
#> [7,] 2.225074e-308 2.225074e-308 2.225074e-308 1.000000e+00
#> [8,] 2.225074e-308 2.225074e-308 1.000000e+00 2.225074e-308
#> [9,] 1.000000e+00 2.225074e-308 2.225074e-308 2.225074e-308
#> [10,] 1.000000e+00 2.225074e-308 2.225074e-308 2.225074e-308