text: -- This SQL code was generated by sklearn2sql (development version).
  -- Copyright 2018
  
  -- Model : CaretClassifier_earth
  -- Dataset : BreastCancer
  -- Database : monetdb
  
  
  -- This SQL code can contain one or more statements, to be executed in the order they appear in this file.
  
  
  
  -- Model deployment code
  
  WITH earth_input AS 
  (SELECT "ADS"."KEY" AS "KEY", CAST("ADS"."Feature_0" AS DOUBLE) AS "Feature_0", CAST("ADS"."Feature_1" AS DOUBLE) AS "Feature_1", CAST("ADS"."Feature_2" AS DOUBLE) AS "Feature_2", CAST("ADS"."Feature_3" AS DOUBLE) AS "Feature_3", CAST("ADS"."Feature_4" AS DOUBLE) AS "Feature_4", CAST("ADS"."Feature_5" AS DOUBLE) AS "Feature_5", CAST("ADS"."Feature_6" AS DOUBLE) AS "Feature_6", CAST("ADS"."Feature_7" AS DOUBLE) AS "Feature_7", CAST("ADS"."Feature_8" AS DOUBLE) AS "Feature_8", CAST("ADS"."Feature_9" AS DOUBLE) AS "Feature_9", CAST("ADS"."Feature_10" AS DOUBLE) AS "Feature_10", CAST("ADS"."Feature_11" AS DOUBLE) AS "Feature_11", CAST("ADS"."Feature_12" AS DOUBLE) AS "Feature_12", CAST("ADS"."Feature_13" AS DOUBLE) AS "Feature_13", CAST("ADS"."Feature_14" AS DOUBLE) AS "Feature_14", CAST("ADS"."Feature_15" AS DOUBLE) AS "Feature_15", CAST("ADS"."Feature_16" AS DOUBLE) AS "Feature_16", CAST("ADS"."Feature_17" AS DOUBLE) AS "Feature_17", CAST("ADS"."Feature_18" AS DOUBLE) AS "Feature_18", CAST("ADS"."Feature_19" AS DOUBLE) AS "Feature_19", CAST("ADS"."Feature_20" AS DOUBLE) AS "Feature_20", CAST("ADS"."Feature_21" AS DOUBLE) AS "Feature_21", CAST("ADS"."Feature_22" AS DOUBLE) AS "Feature_22", CAST("ADS"."Feature_23" AS DOUBLE) AS "Feature_23", CAST("ADS"."Feature_24" AS DOUBLE) AS "Feature_24", CAST("ADS"."Feature_25" AS DOUBLE) AS "Feature_25", CAST("ADS"."Feature_26" AS DOUBLE) AS "Feature_26", CAST("ADS"."Feature_27" AS DOUBLE) AS "Feature_27", CAST("ADS"."Feature_28" AS DOUBLE) AS "Feature_28", CAST("ADS"."Feature_29" AS DOUBLE) AS "Feature_29" 
  FROM "BreastCancer" AS "ADS"), 
  earth_cte AS 
  (SELECT earth_input."KEY" AS "KEY", -20276.6860699524 * CASE WHEN (earth_input."Feature_7" - 0.09431 <= 0) THEN 0 ELSE earth_input."Feature_7" - 0.09431 END + 12218.88993541963 * CASE WHEN (0.09431 - earth_input."Feature_7" <= 0) THEN 0 ELSE 0.09431 - earth_input."Feature_7" END + -2.380924151983417 * CASE WHEN (earth_input."Feature_23" - 1269.0 <= 0) THEN 0 ELSE earth_input."Feature_23" - 1269.0 END + 0.8668634524124131 * CASE WHEN (1269.0 - earth_input."Feature_23" <= 0) THEN 0 ELSE 1269.0 - earth_input."Feature_23" END + 412.90118461426016 * CASE WHEN (earth_input."Feature_27" - 0.09594 <= 0) THEN 0 ELSE earth_input."Feature_27" - 0.09594 END + -1746.160659578372 * CASE WHEN (0.09594 - earth_input."Feature_27" <= 0) THEN 0 ELSE 0.09594 - earth_input."Feature_27" END + 190.51083729253182 * CASE WHEN (earth_input."Feature_0" - 17.68 <= 0) THEN 0 ELSE earth_input."Feature_0" - 17.68 END + -207.88664437327117 * CASE WHEN (17.68 - earth_input."Feature_0" <= 0) THEN 0 ELSE 17.68 - earth_input."Feature_0" END + 7.36935004246159 * CASE WHEN (earth_input."Feature_1" - 23.29 <= 0) THEN 0 ELSE earth_input."Feature_1" - 23.29 END + -856.3179077971361 * CASE WHEN (earth_input."Feature_28" - 0.2226 <= 0) THEN 0 ELSE earth_input."Feature_28" - 0.2226 END + -3195.2534672226648 * CASE WHEN (0.2226 - earth_input."Feature_28" <= 0) THEN 0 ELSE 0.2226 - earth_input."Feature_28" END + -4.570803216789019 * CASE WHEN (158.8 - earth_input."Feature_22" <= 0) THEN 0 ELSE 158.8 - earth_input."Feature_22" END + 819.6893984092267 * CASE WHEN (earth_input."Feature_16" - 0.05554 <= 0) THEN 0 ELSE earth_input."Feature_16" - 0.05554 END + 2268.774345428007 * CASE WHEN (0.05554 - earth_input."Feature_16" <= 0) THEN 0 ELSE 0.05554 - earth_input."Feature_16" END + 397.06434654544563 * CASE WHEN (earth_input."Feature_27" - 0.1674 <= 0) THEN 0 ELSE earth_input."Feature_27" - 0.1674 END + -1048.494561328608 * CASE WHEN (earth_input."Feature_27" - 0.1181 <= 0) THEN 0 ELSE earth_input."Feature_27" - 0.1181 END + 22616.719784892462 * CASE WHEN (0.01096 - earth_input."Feature_18" <= 0) THEN 0 ELSE 0.01096 - earth_input."Feature_18" END + -0.7862756286049772 * CASE WHEN (674.5 - earth_input."Feature_3" <= 0) THEN 0 ELSE 674.5 - earth_input."Feature_3" END + 2.5291940005518643 * CASE WHEN (earth_input."Feature_23" - 1175.0 <= 0) THEN 0 ELSE earth_input."Feature_23" - 1175.0 END + -3247.063924841283 * CASE WHEN (0.1479 - earth_input."Feature_5" <= 0) THEN 0 ELSE 0.1479 - earth_input."Feature_5" END + 20175.91910112512 * CASE WHEN (earth_input."Feature_7" - 0.07488 <= 0) THEN 0 ELSE earth_input."Feature_7" - 0.07488 END + -10775.18163906298 * CASE WHEN (0.05892000000000001 - earth_input."Feature_6" <= 0) THEN 0 ELSE 0.05892000000000001 - earth_input."Feature_6" END + 1270.585189556399 * CASE WHEN (0.2687 - earth_input."Feature_26" <= 0) THEN 0 ELSE 0.2687 - earth_input."Feature_26" END + 198.7727796283102 * CASE WHEN (0.5391 - earth_input."Feature_11" <= 0) THEN 0 ELSE 0.5391 - earth_input."Feature_11" END + -8.557613585377194 * CASE WHEN (earth_input."Feature_1" - 19.22 <= 0) THEN 0 ELSE earth_input."Feature_1" - 19.22 END + 1.336414986853243 * CASE WHEN (earth_input."Feature_22" - 128.7 <= 0) THEN 0 ELSE earth_input."Feature_22" - 128.7 END + -3.456761071624524 * CASE WHEN (earth_input."Feature_22" - 97.58 <= 0) THEN 0 ELSE earth_input."Feature_22" - 97.58 END + 31.847631901572647 * CASE WHEN (91.12 - earth_input."Feature_2" <= 0) THEN 0 ELSE 91.12 - earth_input."Feature_2" END + -208.4114979295069 * CASE WHEN (earth_input."Feature_0" - 14.22 <= 0) THEN 0 ELSE earth_input."Feature_0" - 14.22 END + 4763.523437576098 * CASE WHEN (earth_input."Feature_24" - 0.1782 <= 0) THEN 0 ELSE earth_input."Feature_24" - 0.1782 END + 286.8939053683233 * CASE WHEN (0.1782 - earth_input."Feature_24" <= 0) THEN 0 ELSE 0.1782 - earth_input."Feature_24" END + 96.79812750730221 * CASE WHEN (earth_input."Feature_25" - 0.611 <= 0) THEN 0 ELSE earth_input."Feature_25" - 0.611 END + 260.26228755048453 AS earth 
  FROM earth_input), 
  dot_prod_logistic AS 
  (SELECT earth_cte."KEY" AS "KEY", earth_cte.earth AS dot_prod, 1.0 / (1.0 + exp(CASE WHEN (100.0 <= CASE WHEN (-100.0 <= -earth_cte.earth) THEN -earth_cte.earth ELSE -100.0 END) THEN 100.0 ELSE CASE WHEN (-100.0 <= -earth_cte.earth) THEN -earth_cte.earth ELSE -100.0 END END)) AS logistic 
  FROM earth_cte)
   SELECT dot_prod_logistic."KEY" AS "KEY", CAST(NULL AS DOUBLE) AS "Score_0", CAST(NULL AS DOUBLE) AS "Score_1", 1.0 - dot_prod_logistic.logistic AS "Proba_0", dot_prod_logistic.logistic AS "Proba_1", log(CASE WHEN (1.0 - dot_prod_logistic.logistic IS NULL OR 1.0 - dot_prod_logistic.logistic > 1e-100) THEN 1.0 - dot_prod_logistic.logistic ELSE 1e-100 END) AS "LogProba_0", log(CASE WHEN (dot_prod_logistic.logistic IS NULL OR dot_prod_logistic.logistic > 1e-100) THEN dot_prod_logistic.logistic ELSE 1e-100 END) AS "LogProba_1", CASE WHEN (dot_prod_logistic.dot_prod > 0.0) THEN 1 ELSE 0 END AS "Decision", CASE WHEN (1.0 - dot_prod_logistic.logistic <= dot_prod_logistic.logistic) THEN dot_prod_logistic.logistic ELSE 1.0 - dot_prod_logistic.logistic END AS "DecisionProba" 
  FROM dot_prod_logistic