I have the following code:
# Load model
with open('text_classifier.pkl', 'rb') as f:
countVec, model = pickle.load(f)
#Convert to bag of words
results = countVec.transform(commentsInput)
# predict converted text with the trained model
predictionsNew = model.predict(results)
print(predictionsNew)
The output from the print(predictionsNew)
is as follows: [[1 0 1 0 1 0]]
When I do type(predictionsNew)
it returns the type of output as numpy.ndarray
Each value in that array corresponds to a label from my dataset, and tells me if the input matches that label. For example, lets say each value corresponds to this array labels = ['a','b','c','d','e','f']
.
I would like to loop through the first array and second array and produce an output as follows:
a = 1
b = 0
c = 1
d = 0
e = 1
f = 0
What is the easiest way I can achieve this?
UPDATE: I believe the array of numbers contains just one element. So basically I would like to split this single element into 6 different elements which correspond to my labels array.