postgresml / postgresml

Postgres with GPUs for ML/AI apps.
https://postgresml.org
MIT License
5.95k stars 295 forks source link

Unable to make predictions using pgml.predict #1031

Open EVAUTOAI opened 1 year ago

EVAUTOAI commented 1 year ago

After successful training,

Issue #1 ---- On trying to predict from data, i am getting the error: function pgml.predict(unknown, numeric[]) is not unique

image

On querying from routines, i see that there are multiple predict functions. Is there an issue with the installation?

image

Isssue #2 ---- when there is a categorical field as input for regression, I am getting below error (een though training was complete successfully):

image
montanalow commented 1 year ago

You'll need to cast your ARRAY[...] to one of the supported types like float4[], e.g. ARRAY[1,2,3,4]::float4[]. We don't support numeric[], since it may be arbitrary precision. I think it might be nice to handle this with a downcast to float internally though, rather than this ambiguous error message.

montanalow commented 1 year ago

For #2, can you post the table description \d of the data? And is this the same table that was for training?

EVAUTOAI commented 1 year ago

Hi, this is the description of the dataset. its the usual Iris dataset

image

Sepal length was used as the target, btw

montanalow commented 1 year ago

The issue here is a limitation of Postgres ARRAY types. They must be homogenous. What if you pass a heterogenous tuple type instead? e.g.

SELECT pgml.predict('205_810', ("Class", "Sepalwidth", "Petallength", "Petalwidth")) 
FROM iris_new
LIMIT 10;
EVAUTOAI commented 12 months ago

For the given predict function, I am getting below error

image
EVAUTOAI commented 12 months ago
image
EVAUTOAI commented 12 months ago

Any way we could ensure the errors displayed are more readable?