7.00.02 - Prediction Accuracy - Aster Analytics

Teradata Aster® Analytics Foundation User GuideUpdate 2

Product
Aster Analytics
Release Number
7.00.02
Release Date
September 2017
Content Type
Programming Reference
User Guide
Publication ID
B700-1022-700K
Language
English (United States)

The following SQL code calculates and displays the prediction accuracy.

DROP TABLE IF EXISTS st_predict_accuracy;

CREATE TABLE st_predict_accuracy DISTRIBUTE BY hash(pid) AS
  SELECT pid, pred_label :: INTEGER AS pred_label,species FROM     singletree_predict, iris_test WHERE id = pid;

  SELECT (SELECT COUNT(pid) FROM st_predict_accuracy
    WHERE pred_label = species)/(SELECT COUNT(pid)
    FROM st_predict_accuracy) AS prediction_accuracy;
Single_Tree_Predict Example Prediction Accuracy
prediction_accuracy
0.90000000000000000000