Input
- InputTable: iris_test, created in DecisionTree Example: Create Model
- ModelTable: xgboost_model, output by XGBoost Example: Multiple-Class Classification
SQL Call
CREATE MULTISET TABLE iris_predict AS ( SELECT * FROM XGBoostPredict ( ON iris_test AS InputTable PARTITION BY ANY ON xgboost_model_2 AS Model DIMENSION ORDER BY tree_id, iter, class_num USING IDColumn ('id') NumBoostedTrees (2) OutputProb ('t') Responses ('1','2','3') Accumulate ('species') ) AS dt ) WITH DATA;
Output
SELECT * FROM iris_predict ORDER BY id;
id species prediction prob_1 prob_2 prob_3 --- ------- ---------- ------- ------- ------- 5 1 1 0.48291 0.26014 0.25695 10 1 1 0.51761 0.24292 0.23947 15 1 1 0.48375 0.26095 0.25531 20 1 1 0.4993 0.25484 0.24586 25 1 1 0.46432 0.27109 0.26459 30 1 1 0.46374 0.26897 0.26729 35 1 1 0.51766 0.24334 0.23901 40 1 1 0.48499 0.26244 0.25256 45 1 1 0.49165 0.26029 0.24806 50 1 1 0.51104 0.24842 0.24054 55 2 2 0.25653 0.48713 0.25634 60 2 2 0.27605 0.45864 0.26531 65 2 2 0.2491 0.51434 0.23656 70 2 2 0.25703 0.49888 0.24409 75 2 2 0.25475 0.48738 0.25787 80 2 2 0.2486 0.50984 0.24156 85 2 2 0.25221 0.50593 0.24187 90 2 2 0.25178 0.5083 0.23992 95 2 2 0.24871 0.51341 0.23788 100 2 2 0.25119 0.50696 0.24185 105 3 3 0.25368 0.252 0.49432 110 3 3 0.2631 0.25911 0.47778 115 3 3 0.26164 0.27229 0.46607 120 3 2 0.25457 0.48861 0.25682 125 3 3 0.26082 0.25934 0.47984 130 3 2 0.26659 0.38281 0.3506 135 3 2 0.26095 0.47176 0.2673 140 3 3 0.26547 0.26201 0.47252 145 3 3 0.26082 0.25934 0.47984 150 3 3 0.26762 0.3638 0.36858
Download a zip file of all examples and a SQL script file that creates their input tables.