0
我的表中包含一個字符字段和兩個數值字段:如何在使用MADlib-postgre訓練線性迴歸模型時使用非數字自變量?
CREATE TABLE lr_source (Char01 varchar(250)
,PLNumeric01 numeric
,PLNumeric02 numeric);
我想訓練線性迴歸模型Char01和PLNumeric01作爲自變量,PLNumeric02作爲因變量。
SELECT madlib.linregr_train('lr_source', --source table
'lr_model',--model table
'PLNumeric02', --dependent variable
'ARRAY[PLNumeric01, Char01 ]' --independent variables
);
當我上面的查詢運行時,出現以下錯誤:
ERROR: spiexceptions.DatatypeMismatch: ARRAY types numeric and character varying cannot be matched
如何使用非數字字段作爲一個獨立的變量?