projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update to latest Gnulib
[pspp]
/
src
/
language
/
stats
/
roc.c
diff --git
a/src/language/stats/roc.c
b/src/language/stats/roc.c
index 1d21a4f6a1221ed6b83f3c2bbb8d4e25c457c95a..d1461a599f0724471a37aaf41a1120c336670f52 100644
(file)
--- a/
src/language/stats/roc.c
+++ b/
src/language/stats/roc.c
@@
-18,28
+18,24
@@
#include <language/stats/roc.h>
#include <language/stats/roc.h>
-#include <data/procedure.h>
-#include <language/lexer/variable-parser.h>
-#include <language/lexer/value-parser.h>
-#include <language/command.h>
-#include <language/lexer/lexer.h>
-
#include <data/casegrouper.h>
#include <data/casereader.h>
#include <data/casewriter.h>
#include <data/dictionary.h>
#include <data/format.h>
#include <data/casegrouper.h>
#include <data/casereader.h>
#include <data/casewriter.h>
#include <data/dictionary.h>
#include <data/format.h>
-#include <
math/sort
.h>
+#include <
data/procedure
.h>
#include <data/subcase.h>
#include <data/subcase.h>
-
-
+#include <language/command.h>
+#include <language/lexer/lexer.h>
+#include <language/lexer/value-parser.h>
+#include <language/lexer/variable-parser.h>
#include <libpspp/misc.h>
#include <libpspp/misc.h>
+#include <math/sort.h>
+#include <output/chart-item.h>
+#include <output/charts/roc-chart.h>
+#include <output/tab.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_cdf.h>
-#include <output/table.h>
-
-#include <output/chart.h>
-#include <output/charts/roc-chart.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-51,7
+47,7
@@
struct cmd_roc
const struct variable **vars;
const struct dictionary *dict;
const struct variable **vars;
const struct dictionary *dict;
- const struct variable *state_var
;
+ const struct variable *state_var;
union value state_value;
/* Plot the roc curve */
union value state_value;
/* Plot the roc curve */
@@
-97,7
+93,9
@@
cmd_roc (struct lexer *lexer, struct dataset *ds)
roc.pos = roc.pos_weighted = 0;
roc.neg = roc.neg_weighted = 0;
roc.dict = dataset_dict (ds);
roc.pos = roc.pos_weighted = 0;
roc.neg = roc.neg_weighted = 0;
roc.dict = dataset_dict (ds);
+ roc.state_var = NULL;
+ lex_match (lexer, '/');
if (!parse_variables_const (lexer, dict, &roc.vars, &roc.n_vars,
PV_APPEND | PV_NO_DUPLICATE | PV_NUMERIC))
goto error;
if (!parse_variables_const (lexer, dict, &roc.vars, &roc.n_vars,
PV_APPEND | PV_NO_DUPLICATE | PV_NUMERIC))
goto error;
@@
-114,6
+112,7
@@
cmd_roc (struct lexer *lexer, struct dataset *ds)
goto error;
}
goto error;
}
+ value_init (&roc.state_value, var_get_width (roc.state_var));
parse_value (lexer, &roc.state_value, var_get_width (roc.state_var));
parse_value (lexer, &roc.state_value, var_get_width (roc.state_var));
@@
-273,10
+272,13
@@
cmd_roc (struct lexer *lexer, struct dataset *ds)
if ( ! run_roc (ds, &roc))
goto error;
if ( ! run_roc (ds, &roc))
goto error;
+ value_destroy (&roc.state_value, var_get_width (roc.state_var));
free (roc.vars);
return CMD_SUCCESS;
error:
free (roc.vars);
return CMD_SUCCESS;
error:
+ if ( roc.state_var)
+ value_destroy (&roc.state_value, var_get_width (roc.state_var));
free (roc.vars);
return CMD_FAILURE;
}
free (roc.vars);
return CMD_FAILURE;
}
@@
-936,7
+938,6
@@
show_auc (struct roc_state *rs, const struct cmd_roc *roc)
tab_headers (tbl, n_cols - n_fields, 0, 1, 0);
tab_headers (tbl, n_cols - n_fields, 0, 1, 0);
- tab_dim (tbl, tab_natural_dimensions, NULL, NULL);
tab_text (tbl, n_cols - n_fields, 1, TAT_TITLE, _("Area"));
tab_text (tbl, n_cols - n_fields, 1, TAT_TITLE, _("Area"));
@@
-1028,8
+1029,6
@@
show_summary (const struct cmd_roc *roc)
tab_headers (tbl, 1, 0, 2, 0);
tab_headers (tbl, 1, 0, 2, 0);
- tab_dim (tbl, tab_natural_dimensions, NULL, NULL);
-
tab_box (tbl,
TAL_2, TAL_2,
-1, -1,
tab_box (tbl,
TAL_2, TAL_2,
-1, -1,
@@
-1090,8
+1089,6
@@
show_coords (struct roc_state *rs, const struct cmd_roc *roc)
tab_headers (tbl, 1, 0, 1, 0);
tab_headers (tbl, 1, 0, 1, 0);
- tab_dim (tbl, tab_natural_dimensions, NULL, NULL);
-
tab_hline (tbl, TAL_2, 0, n_cols - 1, 1);
if ( roc->n_vars > 1)
tab_hline (tbl, TAL_2, 0, n_cols - 1, 1);
if ( roc->n_vars > 1)
@@
-1168,7
+1165,7
@@
output_roc (struct roc_state *rs, const struct cmd_roc *roc)
for (i = 0; i < roc->n_vars; i++)
roc_chart_add_var (rc, var_get_name (roc->vars[i]),
rs[i].cutpoint_rdr);
for (i = 0; i < roc->n_vars; i++)
roc_chart_add_var (rc, var_get_name (roc->vars[i]),
rs[i].cutpoint_rdr);
-
chart_submit (roc_chart_get_chart (rc)
);
+
roc_chart_submit (rc
);
}
show_auc (rs, roc);
}
show_auc (rs, roc);