Skip to content Skip to sidebar Skip to footer

Coverting Back One Hot Encoded Results Back To Single Column In Python

I was doing Multi-class Classification using Keras.It contained 5 classes of Output. I converted the single class vector to matrix using one hot encoding and made a model. Now to e

Solution 1:

It seems like you are looking for np.argmax:

import numpy as np
class_labels = np.argmax(class_prob, axis=1) # assuming you have n-by-5 class_prob

Post a Comment for "Coverting Back One Hot Encoded Results Back To Single Column In Python"