- Notifications
You must be signed in to change notification settings - Fork 849
/
Copy pathOML4SQL Classification NB.dsnb
executable file
·1 lines (1 loc) · 46.4 KB
/
OML4SQL Classification NB.dsnb
1
[{"layout":null,"template":null,"templateConfig":null,"name":"OML4SQL Classification NB","description":null,"readOnly":false,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":null,"message":[],"enabled":true,"result":{"startTime":1715349766885,"interpreter":"md.low","endTime":1715349766977,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":true,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","# Classification Modeling to Predict Target Customers using Naive Bayes","","In this notebook, we predict customers most likely to be positive responders to an Affinity Card loyalty program. High Affinity Card responders (target value = 1) are defined as those customers who when given a loyaly or affinity card hyper-respond i.e. they increae their purchasing higher than the Affinity Card program's offered discount percentage. This notebook builds and applies classification naive bayes models using the SH schema data. All processing occurs inside Oracle Autonomous Database.","","Copyright (c) 2024 Oracle Corporation ","###### <a href=\"https://oss.oracle.com/licenses/upl/\" onclick=\"return ! window.open('https://oss.oracle.com/licenses/upl/');\">The Universal Permissive License (UPL), Version 1.0<\/a>","---"],"enabled":true,"result":{"startTime":1715349767090,"interpreter":"md.low","endTime":1715349767154,"results":[{"message":"<h1 id=\"classification-modeling-to-predict-target-customers-using-naive-bayes\">Classification Modeling to Predict Target Customers using Naive Bayes<\/h1>\n<p>In this notebook, we predict customers most likely to be positive responders to an Affinity Card loyalty program. High Affinity Card responders (target value = 1) are defined as those customers who when given a loyaly or affinity card hyper-respond i.e. they increae their purchasing higher than the Affinity Card program's offered discount percentage. This notebook builds and applies classification naive bayes models using the SH schema data. All processing occurs inside Oracle Autonomous Database.<\/p>\n<p>Copyright (c) 2024 Oracle Corporation<\/p>\n<h6 id=\"the-universal-permissive-license-upl-version-10\"><a href=\"https://oss.oracle.com/licenses/upl/\" onclick=\"return ! window.open('https://oss.oracle.com/licenses/upl/');\">The Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n<hr />\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":9,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","<dl>","<img src=\"http://www.oracle.com/technetwork/database/options/advanced-analytics/classification-5663162.jpg\" alt=\"OML Notebooks\" width=\"250\"/>","<\/dl>"],"enabled":true,"result":{"startTime":1715349767231,"interpreter":"md.low","endTime":1715349767309,"results":[{"message":"<dl>\n<img src=\"http://www.oracle.com/technetwork/database/options/advanced-analytics/classification-5663162.jpg\" alt=\"OML Notebooks\" width=\"250\"/>\n<\/dl>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":3,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"For more information...","message":["%md","","* <a href=\"https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/index.html\" target=\"_blank\">Oracle ADW Documentation<\/a>","* <a href=\"https://github.com/oracle/oracle-db-examples/tree/master/machine-learning\" target=\"_blank\">OML folder on Oracle Github<\/a>","* <a href=\"https://www.oracle.com/machine-learning\" target=\"_blank\">OML web page<\/a>","* <a href=\"https://www.oracle.com/goto/ml-classification\" target=\"_blank\">OML Classification<\/a>","* <a href=\"https://oracle.com/goto/ml-naive-bayes\" target=\"_blank\">OML Naive Bayes<\/a>"],"enabled":true,"result":{"startTime":1715349767385,"interpreter":"md.low","endTime":1715349767457,"results":[{"message":"<ul>\n<li><a href=\"https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/index.html\" target=\"_blank\">Oracle ADW Documentation<\/a><\/li>\n<li><a href=\"https://github.com/oracle/oracle-db-examples/tree/master/machine-learning\" target=\"_blank\">OML folder on Oracle Github<\/a><\/li>\n<li><a href=\"https://www.oracle.com/machine-learning\" target=\"_blank\">OML web page<\/a><\/li>\n<li><a href=\"https://www.oracle.com/goto/ml-classification\" target=\"_blank\">OML Classification<\/a><\/li>\n<li><a href=\"https://oracle.com/goto/ml-naive-bayes\" target=\"_blank\">OML Naive Bayes<\/a><\/li>\n<\/ul>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display a few rows of the demographics data ","message":["%sql","","SELECT * ","FROM SH.SUPPLEMENTARY_DEMOGRAPHICS","FETCH FIRST 10 ROWS ONLY;"],"enabled":true,"result":{"startTime":1715349767532,"interpreter":"sql.low","endTime":1715349769132,"results":[{"message":"CUST_ID\tEDUCATION\tOCCUPATION\tHOUSEHOLD_SIZE\tYRS_RESIDENCE\tAFFINITY_CARD\tBULK_PACK_DISKETTES\tFLAT_PANEL_MONITOR\tHOME_THEATER_PACKAGE\tBOOKKEEPING_APPLICATION\tPRINTER_SUPPLIES\tY_BOX_GAMES\tOS_DOC_SET_KANJI\tCOMMENTS\n102547\t10th\tOther\t1\t0\t0\t1\t1\t0\t0\t1\t1\t0\t\n101050\t10th\tOther\t1\t0\t0\t1\t1\t0\t0\t1\t1\t0\t\n100040\t11th\tSales\t1\t0\t0\t1\t1\t0\t0\t1\t1\t0\t\n102117\tHS-grad\tFarming\t1\t0\t0\t0\t0\t0\t1\t1\t1\t0\t\n101074\t10th\tHandler\t1\t1\t0\t1\t1\t0\t0\t1\t1\t0\t\n104179\t10th\tHandler\t1\t1\t0\t1\t1\t0\t0\t1\t1\t0\t\n100417\t11th\tHandler\t1\t1\t0\t0\t0\t0\t0\t1\t1\t0\t\n101146\t< Bach.\t?\t1\t1\t0\t1\t1\t0\t1\t1\t1\t0\t\n103420\t< Bach.\t?\t1\t1\t0\t1\t1\t0\t1\t1\t1\t0\t\n101987\t< Bach.\tOther\t1\t1\t0\t1\t1\t0\t1\t1\t1\t0\t\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Count number of records in demographics table","message":["%sql","","SELECT COUNT(*) FROM SH.SUPPLEMENTARY_DEMOGRAPHICS;"],"enabled":true,"result":{"startTime":1715349769210,"interpreter":"sql.low","endTime":1715349769398,"results":[{"message":"COUNT(*)\n4500\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"bar\":{\"showSeries\":[\"COUNT\"],\"series\":{\"availableSeriesElements\":[{\"id\":\"COUNT\",\"lineType\":\"straight\",\"borderColor\":\"rgb(25, 95, 116)\",\"borderWidth\":0,\"color\":\"rgb(25, 95, 116)\",\"pattern\":\"auto\",\"markerColor\":\"rgb(25, 95, 116)\",\"markerDisplayed\":\"auto\",\"markerShape\":\"auto\",\"markerSize\":0}]},\"lastColumns\":[\"AFFINITY_CARD\",\"COUNT\"],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"bar","title":"Show distribution of AFFINITY_CARD responders","message":["%sql","","-- In this data set, hyper-responders to the Affinity Card loyalty program are represented as 1's. ","","SELECT AFFINITY_CARD, COUNT(*) COUNT","FROM SH.SUPPLEMENTARY_DEMOGRAPHICS","GROUP BY AFFINITY_CARD;"],"enabled":true,"result":{"startTime":1715349769492,"interpreter":"sql.low","endTime":1715349769567,"results":[{"message":"AFFINITY_CARD\tCOUNT\n1\t1072\n0\t3428\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"table\":{\"version\":1},\"bar\":{\"groupByColumns\":[\"AFFINITY_CARD\",\"HOUSEHOLD_SIZE\"],\"visualizations\":{\"stackValue\":\"on\"},\"series\":{\"availableSeriesElements\":[{\"id\":\"NUM_CUSTOMERS\",\"lineType\":\"straight\",\"borderColor\":\"rgb(25, 95, 116)\",\"borderWidth\":0,\"color\":\"rgb(25, 95, 116)\",\"pattern\":\"auto\",\"markerColor\":\"rgb(25, 95, 116)\",\"markerDisplayed\":\"auto\",\"markerShape\":\"auto\",\"markerSize\":0}]},\"lastColumns\":[\"NUM_CUSTOMERS\",\"HOUSEHOLD_SIZE\",\"AFFINITY_CARD\"],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"bar","title":"Graph HOUSEHOLD_SIZE grouped by AFFINITY_CARD","message":["%sql","","SELECT COUNT(CUST_ID) AS NUM_CUSTOMERS, HOUSEHOLD_SIZE, AFFINITY_CARD ","FROM SH.SUPPLEMENTARY_DEMOGRAPHICS ","GROUP BY HOUSEHOLD_SIZE, AFFINITY_CARD;"],"enabled":true,"result":{"startTime":1715349769650,"interpreter":"sql.low","endTime":1715349769744,"results":[{"message":"NUM_CUSTOMERS\tHOUSEHOLD_SIZE\tAFFINITY_CARD\n2\t6-8\t1\n1040\t2\t0\n109\t2\t1\n476\t9+\t0\n29\t9+\t1\n814\t3\t1\n107\t4-5\t1\n112\t4-5\t0\n11\t1\t1\n973\t3\t0\n681\t1\t0\n146\t6-8\t0\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"table\":{\"version\":1},\"bar\":{\"showSeries\":[\"AFFINITY_1_COUNT\",\"AFFINITY_0_COUNT\"],\"aggregationOption\":\"Last\",\"visualizations\":{\"stackValue\":\"on\"},\"series\":{\"availableSeriesElements\":[{\"id\":\"AFFINITY_1_COUNT\",\"lineType\":\"straight\",\"borderColor\":\"rgb(25, 95, 116)\",\"borderWidth\":0,\"color\":\"rgb(25, 95, 116)\",\"pattern\":\"auto\",\"markerColor\":\"rgb(25, 95, 116)\",\"markerDisplayed\":\"auto\",\"markerShape\":\"auto\",\"markerSize\":0},{\"id\":\"AFFINITY_0_COUNT\",\"lineType\":\"straight\",\"borderColor\":\"rgb(50, 146, 94)\",\"borderWidth\":0,\"color\":\"rgb(50, 146, 94)\",\"pattern\":\"auto\",\"markerColor\":\"rgb(50, 146, 94)\",\"markerDisplayed\":\"auto\",\"markerShape\":\"auto\",\"markerSize\":0}]},\"lastColumns\":[\"HOUSEHOLD_SIZE\",\"AFFINITY_1_COUNT\",\"AFFINITY_0_COUNT\"],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"bar","title":"Graph HOUSEHOLD_SIZE grouped by AFFINITY_CARD","message":["%sql","","SELECT HOUSEHOLD_SIZE,"," SUM(CASE WHEN AFFINITY_CARD = 1 THEN NUM_CUSTOMERS ELSE 0 END) AS AFFINITY_1_COUNT,"," SUM(CASE WHEN AFFINITY_CARD = 0 THEN NUM_CUSTOMERS ELSE 0 END) AS AFFINITY_0_COUNT","FROM (SELECT COUNT(CUST_ID) AS NUM_CUSTOMERS, HOUSEHOLD_SIZE, AFFINITY_CARD "," FROM SH.SUPPLEMENTARY_DEMOGRAPHICS "," GROUP BY HOUSEHOLD_SIZE, AFFINITY_CARD)","GROUP BY HOUSEHOLD_SIZE","ORDER BY HOUSEHOLD_SIZE"],"enabled":true,"result":{"startTime":1715349769824,"interpreter":"sql.low","endTime":1715349769905,"results":[{"message":"HOUSEHOLD_SIZE\tAFFINITY_1_COUNT\tAFFINITY_0_COUNT\n1\t11\t681\n2\t109\t1040\n3\t814\t973\n4-5\t107\t112\n6-8\t2\t146\n9+\t29\t476\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Create view with selected demographics columns","message":["%script","","CREATE OR REPLACE VIEW DEMOGRAPHICS4_V "," AS SELECT AFFINITY_CARD, CUST_ID, BOOKKEEPING_APPLICATION,BULK_PACK_DISKETTES, EDUCATION,"," FLAT_PANEL_MONITOR, HOME_THEATER_PACKAGE,HOUSEHOLD_SIZE, OCCUPATION, OS_DOC_SET_KANJI,"," PRINTER_SUPPLIES, YRS_RESIDENCE, Y_BOX_GAMES"," FROM SH.SUPPLEMENTARY_DEMOGRAPHICS;"," "],"enabled":true,"result":{"startTime":1715349769987,"interpreter":"script.low","endTime":1715349770490,"results":[{"message":"\nView DEMOGRAPHICS4_V created.\n\n\n---------------------------\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display data from DEMOGRAPHICS4_V view","message":["%sql ","","SELECT * ","FROM DEMOGRAPHICS4_V","FETCH FIRST 10 ROWS ONLY;"],"enabled":true,"result":{"startTime":1715349770577,"interpreter":"sql.low","endTime":1715349770676,"results":[{"message":"AFFINITY_CARD\tCUST_ID\tBOOKKEEPING_APPLICATION\tBULK_PACK_DISKETTES\tEDUCATION\tFLAT_PANEL_MONITOR\tHOME_THEATER_PACKAGE\tHOUSEHOLD_SIZE\tOCCUPATION\tOS_DOC_SET_KANJI\tPRINTER_SUPPLIES\tYRS_RESIDENCE\tY_BOX_GAMES\n0\t102547\t0\t1\t10th\t1\t0\t1\tOther\t0\t1\t0\t1\n0\t101050\t0\t1\t10th\t1\t0\t1\tOther\t0\t1\t0\t1\n0\t100040\t0\t1\t11th\t1\t0\t1\tSales\t0\t1\t0\t1\n0\t102117\t1\t0\tHS-grad\t0\t0\t1\tFarming\t0\t1\t0\t1\n0\t101074\t0\t1\t10th\t1\t0\t1\tHandler\t0\t1\t1\t1\n0\t104179\t0\t1\t10th\t1\t0\t1\tHandler\t0\t1\t1\t1\n0\t100417\t0\t0\t11th\t0\t0\t1\tHandler\t0\t1\t1\t1\n0\t101146\t1\t1\t< Bach.\t1\t0\t1\t?\t0\t1\t1\t1\n0\t103420\t1\t1\t< Bach.\t1\t0\t1\t?\t0\t1\t1\t1\n0\t101987\t1\t1\t< Bach.\t1\t0\t1\tOther\t0\t1\t1\t1\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Create train and test data sets (60/40) for model build and test","message":["%script","","CREATE OR REPLACE VIEW TRAIN_DATA_CLAS AS SELECT * FROM DEMOGRAPHICS4_V SAMPLE (60) SEED (1);","CREATE OR REPLACE VIEW TEST_DATA_CLAS AS SELECT * FROM DEMOGRAPHICS4_V MINUS SELECT * FROM TRAIN_DATA_CLAS;"],"enabled":true,"result":{"startTime":1715349770772,"interpreter":"script.low","endTime":1715349770963,"results":[{"message":"\nView TRAIN_DATA_CLAS created.\n\n\n---------------------------\n\nView TEST_DATA_CLAS created.\n\n\n---------------------------\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","### Build a Naive Bayes model for predicting AFFINITY_CARD","","---"],"enabled":true,"result":{"startTime":1715349771067,"interpreter":"md.low","endTime":1715349771132,"results":[{"message":"<h3 id=\"build-a-naive-bayes-model-for-predicting-affinity_card\">Build a Naive Bayes model for predicting AFFINITY_CARD<\/h3>\n<hr />\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Build a Naive Bayes model using default settings","message":["%script","","BEGIN DBMS_DATA_MINING.DROP_MODEL('NB_CLASS_MODEL');","EXCEPTION WHEN OTHERS THEN NULL; END;","/","DECLARE"," v_setlst DBMS_DATA_MINING.SETTING_LIST;"," ","BEGIN"," v_setlst('PREP_AUTO') := 'ON';"," v_setlst('ALGO_NAME') := 'ALGO_NAIVE_BAYES';"," "," DBMS_DATA_MINING.CREATE_MODEL2("," 'NB_CLASS_MODEL',"," 'CLASSIFICATION',"," 'SELECT * FROM TRAIN_DATA_CLAS',"," v_setlst,"," 'CUST_ID',"," 'AFFINITY_CARD');","END;"],"enabled":true,"result":{"startTime":1715349771215,"interpreter":"script.low","endTime":1715349774118,"results":[{"message":"\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":8,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","### Examples of possible setting overrides for Naive Bayes","","If the user does not override the default settings, then relevant settings are determined by the algorithm.","","A complete list of settings can be found in the Documentation link:","","* <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-A04C5F4E-1303-44DC-A7DA-185C969330C8\" target=\"_blank\">Algorithm Settings<\/a>","* <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-24047A09-0542-4870-91D8-329F28B0ED75\" target=\"_blank\">Shared Settings<\/a>","","* Specify a row weight column ","> v_setlst('ODMS_ROW_WEIGHT_COLUMN_NAME') := '<row_weight_column_name>';","* Specify a missing value treatment method for the training data. This setting does not affect the scoring data. The default value is `ODMS_MISSING_VALUE_AUTO`. The option `ODMS_MISSING_VALUE_MEAN_MODE` replaces missing values with the mean (numeric attributes) or the mode (categorical attributes) both at build time and apply time where appropriate. The option `ODMS_MISSING_VALUE_AUTO` performs different strategies for different algorithms. When `ODMS_MISSING_VALUE_TREATMENT` is set to `ODMS_MISSING_VALUE_DELETE_ROW`, the rows in the training data that contain missing values are deleted. However, if you want to replicate this missing value treatment in the scoring data, then you must perform the transformation explicitly.","> v_setlst('ODMS_MISSING_VALUE_TREATMENT') := 'ODMS_MISSING_VALUE_AUTO';","* Specify the value of pairwise threshold for the Naive Bayes algorithm. The value required is between 0 and 1 (including the edges), and the default value is 0. ","> v_setlst('NABS_PAIRWISE_THRESHOLD') := '0';","* Specify the value of singleton threshold for the Naive Bayes algorithm. The value required is between 0 and 1 (including the edges), and the default value is 0. ","> v_setlst('NABS_SINGLETON_THRESHOLD') := '0';"],"enabled":true,"result":{"startTime":1715349774203,"interpreter":"md.low","endTime":1715349774266,"results":[{"message":"<h3 id=\"examples-of-possible-setting-overrides-for-naive-bayes\">Examples of possible setting overrides for Naive Bayes<\/h3>\n<p>If the user does not override the default settings, then relevant settings are determined by the algorithm.<\/p>\n<p>A complete list of settings can be found in the Documentation link:<\/p>\n<ul>\n<li>\n<p><a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-A04C5F4E-1303-44DC-A7DA-185C969330C8\" target=\"_blank\">Algorithm Settings<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-24047A09-0542-4870-91D8-329F28B0ED75\" target=\"_blank\">Shared Settings<\/a><\/p>\n<\/li>\n<li>\n<p>Specify a row weight column<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>v_setlst('ODMS_ROW_WEIGHT_COLUMN_NAME') := '<row_weight_column_name>';<\/p>\n<\/blockquote>\n<ul>\n<li>Specify a missing value treatment method for the training data. This setting does not affect the scoring data. The default value is <code>ODMS_MISSING_VALUE_AUTO<\/code>. The option <code>ODMS_MISSING_VALUE_MEAN_MODE<\/code> replaces missing values with the mean (numeric attributes) or the mode (categorical attributes) both at build time and apply time where appropriate. The option <code>ODMS_MISSING_VALUE_AUTO<\/code> performs different strategies for different algorithms. When <code>ODMS_MISSING_VALUE_TREATMENT<\/code> is set to <code>ODMS_MISSING_VALUE_DELETE_ROW<\/code>, the rows in the training data that contain missing values are deleted. However, if you want to replicate this missing value treatment in the scoring data, then you must perform the transformation explicitly.<\/li>\n<\/ul>\n<blockquote>\n<p>v_setlst('ODMS_MISSING_VALUE_TREATMENT') := 'ODMS_MISSING_VALUE_AUTO';<\/p>\n<\/blockquote>\n<ul>\n<li>Specify the value of pairwise threshold for the Naive Bayes algorithm. The value required is between 0 and 1 (including the edges), and the default value is 0.<\/li>\n<\/ul>\n<blockquote>\n<p>v_setlst('NABS_PAIRWISE_THRESHOLD') := '0';<\/p>\n<\/blockquote>\n<ul>\n<li>Specify the value of singleton threshold for the Naive Bayes algorithm. The value required is between 0 and 1 (including the edges), and the default value is 0.<\/li>\n<\/ul>\n<blockquote>\n<p>v_setlst('NABS_SINGLETON_THRESHOLD') := '0';<\/p>\n<\/blockquote>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Build a Naive Bayes Model using explicit settings","message":["%script","","BEGIN DBMS_DATA_MINING.DROP_MODEL('NB_CLASS_MODEL');","EXCEPTION WHEN OTHERS THEN NULL; END;","/","DECLARE"," v_setlst DBMS_DATA_MINING.SETTING_LIST;"," ","BEGIN"," v_setlst('PREP_AUTO') := 'ON';"," v_setlst('ALGO_NAME') := 'ALGO_NAIVE_BAYES';",""," v_setlst('NABS_PAIRWISE_THRESHOLD') := '0';"," v_setlst('NABS_SINGLETON_THRESHOLD') := '0';","",""," DBMS_DATA_MINING.CREATE_MODEL2("," 'NB_CLASS_MODEL',"," 'CLASSIFICATION',"," 'SELECT * FROM TRAIN_DATA_CLAS',"," v_setlst,"," 'CUST_ID',"," 'AFFINITY_CARD');","END;"],"enabled":true,"result":{"startTime":1715349774350,"interpreter":"script.low","endTime":1715349776252,"results":[{"message":"\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Get list of model views","message":["%sql ","","SELECT VIEW_NAME, VIEW_TYPE "," FROM USER_MINING_MODEL_VIEWS"," WHERE MODEL_NAME='NB_CLASS_MODEL'"," ORDER BY VIEW_NAME;"," "," "," "],"enabled":true,"result":{"startTime":1715349776340,"interpreter":"sql.low","endTime":1715349776440,"results":[{"message":"VIEW_NAME\tVIEW_TYPE\nDM$VBNB_CLASS_MODEL\tAutomatic Data Preparation Binning\nDM$VCNB_CLASS_MODEL\tScoring Cost Matrix\nDM$VGNB_CLASS_MODEL\tGlobal Name-Value Pairs\nDM$VPNB_CLASS_MODEL\tNaive Bayes Target Priors\nDM$VSNB_CLASS_MODEL\tComputed Settings\nDM$VTNB_CLASS_MODEL\tClassification Targets\nDM$VVNB_CLASS_MODEL\tNaive Bayes Conditional Probabilities\nDM$VWNB_CLASS_MODEL\tModel Build Alerts\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Get attribute information","message":["%sql","","SELECT * FROM DM$VBNB_CLASS_MODEL"],"enabled":true,"result":{"startTime":1715349776524,"interpreter":"sql.low","endTime":1715349776621,"results":[{"message":"PARTITION_NAME\tATTRIBUTE_NAME\tATTRIBUTE_SUBNAME\tBIN_ID\tLOWER_BIN_BOUNDARY\tUPPER_BIN_BOUNDARY\tATTRIBUTE_VALUE\n\tBOOKKEEPING_APPLICATION\t\t0\t\t0.5\t\n\tBOOKKEEPING_APPLICATION\t\t1\t0.5\t\t\n\tHOME_THEATER_PACKAGE\t\t0\t\t0.5\t\n\tHOME_THEATER_PACKAGE\t\t1\t0.5\t\t\n\tYRS_RESIDENCE\t\t0\t\t2.5\t\n\tYRS_RESIDENCE\t\t1\t2.5\t3.5\t\n\tYRS_RESIDENCE\t\t2\t3.5\t\t\n\tY_BOX_GAMES\t\t0\t\t0.5\t\n\tY_BOX_GAMES\t\t1\t0.5\t\t\n\tEDUCATION\t\t0\t\t\t'10th', '11th', '12th', '1st-4th', '5th-6th', '7th-8th', '9th', '< Bach.', 'Assoc-V', 'HS-grad', 'Presch.'\n\tEDUCATION\t\t1\t\t\t'Masters', 'PhD', 'Profsc'\n\tEDUCATION\t\t2\t\t\t'Assoc-A', 'Bach.'\n\tHOUSEHOLD_SIZE\t\t0\t\t\t'3', '4-5'\n\tHOUSEHOLD_SIZE\t\t1\t\t\t'2', '9+'\n\tHOUSEHOLD_SIZE\t\t2\t\t\t'1', '6-8'\n\tOCCUPATION\t\t0\t\t\t'Exec.', 'Prof.', 'Protec.'\n\tOCCUPATION\t\t1\t\t\t'Cleric.', 'Crafts', 'Machine', 'Sales', 'TechSup', 'Transp.'\n\tOCCUPATION\t\t2\t\t\t'?', 'Armed-F', 'Farming', 'Handler', 'House-s', 'Other'\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Get conditional probabilities for attributes","message":["%sql","","SELECT * FROM DM$VVNB_CLASS_MODEL"],"enabled":true,"result":{"startTime":1715349776699,"interpreter":"sql.low","endTime":1715349776859,"results":[{"message":"PARTITION_NAME\tTARGET_NAME\tTARGET_VALUE\tATTRIBUTE_NAME\tATTRIBUTE_SUBNAME\tATTRIBUTE_VALUE\tCONDITIONAL_PROBABILITY\tCOUNT\n\tAFFINITY_CARD\t0\tYRS_RESIDENCE\t\t(3.5; )\t0.4762611275964392\t963\n\tAFFINITY_CARD\t1\tYRS_RESIDENCE\t\t(3.5; )\t0.8538812785388128\t561\n\tAFFINITY_CARD\t0\tHOUSEHOLD_SIZE\t\t'2', '9+'\t0.4431256181998022\t896\n\tAFFINITY_CARD\t1\tHOUSEHOLD_SIZE\t\t'2', '9+'\t0.1354642313546423\t89\n\tAFFINITY_CARD\t0\tYRS_RESIDENCE\t\t(2.5; 3.5]\t0.2507418397626113\t507\n\tAFFINITY_CARD\t1\tYRS_RESIDENCE\t\t(2.5; 3.5]\t0.12176560121765602\t80\n\tAFFINITY_CARD\t0\tOCCUPATION\t\t'Exec.', 'Prof.', 'Protec.'\t0.19090009891196838\t386\n\tAFFINITY_CARD\t1\tOCCUPATION\t\t'Exec.', 'Prof.', 'Protec.'\t0.512937595129376\t337\n\tAFFINITY_CARD\t0\tEDUCATION\t\t'Masters', 'PhD', 'Profsc'\t0.040059347181008904\t81\n\tAFFINITY_CARD\t1\tEDUCATION\t\t'Masters', 'PhD', 'Profsc'\t0.19634703196347034\t129\n\tAFFINITY_CARD\t0\tHOUSEHOLD_SIZE\t\t'3', '4-5'\t0.3224530168150347\t652\n\tAFFINITY_CARD\t1\tHOUSEHOLD_SIZE\t\t'3', '4-5'\t0.8508371385083714\t559\n\tAFFINITY_CARD\t0\tOCCUPATION\t\t'Cleric.', 'Crafts', 'Machine', 'Sales', 'TechSup', 'Transp.'\t0.5316518298714145\t1075\n\tAFFINITY_CARD\t1\tOCCUPATION\t\t'Cleric.', 'Crafts', 'Machine', 'Sales', 'TechSup', 'Transp.'\t0.4231354642313546\t278\n\tAFFINITY_CARD\t0\tOCCUPATION\t\t'?', 'Armed-F', 'Farming', 'Handler', 'House-s', 'Other'\t0.2774480712166172\t561\n\tAFFINITY_CARD\t1\tOCCUPATION\t\t'?', 'Armed-F', 'Farming', 'Handler', 'House-s', 'Other'\t0.06392694063926942\t42\n\tAFFINITY_CARD\t0\tHOUSEHOLD_SIZE\t\t'1', '6-8'\t0.2344213649851632\t474\n\tAFFINITY_CARD\t1\tHOUSEHOLD_SIZE\t\t'1', '6-8'\t0.013698630136986304\t9\n\tAFFINITY_CARD\t0\tBOOKKEEPING_APPLICATION\t\t( ; .5]\t0.14836795252225518\t300\n\tAFFINITY_CARD\t1\tBOOKKEEPING_APPLICATION\t\t( ; .5]\t0.03957382039573821\t26\n\tAFFINITY_CARD\t0\tHOME_THEATER_PACKAGE\t\t( ; .5]\t0.5197823936696341\t1051\n\tAFFINITY_CARD\t1\tHOME_THEATER_PACKAGE\t\t( ; .5]\t0.197869101978691\t130\n\tAFFINITY_CARD\t0\tY_BOX_GAMES\t\t(.5; )\t0.39762611275964393\t804\n\tAFFINITY_CARD\t1\tY_BOX_GAMES\t\t(.5; )\t0.06240487062404872\t41\n\tAFFINITY_CARD\t0\tEDUCATION\t\t'10th', '11th', '12th', '1st-4th', '5th-6th', '7th-8th', '9th', '< Bach.', 'Assoc-V', 'HS-grad', 'Presch.'\t0.7888229475766568\t1595\n\tAFFINITY_CARD\t1\tEDUCATION\t\t'10th', '11th', '12th', '1st-4th', '5th-6th', '7th-8th', '9th', '< Bach.', 'Assoc-V', 'HS-grad', 'Presch.'\t0.4885844748858447\t321\n\tAFFINITY_CARD\t0\tBOOKKEEPING_APPLICATION\t\t(.5; )\t0.8516320474777448\t1722\n\tAFFINITY_CARD\t1\tBOOKKEEPING_APPLICATION\t\t(.5; )\t0.9604261796042618\t631\n\tAFFINITY_CARD\t0\tYRS_RESIDENCE\t\t( ; 2.5]\t0.27299703264094954\t552\n\tAFFINITY_CARD\t1\tYRS_RESIDENCE\t\t( ; 2.5]\t0.0243531202435312\t16\n\tAFFINITY_CARD\t0\tHOME_THEATER_PACKAGE\t\t(.5; )\t0.480217606330366\t971\n\tAFFINITY_CARD\t1\tHOME_THEATER_PACKAGE\t\t(.5; )\t0.802130898021309\t527\n\tAFFINITY_CARD\t0\tY_BOX_GAMES\t\t( ; .5]\t0.6023738872403561\t1218\n\tAFFINITY_CARD\t1\tY_BOX_GAMES\t\t( ; .5]\t0.9375951293759512\t616\n\tAFFINITY_CARD\t0\tEDUCATION\t\t'Assoc-A', 'Bach.'\t0.17111770524233433\t346\n\tAFFINITY_CARD\t1\tEDUCATION\t\t'Assoc-A', 'Bach.'\t0.3150684931506849\t207\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Evaluate the model","message":["%script","","BEGIN EXECUTE IMMEDIATE 'DROP TABLE APPLY_RESULT PURGE';","EXCEPTION WHEN OTHERS THEN NULL; END;","/","BEGIN EXECUTE IMMEDIATE 'DROP TABLE LIFT_TABLE PURGE';","EXCEPTION WHEN OTHERS THEN NULL; END;","/","BEGIN"," DBMS_DATA_MINING.APPLY('NB_CLASS_MODEL','TEST_DATA_CLAS','CUST_ID','APPLY_RESULT');"," DBMS_DATA_MINING.COMPUTE_LIFT('APPLY_RESULT','TEST_DATA_CLAS','CUST_ID','AFFINITY_CARD',"," 'LIFT_TABLE','1','PREDICTION','PROBABILITY',100);","END;"],"enabled":true,"result":{"startTime":1715349776968,"interpreter":"script.low","endTime":1715349778678,"results":[{"message":"\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":7,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"table\":{\"version\":1},\"line\":{\"showSeries\":[\"GAIN_CUMULATIVE\"],\"series\":{\"availableSeriesElements\":[{\"id\":\"GAIN_CUMULATIVE\",\"lineType\":\"straight\",\"borderColor\":\"rgb(25, 95, 116)\",\"borderWidth\":0,\"color\":\"rgb(25, 95, 116)\",\"pattern\":\"auto\",\"markerColor\":\"rgb(25, 95, 116)\",\"markerDisplayed\":\"auto\",\"markerShape\":\"auto\",\"markerSize\":0}]},\"lastColumns\":[\"QUANTILE_NUMBER\",\"GAIN_CUMULATIVE\"],\"version\":1},\"area\":{\"version\":1},\"bar\":{\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"line","title":"View model's cumulative gains (lift) chart","message":["%sql","","SELECT QUANTILE_NUMBER, "," ROUND(GAIN_CUMULATIVE,3) GAIN_CUMULATIVE","FROM LIFT_TABLE;"],"enabled":true,"result":{"startTime":1715349778758,"interpreter":"sql.low","endTime":1715349778856,"results":[{"message":"QUANTILE_NUMBER\tGAIN_CUMULATIVE\n1\t0.038\n2\t0.077\n3\t0.115\n4\t0.15\n5\t0.184\n6\t0.219\n7\t0.26\n8\t0.285\n9\t0.312\n10\t0.339\n11\t0.363\n12\t0.39\n13\t0.421\n14\t0.451\n15\t0.484\n16\t0.505\n17\t0.517\n18\t0.537\n19\t0.558\n20\t0.578\n21\t0.599\n22\t0.619\n23\t0.638\n24\t0.658\n25\t0.677\n26\t0.697\n27\t0.716\n28\t0.729\n29\t0.748\n30\t0.776\n31\t0.781\n32\t0.786\n33\t0.791\n34\t0.792\n35\t0.799\n36\t0.809\n37\t0.818\n38\t0.829\n39\t0.837\n40\t0.847\n41\t0.861\n42\t0.871\n43\t0.874\n44\t0.877\n45\t0.879\n46\t0.882\n47\t0.884\n48\t0.887\n49\t0.892\n50\t0.896\n51\t0.899\n52\t0.903\n53\t0.916\n54\t0.926\n55\t0.932\n56\t0.943\n57\t0.944\n58\t0.944\n59\t0.946\n60\t0.952\n61\t0.958\n62\t0.959\n63\t0.97\n64\t0.971\n65\t0.976\n66\t0.978\n67\t0.98\n68\t0.982\n69\t0.986\n70\t0.988\n71\t0.988\n72\t0.989\n73\t0.99\n74\t0.99\n75\t0.99\n76\t0.99\n77\t0.991\n78\t0.992\n79\t0.993\n80\t0.994\n81\t0.998\n82\t0.999\n83\t1\n84\t1\n85\t1\n86\t1\n87\t1\n88\t1\n89\t1\n90\t1\n91\t1\n92\t1\n93\t1\n94\t1\n95\t1\n96\t1\n97\t1\n98\t1\n99\t1\n100\t1\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":5,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display customers > 70% likely to be a responder","message":["%sql","","SELECT CUST_ID, PREDICTION PRED, ROUND(PROBABILITY,3) PROB, ROUND(COST,2) COST ","FROM APPLY_RESULT WHERE PREDICTION = 1 AND PROBABILITY > 0.7","ORDER BY PROBABILITY DESC","FETCH FIRST 10 ROWS ONLY;"," "],"enabled":true,"result":{"startTime":1715349778941,"interpreter":"sql.low","endTime":1715349779021,"results":[{"message":"CUST_ID\tPRED\tPROB\tCOST\n100012\t1\t0.983\t0.02\n100780\t1\t0.983\t0.02\n100760\t1\t0.983\t0.02\n100633\t1\t0.983\t0.02\n100476\t1\t0.983\t0.02\n100442\t1\t0.983\t0.02\n100390\t1\t0.983\t0.02\n100179\t1\t0.983\t0.02\n100052\t1\t0.983\t0.02\n100034\t1\t0.983\t0.02\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Select and view likely and unlikely AFFINITY_CARD responders ","message":["%sql ","","SELECT CUST_ID, PREDICTION, ROUND(PROBABILITY,2) PROB, ROUND(COST,2) COST","FROM APPLY_RESULT WHERE PREDICTION = ${PREDICTION='1','1'|'0'} ","AND PROBABILITY > 0.7 ","ORDER BY PROBABILITY DESC","FETCH FIRST 10 ROWS ONLY;"],"enabled":true,"result":{"startTime":1715349779101,"interpreter":"sql.low","endTime":1715349779188,"results":[{"message":"CUST_ID\tPREDICTION\tPROB\tCOST\n100198\t0\t1\t0\n102598\t0\t1\t0\n102547\t0\t1\t0\n102392\t0\t1\t0\n102094\t0\t1\t0\n101997\t0\t1\t0\n100730\t0\t1\t0\n100485\t0\t1\t0\n100417\t0\t1\t0\n100297\t0\t1\t0\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":"{\"PREDICTION\":\"'0'\"}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[{\"type\":\"Select\",\"name\":\"PREDICTION\",\"displayName\":null,\"defaultValue\":\"'1'\",\"argument\":null,\"options\":[{\"value\":\"'1'\",\"displayName\":null},{\"value\":\"'0'\",\"displayName\":null}],\"isHidden\":false,\"isProgrammatic\":false}]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Dynamically select customers >70% likely to be a responder","message":["%sql","","SELECT * ","FROM (SELECT CUST_ID, "," round(PREDICTION_PROBABILITY(NB_CLASS_MODEL, '1' USING A.*),3) PROBABILITY"," FROM TEST_DATA_CLAS A)","WHERE PROBABILITY > 0.7;"],"enabled":true,"result":{"startTime":1715349779275,"interpreter":"sql.low","endTime":1715349779406,"results":[{"message":"CUST_ID\tPROBABILITY\n100056\t0.869\n100069\t0.873\n100075\t0.869\n100090\t0.721\n100096\t0.873\n100116\t0.882\n100138\t0.721\n100165\t0.721\n100190\t0.957\n100210\t0.957\n100265\t0.721\n100344\t0.957\n100388\t0.873\n100393\t0.873\n100472\t0.836\n100525\t0.957\n100534\t0.721\n100563\t0.721\n100620\t0.882\n100651\t0.882\n100673\t0.957\n100719\t0.882\n100766\t0.873\n100815\t0.983\n100879\t0.882\n100906\t0.983\n100965\t0.721\n100974\t0.721\n101041\t0.869\n101084\t0.882\n101103\t0.957\n101148\t0.882\n101265\t0.873\n101275\t0.882\n101306\t0.869\n101309\t0.721\n101321\t0.873\n101348\t0.957\n101375\t0.869\n101404\t0.869\n101439\t0.957\n101485\t0.983\n101566\t0.721\n101608\t0.721\n101638\t0.869\n101722\t0.882\n101733\t0.983\n101797\t0.957\n101805\t0.882\n101843\t0.721\n101894\t0.869\n102033\t0.983\n102147\t0.721\n102205\t0.869\n102330\t0.983\n102415\t0.721\n102466\t0.931\n102498\t0.931\n102517\t0.869\n102518\t0.882\n102615\t0.983\n102744\t0.869\n102749\t0.869\n102753\t0.873\n102857\t0.721\n102913\t0.882\n102941\t0.882\n102953\t0.869\n102964\t0.882\n103040\t0.721\n103114\t0.836\n103136\t0.882\n103230\t0.957\n103239\t0.836\n103303\t0.869\n103329\t0.721\n103336\t0.869\n103370\t0.721\n103376\t0.873\n103386\t0.882\n103389\t0.882\n103396\t0.882\n103471\t0.957\n103500\t0.873\n103529\t0.882\n103626\t0.882\n103627\t0.957\n103701\t0.873\n103774\t0.721\n103786\t0.957\n103819\t0.882\n103836\t0.983\n103940\t0.882\n104014\t0.882\n104023\t0.882\n104066\t0.957\n104146\t0.869\n104176\t0.721\n104223\t0.957\n104231\t0.869\n104251\t0.983\n104257\t0.869\n104319\t0.721\n104364\t0.957\n104453\t0.721\n104462\t0.882\n104463\t0.869\n100012\t0.983\n100034\t0.983\n100037\t0.873\n100046\t0.882\n100052\t0.983\n100164\t0.869\n100176\t0.882\n100179\t0.983\n100185\t0.869\n100266\t0.869\n100272\t0.957\n100281\t0.957\n100300\t0.957\n100330\t0.836\n100390\t0.983\n100406\t0.957\n100425\t0.957\n100437\t0.882\n100438\t0.941\n100442\t0.983\n100446\t0.882\n100476\t0.983\n100496\t0.957\n100540\t0.873\n100577\t0.869\n100609\t0.946\n100616\t0.836\n100633\t0.983\n100672\t0.882\n100698\t0.882\n100701\t0.957\n100704\t0.882\n100709\t0.869\n100754\t0.882\n100759\t0.721\n100760\t0.983\n100780\t0.983\n100816\t0.983\n100817\t0.946\n100871\t0.957\n100883\t0.983\n100897\t0.882\n100982\t0.869\n100988\t0.957\n101010\t0.983\n101031\t0.983\n101057\t0.858\n101086\t0.983\n101114\t0.869\n101163\t0.869\n101186\t0.957\n101203\t0.869\n101208\t0.983\n101224\t0.836\n101246\t0.836\n101266\t0.882\n101323\t0.869\n101361\t0.869\n101366\t0.869\n101421\t0.957\n101444\t0.957\n101449\t0.983\n101499\t0.957\n101542\t0.873\n101549\t0.882\n101551\t0.983\n101559\t0.983\n101564\t0.946\n101570\t0.983\n101581\t0.983\n101600\t0.882\n101605\t0.957\n101606\t0.957\n101621\t0.957\n101641\t0.946\n101689\t0.869\n101697\t0.983\n101699\t0.869\n101712\t0.869\n101735\t0.869\n101737\t0.957\n101747\t0.882\n101763\t0.983\n101816\t0.957\n101817\t0.873\n101836\t0.721\n101907\t0.721\n101935\t0.983\n101952\t0.983\n101983\t0.869\n102019\t0.957\n102022\t0.957\n102023\t0.873\n102034\t0.869\n102037\t0.983\n102047\t0.869\n102087\t0.882\n102142\t0.983\n102167\t0.882\n102184\t0.946\n102196\t0.983\n102210\t0.946\n102214\t0.957\n102222\t0.869\n102230\t0.983\n102242\t0.786\n102246\t0.721\n102267\t0.882\n102275\t0.957\n102283\t0.882\n102309\t0.946\n102310\t0.873\n102323\t0.983\n102326\t0.983\n102340\t0.869\n102351\t0.957\n102376\t0.882\n102380\t0.983\n102385\t0.957\n102394\t0.957\n102400\t0.957\n102422\t0.873\n102428\t0.882\n102438\t0.957\n102462\t0.957\n102470\t0.869\n102473\t0.957\n102476\t0.957\n102499\t0.882\n102501\t0.957\n102510\t0.957\n102556\t0.836\n102573\t0.983\n102641\t0.882\n102643\t0.957\n102660\t0.882\n102661\t0.983\n102695\t0.957\n102699\t0.869\n102734\t0.983\n102754\t0.957\n102767\t0.957\n102783\t0.983\n102817\t0.957\n102821\t0.931\n102868\t0.957\n102910\t0.869\n102951\t0.836\n102959\t0.983\n102961\t0.869\n102967\t0.941\n102978\t0.882\n102979\t0.957\n102981\t0.882\n102998\t0.882\n103016\t0.869\n103144\t0.869\n103150\t0.836\n103213\t0.957\n103214\t0.721\n103225\t0.869\n103232\t0.983\n103256\t0.983\n103290\t0.873\n103294\t0.983\n103317\t0.882\n103361\t0.957\n103398\t0.882\n103428\t0.983\n103439\t0.983\n103491\t0.786\n103541\t0.873\n103548\t0.882\n103569\t0.721\n103599\t0.882\n103615\t0.946\n103622\t0.836\n103641\t0.882\n103678\t0.869\n103679\t0.957\n103779\t0.869\n103796\t0.873\n103799\t0.957\n103812\t0.941\n103830\t0.869\n103837\t0.983\n103839\t0.869\n103859\t0.836\n103880\t0.957\n103898\t0.957\n103911\t0.836\n103957\t0.882\n103972\t0.882\n104010\t0.882\n104061\t0.957\n104078\t0.869\n104087\t0.869\n104093\t0.957\n104103\t0.869\n104114\t0.869\n104149\t0.983\n104168\t0.882\n104183\t0.957\n104187\t0.869\n104206\t0.983\n104209\t0.957\n104307\t0.983\n104317\t0.983\n104320\t0.869\n104324\t0.873\n104369\t0.957\n104378\t0.882\n104427\t0.873\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Apply the model to a single new record","message":["%sql","","-- Predict the probability of being a high AFFINITY_CARD responder (1) ","-- by providing specific attribute values for a customer.","","SELECT ROUND(PREDICTION_PROBABILITY(NB_CLASS_MODEL, '1' USING "," '3' AS HOUSEHOLD_SIZE, "," 5 AS YRS_RESIDENCE, "," 1 AS Y_BOX_GAMES),3) PROBABILITY_AFFINITY_CARD_RESPONDER","FROM DUAL;"," "],"enabled":true,"result":{"startTime":1715349779504,"interpreter":"sql.low","endTime":1715349779587,"results":[{"message":"PROBABILITY_AFFINITY_CARD_RESPONDER\n0.194\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Get prediction details","message":["%sql","","SELECT CUST_ID,"," round(PREDICTION_YRS_RES,3) PRED_YRS_RES,"," RTRIM(TRIM(SUBSTR(OUTPRED.\"Attribute1\",17,100)),'rank=\"1\"/>') FIRST_ATTRIBUTE,"," RTRIM(TRIM(SUBSTR(OUTPRED.\"Attribute2\",17,100)),'rank=\"2\"/>') SECOND_ATTRIBUTE","FROM (SELECT CUST_ID,"," PREDICTION(NB_CLASS_MODEL USING *) PREDICTION_YRS_RES,"," PREDICTION_DETAILS(NB_CLASS_MODEL USING *) PD"," FROM TEST_DATA_CLAS"," WHERE CUST_ID < 100025"," ORDER BY CUST_ID) OUT,"," XMLTABLE('/Details' PASSING OUT.PD COLUMNS "," \"Attribute1\" XMLType PATH 'Attribute[1]',"," \"Attribute2\" XMLType PATH 'Attribute[2]') OUTPRED","FETCH FIRST 10 ROWS ONLY;"],"enabled":true,"result":{"startTime":1715349779685,"interpreter":"sql.low","endTime":1715349779833,"results":[{"message":"CUST_ID\tPRED_YRS_RES\tFIRST_ATTRIBUTE\tSECOND_ATTRIBUTE\n100004\t0\t\"HOUSEHOLD_SIZE\" actualValue=\"2\" weight=\".268\" \t\"YRS_RESIDENCE\" actualValue=\"5\" weight=\".256\" \n100009\t0\t\"OCCUPATION\" actualValue=\"Prof.\" weight=\".499\" \t\"HOUSEHOLD_SIZE\" actualValue=\"3\" weight=\".487\" \n100011\t0\t\"OCCUPATION\" actualValue=\"Farming\" weight=\".3\" \t\"BOOKKEEPING_APPLICATION\" actualValue=\"0\" weight=\".282\" \n100012\t1\t\"EDUCATION\" actualValue=\"PhD\" weight=\"1.321\" \t\"OCCUPATION\" actualValue=\"Prof.\" weight=\".926\" \n100013\t1\t\"HOUSEHOLD_SIZE\" actualValue=\"3\" weight=\".912\" \t\"YRS_RESIDENCE\" actualValue=\"5\" weight=\".585\" \n100014\t0\t\"HOUSEHOLD_SIZE\" actualValue=\"2\" weight=\".268\" \t\"YRS_RESIDENCE\" actualValue=\"5\" weight=\".256\" \n100018\t0\t\"HOUSEHOLD_SIZE\" actualValue=\"4-5\" weight=\".487\" \t\"Y_BOX_GAMES\" actualValue=\"1\" weight=\".333\" \n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","## Create Classification Model using Settings Table","","The settings table is an alternative way to specify algorithm settings to build the model. We first drop the settings table, create it, and then populate it with settings before building the model."],"enabled":true,"result":{"startTime":1715349779933,"interpreter":"md.low","endTime":1715349780014,"results":[{"message":"<h2 id=\"create-classification-model-using-settings-table\">Create Classification Model using Settings Table<\/h2>\n<p>The settings table is an alternative way to specify algorithm settings to build the model. We first drop the settings table, create it, and then populate it with settings before building the model.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Build classification model","message":["%script","","BEGIN EXECUTE IMMEDIATE 'DROP TABLE N1_BUILD_SETTINGS PURGE';","EXCEPTION WHEN OTHERS THEN NULL; END;","/","CREATE TABLE N1_BUILD_SETTINGS (setting_name VARCHAR2(30),setting_value VARCHAR2(4000));","/","BEGIN DBMS_DATA_MINING.DROP_MODEL('CLASS_MODEL_2');","EXCEPTION WHEN OTHERS THEN NULL; END;","/","","BEGIN"," INSERT INTO N1_BUILD_SETTINGS (setting_name, setting_value) VALUES ('ALGO_NAME', 'ALGO_NAIVE_BAYES');"," INSERT INTO N1_BUILD_SETTINGS (setting_name, setting_value) VALUES ('PREP_AUTO', 'ON');",""," DBMS_DATA_MINING.CREATE_MODEL('CLASS_MODEL_2', 'CLASSIFICATION', 'TRAIN_DATA_CLAS', 'CUST_ID',' AFFINITY_CARD', 'N1_BUILD_SETTINGS');"," DBMS_OUTPUT.PUT_LINE ('Created model: CLASS_MODEL_2 ');","END;"],"enabled":true,"result":{"startTime":1715349780129,"interpreter":"script.low","endTime":1715349782653,"results":[{"message":"\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n\nTable N1_BUILD_SETTINGS created.\n\n\n---------------------------\n\n---------------------------\n\nPL/SQL procedure successfully completed.\n\n\n---------------------------\nCreated model: CLASS_MODEL_2 \n\n\nPL/SQL procedure successfully completed.\n\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","## End of Script"],"enabled":true,"result":{"startTime":1715349782747,"interpreter":"md.low","endTime":1715349782817,"results":[{"message":"<h2 id=\"end-of-script\">End of Script<\/h2>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md"],"enabled":true,"result":{"startTime":1715349782911,"interpreter":"md.low","endTime":1715349783006,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":true,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"6","snapshot":false,"tags":null}]