Update of /cvsroot/monetdb/pathfinder/modules/pftijah
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10700
Modified Files:
nexi.c nexi.h nexi_generate_mil.c pftijah.mx
Log Message:
Added log length prior, the prior probability of an element is proportional to
the logarithm of its size:
RSV = contentscore * log(elem_size)
or rather
RSV = log(contentscore) + log(log(elem_size))
Index: nexi_generate_mil.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/nexi_generate_mil.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- nexi_generate_mil.c 14 Aug 2007 13:37:22 -0000 1.36
+++ nexi_generate_mil.c 14 Aug 2007 13:55:47 -0000 1.37
@@ -625,10 +625,12 @@
case P_PRIOR:
com_nr_left = p_com->left->number;
-
- MILPRINTF(MILOUT, "R%d := R%d.prior_ls(%d,qenv);\n", com_num,
com_nr_left, txt_retr_model->size_type);
-
- break;
+ if (txt_retr_model->prior_type == LOG_LENGTH_PRIOR) {
+ MILPRINTF(MILOUT, "R%d := R%d.prior_logls(%d,qenv);\n", com_num,
com_nr_left, txt_retr_model->size_type);
+ } else {
+ MILPRINTF(MILOUT, "R%d := R%d.prior_ls(%d,qenv);\n", com_num,
com_nr_left, txt_retr_model->size_type);
+ }
+ break;
case MUST_CONTAIN_T:
Index: nexi.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/nexi.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- nexi.h 14 Aug 2007 13:37:21 -0000 1.18
+++ nexi.h 14 Aug 2007 13:55:46 -0000 1.19
@@ -120,6 +120,7 @@
#define NO_PRIOR 1
#define LENGTH_PRIOR 2
#define LOG_NORMAL_PRIOR 3
+#define LOG_LENGTH_PRIOR 4
#define PREF_ELEM_SIZE 1000
Index: nexi.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/nexi.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- nexi.c 14 Aug 2007 13:37:21 -0000 1.70
+++ nexi.c 14 Aug 2007 13:55:46 -0000 1.71
@@ -462,6 +462,8 @@
} else if (strcmp(optName, "prior") == 0) {
if (strcasecmp(optVal, "LENGTH_PRIOR") == 0) {
txt_retr_model->prior_type = LENGTH_PRIOR;
+ } else if (strcasecmp(optVal, "LOG_LENGTH_PRIOR") == 0) {
+ txt_retr_model->prior_type = LOG_LENGTH_PRIOR;
} else {
txt_retr_model->prior_type = NO_PRIOR;
}
Index: pftijah.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/pftijah.mx,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- pftijah.mx 14 Aug 2007 13:37:22 -0000 1.152
+++ pftijah.mx 14 Aug 2007 13:55:48 -0000 1.153
@@ -2690,6 +2690,32 @@
#"Adds element prior based on element length to the region score.",
#"TIJAH");
+PROC prior_logls(bat region, int size_type, BAT[oid,str] qenv) : bat :=
+{
+
+ var ctx_size := new(oid,dbl,ENTITY_NUM);
+ var res_reg := new(oid,dbl,ENTITY_NUM);
+
+ if (size_type = SIZE_ENTITY) {
+ ctx_size := size_entity(region,qenv);
+ # Make sure sizes are not zero
+ ctx_size := [+](ctx_size, dbl(0.5));
+ } else if (size_type = SIZE_TERM) {
+ ctx_size := size_term(region,qenv);
+ # Make sure sizes are not zero
+ ctx_size := [+](ctx_size, dbl(0.5));
+ }
+
+ res_reg :=
[+]([log](region.select(dbl(0),dbl(nil),false,false)),[log]([log](ctx_size)));
+ res_reg :=
[-](region.select(dbl(0)).project(min(res_reg)),dbl(1)).kunion(res_reg);
+
+ return res_reg;
+
+}
+#ADDHELP("prior_logls", "thijs", "Aug, 2007,
+#"Adds element prior based on log element length to the region score.",
+#"TIJAH");
+
################################################################################
# OVERLAP REMOVAL
################################################################################
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins