text: -- This SQL code was generated by sklearn2sql (development version).
  -- Copyright 2018
  
  -- Model : KerasClassifier_Dense
  -- Dataset : FourClass_10
  -- 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`, `ADS`.`Feature_4` AS `Feature_4`, `ADS`.`Feature_5` AS `Feature_5`, `ADS`.`Feature_6` AS `Feature_6`, `ADS`.`Feature_7` AS `Feature_7`, `ADS`.`Feature_8` AS `Feature_8`, `ADS`.`Feature_9` AS `Feature_9` 
  FROM `FourClass_10` 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`, keras_input.`Feature_4` AS `Feature_4`, keras_input.`Feature_5` AS `Feature_5`, keras_input.`Feature_6` AS `Feature_6`, keras_input.`Feature_7` AS `Feature_7`, keras_input.`Feature_8` AS `Feature_8`, keras_input.`Feature_9` AS `Feature_9` 
  FROM keras_input), 
  layer_dense_1 AS 
  (SELECT keras_input_1.`KEY` AS `KEY`, -0.1480417749782249 + 0.07485868575541564 * keras_input_1.`Feature_0` + -0.40802406758678567 * keras_input_1.`Feature_1` + -0.4270554786725818 * keras_input_1.`Feature_2` + 0.196600443819846 * keras_input_1.`Feature_3` + -0.10005940601981077 * keras_input_1.`Feature_4` + -0.5304417646157654 * keras_input_1.`Feature_5` + -0.17319608591766206 * keras_input_1.`Feature_6` + -0.43411446392210706 * keras_input_1.`Feature_7` + 0.3479517778372388 * keras_input_1.`Feature_8` + -0.0021247847785523088 * keras_input_1.`Feature_9` AS output_1, -0.10648004094572186 + 0.3345898743103192 * keras_input_1.`Feature_0` + 0.5030063950489382 * keras_input_1.`Feature_1` + 0.044971990473592204 * keras_input_1.`Feature_2` + 0.5313610349718573 * keras_input_1.`Feature_3` + 0.06113768212903604 * keras_input_1.`Feature_4` + -0.2000112548342832 * keras_input_1.`Feature_5` + 0.2704188803519482 * keras_input_1.`Feature_6` + 0.33114045231032524 * keras_input_1.`Feature_7` + -0.30844524630954223 * keras_input_1.`Feature_8` + 0.025567196194920032 * keras_input_1.`Feature_9` AS output_2, -0.2028982322278591 + -0.28250648710748294 * keras_input_1.`Feature_0` + 0.4255255646758933 * keras_input_1.`Feature_1` + -0.38505002036762725 * keras_input_1.`Feature_2` + -0.43164339781165567 * keras_input_1.`Feature_3` + 0.1895645016898361 * keras_input_1.`Feature_4` + 0.21949052593896462 * keras_input_1.`Feature_5` + -0.6746461950567704 * keras_input_1.`Feature_6` + 0.06610338849699805 * keras_input_1.`Feature_7` + -0.21561891897391447 * keras_input_1.`Feature_8` + -0.03428307124554215 * keras_input_1.`Feature_9` AS output_3, -0.1602249746482944 + -0.10563879539216353 * keras_input_1.`Feature_0` + -0.18822101051722617 * keras_input_1.`Feature_1` + -0.10945497992572244 * keras_input_1.`Feature_2` + -0.1831483077647948 * keras_input_1.`Feature_3` + 0.5621055426689485 * keras_input_1.`Feature_4` + -0.14714455380770458 * keras_input_1.`Feature_5` + 0.5600247173244115 * keras_input_1.`Feature_6` + 0.5879492872833757 * keras_input_1.`Feature_7` + 0.17285938817255692 * keras_input_1.`Feature_8` + -0.3530348849531315 * keras_input_1.`Feature_9` 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.09922502191724379 + 0.405573943791053 * activation_relu_1_1.output_1 + -0.23407008668746765 * activation_relu_1_1.output_2 + 0.4172299777337623 * activation_relu_1_1.output_3 + 0.200332479798496 * activation_relu_1_1.output_4 AS output_1, 0.004647752920688322 + -1.0240070266879584 * activation_relu_1_1.output_1 + 0.8027828587320077 * activation_relu_1_1.output_2 + -0.008990551488525718 * activation_relu_1_1.output_3 + -0.746328834622197 * activation_relu_1_1.output_4 AS output_2, 0.13093990850863282 + -0.3046504695311623 * activation_relu_1_1.output_1 + 0.48610753356008624 * activation_relu_1_1.output_2 + -0.367687142341915 * activation_relu_1_1.output_3 + -0.3789438773533954 * activation_relu_1_1.output_4 AS output_3, -0.04353743266794793 + -0.48346542725315417 * activation_relu_1_1.output_1 + 0.5460901952364464 * activation_relu_1_1.output_2 + 0.6625291800986723 * activation_relu_1_1.output_3 + -0.07372231096925856 * activation_relu_1_1.output_4 AS output_4 
  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, layer_dense_2.output_4 AS output_4 
  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`, layer_dense_2_1.output_4 AS `Score_3`, exp(least(100.0, greatest(-100.0, layer_dense_2_1.output_4))) AS `exp_Score_3` 
  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 UNION ALL SELECT score_soft_max_step1.`KEY` AS `KEY`, 3 AS class, score_soft_max_step1.`exp_Score_3` 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`, score_soft_max_step1.`Score_3` AS `Score_3`, score_soft_max_step1.`exp_Score_3` AS `exp_Score_3`, 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, score_soft_max.`exp_Score_3` / score_soft_max.`sum_ExpScore` AS output_4 
  FROM score_soft_max), 
  orig_cte AS 
  (SELECT layer_softmax.`KEY` AS `KEY`, NULL AS `Score_0`, NULL AS `Score_1`, NULL AS `Score_2`, NULL AS `Score_3`, layer_softmax.output_1 AS `Proba_0`, layer_softmax.output_2 AS `Proba_1`, layer_softmax.output_3 AS `Proba_2`, layer_softmax.output_4 AS `Proba_3`, NULL AS `LogProba_0`, NULL AS `LogProba_1`, NULL AS `LogProba_2`, NULL AS `LogProba_3`, 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`, 0 AS class, orig_cte.`LogProba_0` AS `LogProba`, orig_cte.`Proba_0` AS `Proba`, orig_cte.`Score_0` AS `Score` 
  FROM orig_cte UNION ALL SELECT orig_cte.`KEY` AS `KEY_u`, 1 AS class, orig_cte.`LogProba_1` AS `LogProba`, orig_cte.`Proba_1` AS `Proba`, orig_cte.`Score_1` AS `Score` 
  FROM orig_cte UNION ALL SELECT orig_cte.`KEY` AS `KEY_u`, 2 AS class, orig_cte.`LogProba_2` AS `LogProba`, orig_cte.`Proba_2` AS `Proba`, orig_cte.`Score_2` AS `Score` 
  FROM orig_cte UNION ALL SELECT orig_cte.`KEY` AS `KEY_u`, 3 AS class, orig_cte.`LogProba_3` AS `LogProba`, orig_cte.`Proba_3` AS `Proba`, orig_cte.`Score_3` AS `Score` 
  FROM orig_cte) AS scu), 
  score_max AS 
  (SELECT orig_cte.`KEY` AS `KEY`, orig_cte.`Score_0` AS `Score_0`, orig_cte.`Score_1` AS `Score_1`, orig_cte.`Score_2` AS `Score_2`, orig_cte.`Score_3` AS `Score_3`, orig_cte.`Proba_0` AS `Proba_0`, orig_cte.`Proba_1` AS `Proba_1`, orig_cte.`Proba_2` AS `Proba_2`, orig_cte.`Proba_3` AS `Proba_3`, orig_cte.`LogProba_0` AS `LogProba_0`, orig_cte.`LogProba_1` AS `LogProba_1`, orig_cte.`LogProba_2` AS `LogProba_2`, orig_cte.`LogProba_3` AS `LogProba_3`, 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_0` AS `Score_0`, score_max.`Score_1` AS `Score_1`, score_max.`Score_2` AS `Score_2`, score_max.`Score_3` AS `Score_3`, score_max.`Proba_0` AS `Proba_0`, score_max.`Proba_1` AS `Proba_1`, score_max.`Proba_2` AS `Proba_2`, score_max.`Proba_3` AS `Proba_3`, score_max.`LogProba_0` AS `LogProba_0`, score_max.`LogProba_1` AS `LogProba_1`, score_max.`LogProba_2` AS `LogProba_2`, score_max.`LogProba_3` AS `LogProba_3`, 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_0` AS `Score_0`, score_max.`Score_1` AS `Score_1`, score_max.`Score_2` AS `Score_2`, score_max.`Score_3` AS `Score_3`, score_max.`Proba_0` AS `Proba_0`, score_max.`Proba_1` AS `Proba_1`, score_max.`Proba_2` AS `Proba_2`, score_max.`Proba_3` AS `Proba_3`, score_max.`LogProba_0` AS `LogProba_0`, score_max.`LogProba_1` AS `LogProba_1`, score_max.`LogProba_2` AS `LogProba_2`, score_max.`LogProba_3` AS `LogProba_3`, 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_0` AS `Score_0`, arg_max_cte.`Score_1` AS `Score_1`, arg_max_cte.`Score_2` AS `Score_2`, arg_max_cte.`Score_3` AS `Score_3`, arg_max_cte.`Proba_0` AS `Proba_0`, arg_max_cte.`Proba_1` AS `Proba_1`, arg_max_cte.`Proba_2` AS `Proba_2`, arg_max_cte.`Proba_3` AS `Proba_3`, CASE WHEN (arg_max_cte.`Proba_0` IS NULL OR arg_max_cte.`Proba_0` > 0.0) THEN ln(arg_max_cte.`Proba_0`) ELSE -1.79769313486231e+308 END AS `LogProba_0`, CASE WHEN (arg_max_cte.`Proba_1` IS NULL OR arg_max_cte.`Proba_1` > 0.0) THEN ln(arg_max_cte.`Proba_1`) ELSE -1.79769313486231e+308 END AS `LogProba_1`, CASE WHEN (arg_max_cte.`Proba_2` IS NULL OR arg_max_cte.`Proba_2` > 0.0) THEN ln(arg_max_cte.`Proba_2`) ELSE -1.79769313486231e+308 END AS `LogProba_2`, CASE WHEN (arg_max_cte.`Proba_3` IS NULL OR arg_max_cte.`Proba_3` > 0.0) THEN ln(arg_max_cte.`Proba_3`) ELSE -1.79769313486231e+308 END AS `LogProba_3`, arg_max_cte.`arg_max_Proba` AS `Decision`, arg_max_cte.`max_Proba` AS `DecisionProba` 
  FROM arg_max_cte