Input
The input table is admissions_test, as in GLMPredict Example 1: Logistic Distribution Prediction.
SQL Call
CREATE MULTISET TABLE admissionspredict AS ( SELECT * FROM GLM2Predict ( ON admissions_test AS "input" PARTITION BY ANY ON glm2_ridge_model AS model DIMENSION ORDER BY "category" USING Accumulate ('id', 'admitted') ) AS dt ) WITH DATA;
Output
The Lambda argument was omitted, so the function used the MinLambda value from the model table, glm2_ridge_model.
id | admitted | lambda | prediction |
---|---|---|---|
50 | 0 | 0.0216083135455847 | 0.36511507224068 |
52 | 1 | 0.0216083135455847 | 0.726496251808762 |
54 | 1 | 0.0216083135455847 | 0.717408337408593 |
56 | 1 | 0.0216083135455847 | 0.919800062501089 |
58 | 1 | 0.0216083135455847 | 0.922851378346457 |
60 | 1 | 0.0216083135455847 | 0.85873303873771 |
62 | 1 | 0.0216083135455847 | 0.920338525565984 |
64 | 1 | 0.0216083135455847 | 0.64109016094362 |
66 | 1 | 0.0216083135455847 | 0.724430371300696 |
68 | 1 | 0.0216083135455847 | 0.873776484269566 |
51 | 0 | 0.0216083135455847 | 0.367806580390766 |
53 | 1 | 0.0216083135455847 | 0.576347719419299 |
55 | 1 | 0.0216083135455847 | 0.941897375877604 |
57 | 1 | 0.0216083135455847 | 0.920293780069925 |
59 | 1 | 0.0216083135455847 | 0.859789291096852 |
61 | 1 | 0.0216083135455847 | 0.638418344069472 |
63 | 1 | 0.0216083135455847 | 0.919755040923749 |
65 | 1 | 0.0216083135455847 | 0.639825641071193 |
67 | 0 | 0.0216083135455847 | 0.295549223237937 |
69 | 1 | 0.0216083135455847 | 0.919167656796922 |
Binary Prediction Values
To convert the prediction values that the function produced to binary predictions of admission (1 or 0), use these SQL commands:
UPDATE admissionspredict SET prediction = 1 WHERE prediction > 0.5; UPDATE admissionspredict SET prediction = 0 WHERE prediction < 0.5;
id | admitted | lambda | prediction |
---|---|---|---|
52 | 1 | 0.0216083135455847 | 1 |
54 | 1 | 0.0216083135455847 | 1 |
56 | 1 | 0.0216083135455847 | 1 |
58 | 1 | 0.0216083135455847 | 1 |
60 | 1 | 0.0216083135455847 | 1 |
62 | 1 | 0.0216083135455847 | 1 |
64 | 1 | 0.0216083135455847 | 1 |
66 | 1 | 0.0216083135455847 | 1 |
68 | 1 | 0.0216083135455847 | 1 |
53 | 1 | 0.0216083135455847 | 1 |
55 | 1 | 0.0216083135455847 | 1 |
57 | 1 | 0.0216083135455847 | 1 |
59 | 1 | 0.0216083135455847 | 1 |
61 | 1 | 0.0216083135455847 | 1 |
63 | 1 | 0.0216083135455847 | 1 |
65 | 1 | 0.0216083135455847 | 1 |
69 | 1 | 0.0216083135455847 | 1 |
50 | 0 | 0.0216083135455847 | 0 |
51 | 0 | 0.0216083135455847 | 0 |
67 | 0 | 0.0216083135455847 | 0 |