Input
- input: sparse_housing_test_binary, created by inputting housing_test_binary (input table for XGBoostPredict Example 1: Binary Classification) to the Unpivoting function:
DROP TABLE IF EXISTS sparse_housing_test_binary;
CREATE MULTISET TABLE sparse_housing_test_binary AS (
SELECT sn, homestyle, attribute, value_col AS value1 FROM
Unpivoting (
ON housing_test_binary
USING
TargetColumns (
'price','lotsize','bedrooms','bathrms','stories',
'garagepl','driveway','recroom','fullbase','gashw','airco','prefarea'
)
Accumulate ('sn','homestyle')
) AS dt
) WITH DATA;
- ModelTable: sparse_housing_xgboost_model, output by XGBoost Example 3: Sparse Input Format
input: sparse_housing_test_binary
sn |
homestyle |
attribute |
value1 |
13 |
Classic |
price |
27000.0 |
13 |
Classic |
lotsize |
1700.0 |
13 |
Classic |
bedrooms |
3 |
13 |
Classic |
bathrms |
1 |
13 |
Classic |
stories |
2 |
13 |
Classic |
garagepl |
0 |
13 |
Classic |
driveway |
yes |
13 |
Classic |
recroom |
no |
13 |
Classic |
fullbase |
no |
13 |
Classic |
gashw |
no |
13 |
Classic |
airco |
no |
13 |
Classic |
prefarea |
no |
25 |
Classic |
price |
42000.0 |
25 |
Classic |
lotsize |
4960.0 |
25 |
Classic |
bedrooms |
2 |
25 |
Classic |
bathrms |
1 |
25 |
Classic |
stories |
1 |
25 |
Classic |
garagepl |
0 |
25 |
Classic |
driveway |
yes |
25 |
Classic |
recroom |
no |
25 |
Classic |
fullbase |
no |
SQL Call
CREATE MULTISET TABLE sparse_housing_predict AS (
SELECT * FROM XGBoost_Predict (
ON sparse_housing_test_binary AS "input" PARTITION BY sn
ON sparse_housing_xgboost_model AS modeltable DIMENSION ORDER BY tree_id, iter, class_num
USING
AttributeNameColumn ('attribute')
AttributeValueColumn ('value1')
IdColumn ('sn')
NumBoostedTrees (1)
Accumulate ('homestyle')
) AS dt
) WITH DATA;
Output
sparse_housing_predict
sn |
homestyle |
prediction |
confidence_lower |
confidence_upper |
13 |
Classic |
Classic |
1 |
1 |
16 |
Classic |
Classic |
1 |
1 |
25 |
Classic |
Classic |
1 |
1 |
38 |
Electic |
Electic |
1 |
1 |
53 |
Electic |
Electic |
1 |
1 |
111 |
Classic |
Classic |
1 |
1 |
117 |
Electic |
Electic |
1 |
1 |
132 |
Classic |
Classic |
1 |
1 |
140 |
Classic |
Classic |
1 |
1 |
142 |
Classic |
Classic |
1 |
1 |
157 |
Electic |
Electic |
1 |
1 |
161 |
Electic |
Electic |
1 |
1 |
176 |
Electic |
Electic |
1 |
1 |
177 |
Electic |
Electic |
1 |
1 |
195 |
Classic |
Classic |
1 |
1 |
198 |
Classic |
Classic |
1 |
1 |
224 |
Electic |
Electic |
1 |
1 |
234 |
Classic |
Classic |
1 |
1 |
237 |
Classic |
Classic |
1 |
1 |
239 |
Classic |
Classic |
1 |
1 |
249 |
Classic |
Classic |
1 |
1 |
251 |
Classic |
Classic |
1 |
1 |
254 |
Electic |
Electic |
1 |
1 |
255 |
Electic |
Electic |
1 |
1 |
260 |
Classic |
Classic |
1 |
1 |
274 |
Electic |
Electic |
1 |
1 |
294 |
Classic |
Classic |
1 |
1 |
301 |
Electic |
Electic |
1 |
1 |
306 |
Electic |
Electic |
1 |
1 |
317 |
Electic |
Electic |
1 |
1 |
340 |
Electic |
Electic |
1 |
1 |
353 |
Electic |
Electic |
1 |
1 |
355 |
Electic |
Electic |
1 |
1 |
364 |
Electic |
Electic |
1 |
1 |
401 |
Electic |
Electic |
1 |
1 |
403 |
Electic |
Electic |
1 |
1 |
408 |
Electic |
Electic |
1 |
1 |
411 |
Electic |
Electic |
1 |
1 |
440 |
Electic |
Electic |
1 |
1 |
441 |
Electic |
Electic |
1 |
1 |
443 |
Electic |
Electic |
1 |
1 |
459 |
Classic |
Classic |
1 |
1 |
463 |
Classic |
Classic |
1 |
1 |
469 |
Electic |
Electic |
1 |
1 |
472 |
Electic |
Electic |
1 |
1 |
540 |
Electic |
Electic |
1 |
1 |