I've this matrix confusion:
[9779 107] [2227 148]
What is the accuracy of my model? My doubt is because the confusion matrix is calculated based on Test dataset so how can it evaluate the accuracy of my model?
A confusion matrix gives you the following:
[TP, FP] [FN, TN]
where TP = 'true positives'; FP = 'false positives'; FN = 'false negatives'; TN = 'true negatives'.
You can read more here: http://www.dataschool.io/simple-guide-to-confusion-matrix-terminology/
By taking TP+TN and dividing by TP+FP+FN+TN, you can get the classification accuracy of your model. In your case, that means (9779+148)/(9779+107+2227+148) = about 81%
This type of confusion matrix is used for binary classification.
Assuming you have the elements 9779 = True Positive, 148 = True Negative, you can obtain the accuracy by adding the diagonal elements, then dividing by the sum of all the numbers within the matrix. So for your example:
(9779 + 148)/(9779 + 148 + 107 + 2227) = 0.80964..
Hence, Accuracy = 80.96%