How to compute precision and accuracy of a sequence that is not strictly binary?
Welcome to the Site!

We know that this problem is Multi-Class Classification Problem.

To get a confusion matrix for the same you can use the following command:

from mlxtend.evaluate import confusion_matrix

#import the required packages
from mlxtend.evaluate import confusion_matrix 
from mlxtend.evaluate import plot_confusion_matrix

#Actual Target Values
y_target =    [-1,1,0,1,-1,1,0,1,0,-1]
#Predicted Values
y_predicted = [-1,0,1,1,-1,0,1,1,0,-1]

#creation of confusion matrix
cm = confusion_matrix(y_target=y_target, 
                      y_predicted=y_predicted, 
                      binary=False)
#to print the calculated values  of Confusion Matrix
cm


Outcome:

array([[3, 0, 0],
   [0, 1, 2],
   [0, 2, 2]])


For visualizing the cm you can use the following command:

fig, ax = plot_confusion_matrix(conf_mat=cm)
plt.show()




You can go through this Link for better understanding of mlextend.

You can get the Precision and Accuracy values by using the following formulas:

$\text{Precision}_{~i} = \cfrac{M_{ii}}{\sum_j M_{kji}}$

$\text{Recall}_{~i} = \cfrac{M_{ii}}{\sum_j M_{ijk}}$

Go through these Link-1,Link-2 for better understanding on how to compute the same, in the Link-3 is GitHub link which explains on how they implemented for a 1-D array, looking at that you can try expanding it for your outcome.