Need to make a confusion matrix for data without using sklearn. Trained the neural network and tested it. I think I need to compute the sum of outcomes for each possible outcomes (0-9) and find the average but I'm not sure how to extract the relevant trials for each outcome from the list.
Here is my code:
# go through all the records in the test data set
for record in test_data_list:
# split the record by the ',' commas
all_values = record.split(',')
# correct answer is first value
correct_label = int(all_values[0])
# scale and shift the inputs
inputs = (numpy.asfarray(all_values[1:]) / 255.0 * 0.99) + 0.01
# query the network
outputs = n.query(inputs)
# Note that this array, outputs, is the 10 output nodes of the NW for each trial
# This is wehre you need to chnage the code below to build the confusion matrix
label = numpy.argmax(outputs)
# append correct or incorrect to list
if (label == correct_label):
# network's answer matches correct answer, add 1 to scorecard
scorecard.append(1)
else:
# network's answer doesn't match correct answer, add 0 to scorecard
scorecard.append(0)
pass
pass