You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ok...@apache.org on 2022/05/12 13:37:46 UTC
[madlib] 06/06: Doc: Update online examples for various model selection modules
This is an automated email from the ASF dual-hosted git repository.
okislal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git
commit bdf8cae0fc632706329d70335a755408e49b90dc
Author: Orhan Kislal <ok...@apache.org>
AuthorDate: Mon May 2 11:35:03 2022 +0300
Doc: Update online examples for various model selection modules
---
.../postgres/modules/sample/train_test_split.sql_in | 4 ++--
src/ports/postgres/modules/stats/pred_metrics.sql_in | 17 +++++++++--------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/ports/postgres/modules/sample/train_test_split.sql_in b/src/ports/postgres/modules/sample/train_test_split.sql_in
index 2f40015d..b606bc27 100644
--- a/src/ports/postgres/modules/sample/train_test_split.sql_in
+++ b/src/ports/postgres/modules/sample/train_test_split.sql_in
@@ -209,7 +209,7 @@ SELECT * FROM out ORDER BY split,gr1,gr2,id1,id2;
-# Sample with replacement and create separate train and test tables:
<pre class="syntax">
-DROP TABLE IF EXISTS out_train, out_test;
+DROP TABLE IF EXISTS out, out_train, out_test;
SELECT madlib.train_test_split(
'test', -- Source table
'out', -- Output table
@@ -243,7 +243,7 @@ SELECT * FROM out_test ORDER BY gr1,gr2,id1,id2;
</pre>
<pre class="result">
gr1 | gr2 | id1 | id2
------+-----+-----+-----
+-------+-------+-------+------
1 | 1 | 1 | 0
1 | 1 | 1 | 0
1 | 1 | 3 | 0
diff --git a/src/ports/postgres/modules/stats/pred_metrics.sql_in b/src/ports/postgres/modules/stats/pred_metrics.sql_in
index 32de9a97..43de39f2 100644
--- a/src/ports/postgres/modules/stats/pred_metrics.sql_in
+++ b/src/ports/postgres/modules/stats/pred_metrics.sql_in
@@ -332,6 +332,7 @@ f1 | 0.63736263736263736264
-# Run the Area Under ROC curve function:
<pre class="example">
+\\x off
DROP TABLE IF EXISTS table_out;
SELECT madlib.area_under_roc( 'test_set', 'table_out', 'pred', 'obs');
SELECT * FROM table_out;
@@ -360,14 +361,14 @@ SELECT * FROM table_out ORDER BY class;
</pre>
Result
<pre class="result">
- class | confusion_arr
--------+---------------
- 0 | {0,1,2,2,2,2}
- 1 | {0,2,0,1,1,0}
- 2 | {0,0,0,2,2,0}
- 3 | {0,0,2,0,0,2}
- 4 | {0,2,1,0,0,1}
- 5 | {0,0,0,0,0,0}
+ row_id | class | confusion_arr
+--------+-------+---------------
+ 1 | 0 | {0,1,2,2,2,2}
+ 2 | 1 | {0,2,0,1,1,0}
+ 3 | 2 | {0,0,0,2,2,0}
+ 4 | 3 | {0,0,2,0,0,2}
+ 5 | 4 | {0,2,1,0,0,1}
+ 6 | 5 | {0,0,0,0,0,0}
</pre>
@anchor literature