Examples for GLM
This example shows how to build a GLM model on the ADULT sample data set and how to associate the predicted values on new transactions.
First, you split the ADULT sample data set into a training data set and a validation data set as follows:
CALL IDAX.SPLIT_DATA('intable=adult, traintable=adult_train, testtable=adult_test, id=id, fraction=0.35');
The following call runs the algorithm on the adult_train data set and builds the GLM model.
CALL IDAX.GLM('model=adult_mdl, intable=adult_train, id=id, target=age, link=identity, family=gaussian');
The PREDICT_GLM stored procedure predicts the value for the AGE column.
The following call shows how to associate the values to new transactions.
CALL IDAX.PREDICT_GLM('model= adult_mdl, intable=adult_test, id=id, outtable=adult_mdl_score');
You can validate these predictions by comparing the age values from the records of the ADULT_TEST data set that were not used for building the GLM model adult_mdl with the prediction of the adult_score by using the following command:
SELECT s.id, s.pred, i.age from adult_test i, adult_score s where i.id=s.id;