This is an automated email from the ASF dual-hosted git repository. nkak pushed a commit to branch madlib2-master in repository https://gitbox.apache.org/repos/asf/madlib.git
commit 22dd9986758bd8ae6e786f36e5d7ba93ca0ded5e Author: Nikhil Kak <[email protected]> AuthorDate: Mon Feb 19 19:04:59 2024 -0800 PMML: Fix segfault in postgres dev-check JIRA: MADLIB-1517 One of the dev-check queries for the glm pmml would segfault in postgres probably because of this warning ``` WARNING: Hessian or gradient is not finite. ``` Modified the query to fix the segfault For reference, here is the failure: ``` DROP TABLE IF EXISTS glm_model, glm_model_summary; DROP TABLE SELECT glm( 'abalone', 'glm_model', 'rings < 10', 'ARRAY[1, length, diameter, height, whole, shucked, viscera, shell]', 'family=binomial, link=logit', 'sex', 'max_iter=1000, tolerance=1e-16' ); WARNING: Hessian or gradient is not finite. server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. ``` --- .../pmml/test/pmml_glm_with_grouping.sql_in | 6 ++++-- .../pmml/test/pmml_glm_with_name_spec.sql_in | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/ports/postgres/modules/pmml/test/pmml_glm_with_grouping.sql_in b/src/ports/postgres/modules/pmml/test/pmml_glm_with_grouping.sql_in index b3852ecd..b13f6e77 100644 --- a/src/ports/postgres/modules/pmml/test/pmml_glm_with_grouping.sql_in +++ b/src/ports/postgres/modules/pmml/test/pmml_glm_with_grouping.sql_in @@ -48,11 +48,13 @@ FROM glm_model, abalone WHERE abalone.id=glm_model.id and abalone.sex=glm_model. SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_output', 'id', 'glm_predict_binomial', 'predicted_(rings < 10)_pmml_prediction', 'sex,id'); ----------------------- binomial with probit without intercept------------------------------- +-- TODO: There is a segfault in postgres when using rings < 10 as the target with 'sex' as grouping and binomial as the family +-- Hence using a different target here i.e. id > 2000 DROP TABLE IF EXISTS glm_model, glm_model_summary; SELECT glm( 'abalone', 'glm_model', - 'rings < 10', + 'id > 2000', 'ARRAY[length, diameter, height, whole, shucked, viscera, shell]', 'family=binomial, link=probit', 'sex', 'max_iter=1000, tolerance=1e-16' ); @@ -65,7 +67,7 @@ SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_output', 'id', 'glm -- Test output category DROP TABLE IF EXISTS glm_predict_output; CREATE TABLE glm_predict_output as SELECT id, glm_model.sex, glm_predict_binomial(coef, ARRAY[length, diameter, height, whole, shucked, viscera, shell], 'probit') FROM glm_model, abalone WHERE abalone.sex=glm_model.sex; -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_output', 'id', 'glm_predict_binomial', 'predicted_(rings < 10)_pmml_prediction', 'sex'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_output', 'id', 'glm_predict_binomial', 'predicted_(id > 2000)_pmml_prediction', 'sex'); ----------------------- gamma with log ------------------------------- DROP TABLE IF EXISTS glm_model, glm_model_summary; diff --git a/src/ports/postgres/modules/pmml/test/pmml_glm_with_name_spec.sql_in b/src/ports/postgres/modules/pmml/test/pmml_glm_with_name_spec.sql_in index 472bc3a1..24c883c6 100644 --- a/src/ports/postgres/modules/pmml/test/pmml_glm_with_name_spec.sql_in +++ b/src/ports/postgres/modules/pmml/test/pmml_glm_with_name_spec.sql_in @@ -86,7 +86,7 @@ DROP TABLE IF EXISTS glm_model, glm_model_summary; SELECT glm( 'abalone', 'glm_model', - 'rings < 10', + 'id > 2000', 'ARRAY[1, length, diameter, height, whole, shucked, viscera, shell]', 'family=binomial, link=logit', 'sex', 'max_iter=1000, tolerance=1e-16' ); @@ -103,9 +103,9 @@ SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binom DROP TABLE IF EXISTS glm_predict_binomial_logit_out; CREATE TABLE glm_predict_binomial_logit_out as SELECT id, glm_model.sex, glm_predict_binomial(coef, ARRAY[1, length, diameter, height, whole, shucked, viscera, shell], 'logit') FROM glm_model, abalone WHERE abalone.sex=glm_model.sex; SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_bar', 'sex', 'bar ~ foo1+foo2+foo3+foo4+foo5+foo6+foo7'); -SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex', 'foo1+foo2+foo3+foo4+foo5+foo6+foo7'); +SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex', 'foo1+foo2+foo3+foo4+foo5+foo6+foo7'); SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_bar', 'sex', '{bar, foo1,foo2,foo3,foo4,foo5,foo6,foo7}'); -SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex', '{foo1,foo2,foo3,foo4,foo5,foo6,foo7}'); +SELECT test_pmml_output('abalone_test_for_pmml', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex', '{foo1,foo2,foo3,foo4,foo5,foo6,foo7}'); ----------------------- with grouping and incorrect feature length in name spec ------------------------- @@ -116,7 +116,7 @@ DROP TABLE IF EXISTS glm_model, glm_model_summary; SELECT glm( 'abalone', 'glm_model', - 'rings < 10', + 'id > 2000', 'ARRAY[1, length, diameter, height, whole, shucked, viscera, shell]', 'family=binomial, link=logit', 'sex', 'max_iter=1000, tolerance=1e-16' ); @@ -131,15 +131,15 @@ SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out' DROP TABLE IF EXISTS glm_predict_binomial_logit_out; CREATE TABLE glm_predict_binomial_logit_out as SELECT id, glm_model.sex, glm_predict_binomial(coef, ARRAY[1, length, diameter, height, whole, shucked, viscera, shell], 'logit') FROM glm_model, abalone WHERE abalone.sex=glm_model.sex; -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex','foo1+foo2+foo3+foo4+foo5+foo6'); -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex','{foo1,foo2,foo3,foo4,foo5,foo6}'); -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex','{bar,foo1,foo2,foo3,foo4,foo5,foo6,foo7,foo8}'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex','foo1+foo2+foo3+foo4+foo5+foo6'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex','{foo1,foo2,foo3,foo4,foo5,foo6}'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex','{bar,foo1,foo2,foo3,foo4,foo5,foo6,foo7,foo8}'); DROP TABLE IF EXISTS glm_model, glm_model_summary; SELECT glm( 'abalone', 'glm_model', - 'rings < 10', + 'id > 2000', 'ARRAY[length, diameter, height, whole, shucked, viscera, shell]', 'family=binomial, link=logit', 'sex', 'max_iter=1000, tolerance=1e-16' ); @@ -154,7 +154,7 @@ SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out' DROP TABLE IF EXISTS glm_predict_binomial_logit_out; CREATE TABLE glm_predict_binomial_logit_out as SELECT id, glm_model.sex, glm_predict_binomial(coef, ARRAY[length, diameter, height, whole, shucked, viscera, shell], 'logit') FROM glm_model, abalone WHERE abalone.sex=glm_model.sex; -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex','foo1+foo2+foo3+foo4+foo5+foo6'); -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex','{foo1,foo2,foo3,foo4,foo5,foo6}'); -SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_rings < 10', 'sex','{bar,foo1,foo2,foo3,foo4,foo5,foo6,foo7,foo8}'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex','foo1+foo2+foo3+foo4+foo5+foo6'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex','{foo1,foo2,foo3,foo4,foo5,foo6}'); +SELECT test_pmml_output('abalone', 'glm_model', 'glm_predict_binomial_logit_out', 'id', 'glm_predict_binomial', 'predicted_id > 2000', 'sex','{bar,foo1,foo2,foo3,foo4,foo5,foo6,foo7,foo8}');
