text: -- This SQL code was generated by sklearn2sql (development version).
  -- Copyright 2018
  
  -- Model : KerasClassifier_Dense
  -- Dataset : iris_date_tgt
  -- Database : mysql
  
  
  -- This SQL code can contain one or more statements, to be executed in the order they appear in this file.
  
  
  
  -- Model deployment code
  
  WITH keras_input AS 
  (SELECT `ADS`.`KEY` AS `KEY`, `ADS`.`Feature_0` AS `Feature_0`, `ADS`.`Feature_1` AS `Feature_1`, `ADS`.`Feature_2` AS `Feature_2`, `ADS`.`Feature_3` AS `Feature_3` 
  FROM iris_date_tgt AS `ADS`), 
  keras_input_1 AS 
  (SELECT keras_input.`KEY` AS `KEY`, keras_input.`Feature_0` AS `Feature_0`, keras_input.`Feature_1` AS `Feature_1`, keras_input.`Feature_2` AS `Feature_2`, keras_input.`Feature_3` AS `Feature_3` 
  FROM keras_input), 
  layer_dense_1 AS 
  (SELECT keras_input_1.`KEY` AS `KEY`, 0.0 + -0.11281444952672026 * keras_input_1.`Feature_0` + -0.6290437167939718 * keras_input_1.`Feature_1` + -0.68533367483761 * keras_input_1.`Feature_2` + 0.09062090724345317 * keras_input_1.`Feature_3` AS output_1, -0.43897317836840916 + 0.2311617084325953 * keras_input_1.`Feature_0` + -0.0686736376780214 * keras_input_1.`Feature_1` + -0.10945067096837464 * keras_input_1.`Feature_2` + 0.5378567204889299 * keras_input_1.`Feature_3` AS output_2, 0.0 + -0.5357525615511114 * keras_input_1.`Feature_0` + 0.4315035234678404 * keras_input_1.`Feature_1` + -0.7939947958188902 * keras_input_1.`Feature_2` + -0.8410838228616502 * keras_input_1.`Feature_3` AS output_3, 0.0 + -0.32287987074367663 * keras_input_1.`Feature_0` + -0.11664781485514286 * keras_input_1.`Feature_1` + -0.30826797999578026 * keras_input_1.`Feature_2` + -0.3120039953711615 * keras_input_1.`Feature_3` AS output_4 
  FROM keras_input_1), 
  activation_relu AS 
  (SELECT layer_dense_1.`KEY` AS `KEY`, greatest(layer_dense_1.output_1, 0) AS output_1, greatest(layer_dense_1.output_2, 0) AS output_2, greatest(layer_dense_1.output_3, 0) AS output_3, greatest(layer_dense_1.output_4, 0) AS output_4 
  FROM layer_dense_1), 
  activation_relu_1 AS 
  (SELECT activation_relu.`KEY` AS `KEY`, activation_relu.output_1 AS output_1, activation_relu.output_2 AS output_2, activation_relu.output_3 AS output_3, activation_relu.output_4 AS output_4 
  FROM activation_relu), 
  activation_relu_1_1 AS 
  (SELECT activation_relu_1.`KEY` AS `KEY`, activation_relu_1.output_1 AS output_1, activation_relu_1.output_2 AS output_2, activation_relu_1.output_3 AS output_3, activation_relu_1.output_4 AS output_4 
  FROM activation_relu_1), 
  layer_dense_2 AS 
  (SELECT activation_relu_1_1.`KEY` AS `KEY`, 0.2636804705078169 + 0.6305062762098601 * activation_relu_1_1.output_1 + -0.3585050786223678 * activation_relu_1_1.output_2 + 0.5741738380977317 * activation_relu_1_1.output_3 + 0.07926929534297522 * activation_relu_1_1.output_4 AS output_1, 0.22823185554454842 + -0.7566051101956481 * activation_relu_1_1.output_1 + -0.13546549302115693 * activation_relu_1_1.output_2 + 0.60860151581279 * activation_relu_1_1.output_3 + -0.6083992426049094 * activation_relu_1_1.output_4 AS output_2, -0.37239300543420456 + -0.5296362740553289 * activation_relu_1_1.output_1 + 0.5671583278012485 * activation_relu_1_1.output_2 + 0.5610256732633128 * activation_relu_1_1.output_3 + 0.8782704380577033 * activation_relu_1_1.output_4 AS output_3 
  FROM activation_relu_1_1), 
  layer_dense_2_1 AS 
  (SELECT layer_dense_2.`KEY` AS `KEY`, layer_dense_2.output_1 AS output_1, layer_dense_2.output_2 AS output_2, layer_dense_2.output_3 AS output_3 
  FROM layer_dense_2), 
  score_soft_max_step1 AS 
  (SELECT layer_dense_2_1.`KEY` AS `KEY`, layer_dense_2_1.output_1 AS `Score_0`, exp(least(100.0, greatest(-100.0, layer_dense_2_1.output_1))) AS `exp_Score_0`, layer_dense_2_1.output_2 AS `Score_1`, exp(least(100.0, greatest(-100.0, layer_dense_2_1.output_2))) AS `exp_Score_1`, layer_dense_2_1.output_3 AS `Score_2`, exp(least(100.0, greatest(-100.0, layer_dense_2_1.output_3))) AS `exp_Score_2` 
  FROM layer_dense_2_1), 
  score_class_union_soft AS 
  (SELECT soft_scu.`KEY` AS `KEY`, soft_scu.class AS class, soft_scu.`exp_Score` AS `exp_Score` 
  FROM (SELECT score_soft_max_step1.`KEY` AS `KEY`, 0 AS class, score_soft_max_step1.`exp_Score_0` AS `exp_Score` 
  FROM score_soft_max_step1 UNION ALL SELECT score_soft_max_step1.`KEY` AS `KEY`, 1 AS class, score_soft_max_step1.`exp_Score_1` AS `exp_Score` 
  FROM score_soft_max_step1 UNION ALL SELECT score_soft_max_step1.`KEY` AS `KEY`, 2 AS class, score_soft_max_step1.`exp_Score_2` AS `exp_Score` 
  FROM score_soft_max_step1) AS soft_scu), 
  score_soft_max AS 
  (SELECT score_soft_max_step1.`KEY` AS `KEY`, score_soft_max_step1.`Score_0` AS `Score_0`, score_soft_max_step1.`exp_Score_0` AS `exp_Score_0`, score_soft_max_step1.`Score_1` AS `Score_1`, score_soft_max_step1.`exp_Score_1` AS `exp_Score_1`, score_soft_max_step1.`Score_2` AS `Score_2`, score_soft_max_step1.`exp_Score_2` AS `exp_Score_2`, sum_exp_t.`KEY_sum` AS `KEY_sum`, sum_exp_t.`sum_ExpScore` AS `sum_ExpScore` 
  FROM score_soft_max_step1 LEFT OUTER JOIN (SELECT score_class_union_soft.`KEY` AS `KEY_sum`, sum(score_class_union_soft.`exp_Score`) AS `sum_ExpScore` 
  FROM score_class_union_soft GROUP BY score_class_union_soft.`KEY`) AS sum_exp_t ON score_soft_max_step1.`KEY` = sum_exp_t.`KEY_sum`), 
  layer_softmax AS 
  (SELECT score_soft_max.`KEY` AS `KEY`, score_soft_max.`exp_Score_0` / score_soft_max.`sum_ExpScore` AS output_1, score_soft_max.`exp_Score_1` / score_soft_max.`sum_ExpScore` AS output_2, score_soft_max.`exp_Score_2` / score_soft_max.`sum_ExpScore` AS output_3 
  FROM score_soft_max), 
  orig_cte AS 
  (SELECT layer_softmax.`KEY` AS `KEY`, NULL AS `Score_1789-07-14T00:00:00.000000000`, NULL AS `Score_1789-08-14T00:00:00.000000000`, NULL AS `Score_1789-09-14T00:00:00.000000000`, layer_softmax.output_1 AS `Proba_1789-07-14T00:00:00.000000000`, layer_softmax.output_2 AS `Proba_1789-08-14T00:00:00.000000000`, layer_softmax.output_3 AS `Proba_1789-09-14T00:00:00.000000000`, NULL AS `LogProba_1789-07-14T00:00:00.000000000`, NULL AS `LogProba_1789-08-14T00:00:00.000000000`, NULL AS `LogProba_1789-09-14T00:00:00.000000000`, CAST(NULL AS SIGNED INTEGER) AS `Decision`, NULL AS `DecisionProba` 
  FROM layer_softmax), 
  score_class_union AS 
  (SELECT scu.`KEY_u` AS `KEY_u`, scu.class AS class, scu.`LogProba` AS `LogProba`, scu.`Proba` AS `Proba`, scu.`Score` AS `Score` 
  FROM (SELECT orig_cte.`KEY` AS `KEY_u`, '1789-07-14T00:00:00.000000000' AS class, orig_cte.`LogProba_1789-07-14T00:00:00.000000000` AS `LogProba`, orig_cte.`Proba_1789-07-14T00:00:00.000000000` AS `Proba`, orig_cte.`Score_1789-07-14T00:00:00.000000000` AS `Score` 
  FROM orig_cte UNION ALL SELECT orig_cte.`KEY` AS `KEY_u`, '1789-08-14T00:00:00.000000000' AS class, orig_cte.`LogProba_1789-08-14T00:00:00.000000000` AS `LogProba`, orig_cte.`Proba_1789-08-14T00:00:00.000000000` AS `Proba`, orig_cte.`Score_1789-08-14T00:00:00.000000000` AS `Score` 
  FROM orig_cte UNION ALL SELECT orig_cte.`KEY` AS `KEY_u`, '1789-09-14T00:00:00.000000000' AS class, orig_cte.`LogProba_1789-09-14T00:00:00.000000000` AS `LogProba`, orig_cte.`Proba_1789-09-14T00:00:00.000000000` AS `Proba`, orig_cte.`Score_1789-09-14T00:00:00.000000000` AS `Score` 
  FROM orig_cte) AS scu), 
  score_max AS 
  (SELECT orig_cte.`KEY` AS `KEY`, orig_cte.`Score_1789-07-14T00:00:00.000000000` AS `Score_1789-07-14T00:00:00.000000000`, orig_cte.`Score_1789-08-14T00:00:00.000000000` AS `Score_1789-08-14T00:00:00.000000000`, orig_cte.`Score_1789-09-14T00:00:00.000000000` AS `Score_1789-09-14T00:00:00.000000000`, orig_cte.`Proba_1789-07-14T00:00:00.000000000` AS `Proba_1789-07-14T00:00:00.000000000`, orig_cte.`Proba_1789-08-14T00:00:00.000000000` AS `Proba_1789-08-14T00:00:00.000000000`, orig_cte.`Proba_1789-09-14T00:00:00.000000000` AS `Proba_1789-09-14T00:00:00.000000000`, orig_cte.`LogProba_1789-07-14T00:00:00.000000000` AS `LogProba_1789-07-14T00:00:00.000000000`, orig_cte.`LogProba_1789-08-14T00:00:00.000000000` AS `LogProba_1789-08-14T00:00:00.000000000`, orig_cte.`LogProba_1789-09-14T00:00:00.000000000` AS `LogProba_1789-09-14T00:00:00.000000000`, orig_cte.`Decision` AS `Decision`, orig_cte.`DecisionProba` AS `DecisionProba`, max_select.`KEY_m` AS `KEY_m`, max_select.`max_Proba` AS `max_Proba` 
  FROM orig_cte LEFT OUTER JOIN (SELECT score_class_union.`KEY_u` AS `KEY_m`, max(score_class_union.`Proba`) AS `max_Proba` 
  FROM score_class_union GROUP BY score_class_union.`KEY_u`) AS max_select ON orig_cte.`KEY` = max_select.`KEY_m`), 
  union_with_max AS 
  (SELECT score_class_union.`KEY_u` AS `KEY_u`, score_class_union.class AS class, score_class_union.`LogProba` AS `LogProba`, score_class_union.`Proba` AS `Proba`, score_class_union.`Score` AS `Score`, score_max.`KEY` AS `KEY`, score_max.`Score_1789-07-14T00:00:00.000000000` AS `Score_1789-07-14T00:00:00.000000000`, score_max.`Score_1789-08-14T00:00:00.000000000` AS `Score_1789-08-14T00:00:00.000000000`, score_max.`Score_1789-09-14T00:00:00.000000000` AS `Score_1789-09-14T00:00:00.000000000`, score_max.`Proba_1789-07-14T00:00:00.000000000` AS `Proba_1789-07-14T00:00:00.000000000`, score_max.`Proba_1789-08-14T00:00:00.000000000` AS `Proba_1789-08-14T00:00:00.000000000`, score_max.`Proba_1789-09-14T00:00:00.000000000` AS `Proba_1789-09-14T00:00:00.000000000`, score_max.`LogProba_1789-07-14T00:00:00.000000000` AS `LogProba_1789-07-14T00:00:00.000000000`, score_max.`LogProba_1789-08-14T00:00:00.000000000` AS `LogProba_1789-08-14T00:00:00.000000000`, score_max.`LogProba_1789-09-14T00:00:00.000000000` AS `LogProba_1789-09-14T00:00:00.000000000`, score_max.`Decision` AS `Decision`, score_max.`DecisionProba` AS `DecisionProba`, score_max.`KEY_m` AS `KEY_m`, score_max.`max_Proba` AS `max_Proba` 
  FROM score_class_union LEFT OUTER JOIN score_max ON score_class_union.`KEY_u` = score_max.`KEY`), 
  arg_max_cte AS 
  (SELECT score_max.`KEY` AS `KEY`, score_max.`Score_1789-07-14T00:00:00.000000000` AS `Score_1789-07-14T00:00:00.000000000`, score_max.`Score_1789-08-14T00:00:00.000000000` AS `Score_1789-08-14T00:00:00.000000000`, score_max.`Score_1789-09-14T00:00:00.000000000` AS `Score_1789-09-14T00:00:00.000000000`, score_max.`Proba_1789-07-14T00:00:00.000000000` AS `Proba_1789-07-14T00:00:00.000000000`, score_max.`Proba_1789-08-14T00:00:00.000000000` AS `Proba_1789-08-14T00:00:00.000000000`, score_max.`Proba_1789-09-14T00:00:00.000000000` AS `Proba_1789-09-14T00:00:00.000000000`, score_max.`LogProba_1789-07-14T00:00:00.000000000` AS `LogProba_1789-07-14T00:00:00.000000000`, score_max.`LogProba_1789-08-14T00:00:00.000000000` AS `LogProba_1789-08-14T00:00:00.000000000`, score_max.`LogProba_1789-09-14T00:00:00.000000000` AS `LogProba_1789-09-14T00:00:00.000000000`, score_max.`Decision` AS `Decision`, score_max.`DecisionProba` AS `DecisionProba`, score_max.`KEY_m` AS `KEY_m`, score_max.`max_Proba` AS `max_Proba`, `arg_max_t_Proba`.`KEY_Proba` AS `KEY_Proba`, `arg_max_t_Proba`.`arg_max_Proba` AS `arg_max_Proba` 
  FROM score_max LEFT OUTER JOIN (SELECT union_with_max.`KEY` AS `KEY_Proba`, max(union_with_max.class) AS `arg_max_Proba` 
  FROM union_with_max 
  WHERE union_with_max.`max_Proba` <= union_with_max.`Proba` GROUP BY union_with_max.`KEY`) AS `arg_max_t_Proba` ON score_max.`KEY` = `arg_max_t_Proba`.`KEY_Proba`)
   SELECT arg_max_cte.`KEY` AS `KEY`, arg_max_cte.`Score_1789-07-14T00:00:00.000000000` AS `Score_1789-07-14T00:00:00.000000000`, arg_max_cte.`Score_1789-08-14T00:00:00.000000000` AS `Score_1789-08-14T00:00:00.000000000`, arg_max_cte.`Score_1789-09-14T00:00:00.000000000` AS `Score_1789-09-14T00:00:00.000000000`, arg_max_cte.`Proba_1789-07-14T00:00:00.000000000` AS `Proba_1789-07-14T00:00:00.000000000`, arg_max_cte.`Proba_1789-08-14T00:00:00.000000000` AS `Proba_1789-08-14T00:00:00.000000000`, arg_max_cte.`Proba_1789-09-14T00:00:00.000000000` AS `Proba_1789-09-14T00:00:00.000000000`, CASE WHEN (arg_max_cte.`Proba_1789-07-14T00:00:00.000000000` IS NULL OR arg_max_cte.`Proba_1789-07-14T00:00:00.000000000` > 0.0) THEN ln(arg_max_cte.`Proba_1789-07-14T00:00:00.000000000`) ELSE -1.79769313486231e+308 END AS `LogProba_1789-07-14T00:00:00.000000000`, CASE WHEN (arg_max_cte.`Proba_1789-08-14T00:00:00.000000000` IS NULL OR arg_max_cte.`Proba_1789-08-14T00:00:00.000000000` > 0.0) THEN ln(arg_max_cte.`Proba_1789-08-14T00:00:00.000000000`) ELSE -1.79769313486231e+308 END AS `LogProba_1789-08-14T00:00:00.000000000`, CASE WHEN (arg_max_cte.`Proba_1789-09-14T00:00:00.000000000` IS NULL OR arg_max_cte.`Proba_1789-09-14T00:00:00.000000000` > 0.0) THEN ln(arg_max_cte.`Proba_1789-09-14T00:00:00.000000000`) ELSE -1.79769313486231e+308 END AS `LogProba_1789-09-14T00:00:00.000000000`, arg_max_cte.`arg_max_Proba` AS `Decision`, arg_max_cte.`max_Proba` AS `DecisionProba` 
  FROM arg_max_cte