My table contains a character field and two numeric fields:
CREATE TABLE lr_source (Char01 varchar(250)
,PLNumeric01 numeric
,PLNumeric02 numeric);
I want to train the linear regression model with Char01 and PLNumeric01 as independent variables and PLNumeric02 as the dependent variable.
SELECT madlib.linregr_train( 'lr_source', --source table
'lr_model',--model table
'PLNumeric02', --dependent variable
'ARRAY[PLNumeric01, Char01 ]' --independent variables
);
When I am running above query, it fails with following error:
ERROR: spiexceptions.DatatypeMismatch: ARRAY types numeric and character varying cannot be matched
How can I use non-numeric fields as an independent variable?