From 719074919206c376cf4b0971213caa173af22c89 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 10 Jun 2009 21:49:39 +0800 Subject: [PATCH] Add framework for ROC summary table --- src/language/stats/roc.c | 55 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/src/language/stats/roc.c b/src/language/stats/roc.c index d35de103..054289f1 100644 --- a/src/language/stats/roc.c +++ b/src/language/stats/roc.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -619,14 +620,66 @@ show_auc (struct roc_state *rs, const struct cmd_roc *roc) } +static void +show_summary (const struct cmd_roc *roc) +{ + const int n_cols = 3; + const int n_rows = 4; + struct tab_table *tbl = tab_create (n_cols, n_rows, 0); + + tab_title (tbl, _("Case Summary")); + + tab_headers (tbl, 1, 0, 2, 0); + + tab_dim (tbl, tab_natural_dimensions, NULL); + + tab_box (tbl, + TAL_2, TAL_2, + -1, -1, + 0, 0, + n_cols - 1, + n_rows - 1); + + tab_hline (tbl, TAL_2, 0, n_cols - 1, 2); + tab_vline (tbl, TAL_2, 1, 0, n_rows - 1); + + + tab_hline (tbl, TAL_2, 1, n_cols - 1, 1); + tab_vline (tbl, TAL_1, 2, 1, n_rows - 1); + + + tab_text (tbl, 0, 1, TAT_TITLE | TAB_LEFT, var_to_string (roc->state_var)); + tab_text (tbl, 1, 1, TAT_TITLE, _("Unweighted")); + tab_text (tbl, 2, 1, TAT_TITLE, _("Weighted")); + + tab_joint_text (tbl, 1, 0, 2, 0, + TAT_TITLE | TAB_CENTER, + _("Valid N (listwise)")); + + + tab_text (tbl, 0, 2, TAB_LEFT, _("Positive")); + tab_text (tbl, 0, 3, TAB_LEFT, _("Negative")); + + +#if 0 + tab_double (tbl, 1, 2, 0, roc->pos, &F_8_0); + tab_double (tbl, 1, 3, 0, roc->neg, &F_8_0); + + tab_double (tbl, 2, 2, 0, roc->pos_weighted, 0); + tab_double (tbl, 2, 3, 0, roc->neg_weighted, 0); +#endif + + tab_submit (tbl); +} static void output_roc (struct roc_state *rs, const struct cmd_roc *roc) { -#if 0 show_summary (roc); +#if 0 + if ( roc->curve ) draw_roc (rs, roc); #endif -- 2.30.2