For a classification problem, you can calculate the prediction accuracy, or misclassification error. Because the NeuralNet function prediction is numeric, you must first transform the numeric values in the predictOut_0 column into classes. For example, if predictOut_0 > 3, the predicted class is 4.
-
Transform the numeric values into classes:
UPDATE nn_bc_predict SET "predictOut_0" = 2 WHERE "predictOut_0" < 3; UPDATE nn_bc_predict SET "predictOut_0" = 4 WHERE "predictOut_0" > 3;
-
Display the number of correct classifications:
SELECT count(*) FROM nn_bc_predict WHERE "predictOut_0" = class;
count(1) ---------- 205 (1 row)
-
Display the total number of classifications:
SELECT count(*) FROM nn_bc_predict;
count(1) ---------- 210 (1 row)
- Calculate the prediction accuracy: 205/210 = 97.6%