jashmenn-apriori 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +121 -0
- data/README.txt +139 -0
- data/Rakefile +4 -0
- data/TODO.txt +60 -0
- data/attic/c_ext_test1/MyTest/MyTest.c +23 -0
- data/attic/c_ext_test1/MyTest/extconf.rb +11 -0
- data/attic/c_ext_test1/mytest.rb +10 -0
- data/attic/test.c +12 -0
- data/config/hoe.rb +77 -0
- data/config/requirements.rb +15 -0
- data/examples/01_simple_example.rb +23 -0
- data/examples/02_small_file_example.rb +17 -0
- data/examples/03_large_file_example.rb +22 -0
- data/examples/test_data/market_basket_basic_test.dat +9 -0
- data/ext/Apriori.c +149 -0
- data/ext/Makefile +149 -0
- data/ext/apriori/doc/apriori.html +1301 -0
- data/ext/apriori/doc/arem.gp +68 -0
- data/ext/apriori/doc/c_rev.gp +89 -0
- data/ext/apriori/doc/chi2.tex +156 -0
- data/ext/apriori/doc/copying +504 -0
- data/ext/apriori/doc/line.gif +0 -0
- data/ext/apriori/doc/uparrow.gif +0 -0
- data/ext/apriori/ex/flg2set +15 -0
- data/ext/apriori/ex/hdr2set +13 -0
- data/ext/apriori/ex/readme +71 -0
- data/ext/apriori/ex/row2set +7 -0
- data/ext/apriori/ex/rulesort +24 -0
- data/ext/apriori/ex/tab2set +9 -0
- data/ext/apriori/ex/test.app +2 -0
- data/ext/apriori/ex/test.rul +9 -0
- data/ext/apriori/ex/test1.rul +43 -0
- data/ext/apriori/ex/test1.tab +10 -0
- data/ext/apriori/ex/test2.tab +10 -0
- data/ext/apriori/ex/test3.tab +30 -0
- data/ext/apriori/ex/test4.tab +11 -0
- data/ext/apriori/ex/test5.tab +39 -0
- data/ext/apriori/ex/tid2set +23 -0
- data/ext/apriori/ex/xhdr2set +33 -0
- data/ext/apriori/src/apriori.c +750 -0
- data/ext/apriori/src/apriori.dsp +120 -0
- data/ext/apriori/src/apriori.dsw +29 -0
- data/ext/apriori/src/apriori.mak +99 -0
- data/ext/apriori/src/istree.c +1411 -0
- data/ext/apriori/src/istree.h +160 -0
- data/ext/apriori/src/makefile +105 -0
- data/ext/apriori/src/tract.c +870 -0
- data/ext/apriori/src/tract.h +261 -0
- data/ext/apriori_wrapper.c +757 -0
- data/ext/apriori_wrapper.h +10 -0
- data/ext/extconf.rb +32 -0
- data/ext/math/doc/copying +504 -0
- data/ext/math/src/chi2.c +151 -0
- data/ext/math/src/chi2.h +27 -0
- data/ext/math/src/choose.c +71 -0
- data/ext/math/src/choose.h +16 -0
- data/ext/math/src/gamma.c +446 -0
- data/ext/math/src/gamma.h +39 -0
- data/ext/math/src/intexp.c +35 -0
- data/ext/math/src/intexp.h +15 -0
- data/ext/math/src/makefile +164 -0
- data/ext/math/src/math.mak +48 -0
- data/ext/math/src/normal.c +387 -0
- data/ext/math/src/normal.h +44 -0
- data/ext/math/src/radfn.c +113 -0
- data/ext/math/src/radfn.h +34 -0
- data/ext/math/src/zeta.c +49 -0
- data/ext/math/src/zeta.h +15 -0
- data/ext/pre-clean.rb +8 -0
- data/ext/pre-setup.rb +9 -0
- data/ext/util/doc/copying +504 -0
- data/ext/util/src/listops.c +76 -0
- data/ext/util/src/listops.h +26 -0
- data/ext/util/src/makefile +103 -0
- data/ext/util/src/memsys.c +84 -0
- data/ext/util/src/memsys.h +42 -0
- data/ext/util/src/nstats.c +288 -0
- data/ext/util/src/nstats.h +69 -0
- data/ext/util/src/params.c +86 -0
- data/ext/util/src/params.h +19 -0
- data/ext/util/src/parse.c +133 -0
- data/ext/util/src/parse.h +81 -0
- data/ext/util/src/scan.c +767 -0
- data/ext/util/src/scan.h +111 -0
- data/ext/util/src/symtab.c +443 -0
- data/ext/util/src/symtab.h +121 -0
- data/ext/util/src/tabscan.c +279 -0
- data/ext/util/src/tabscan.h +99 -0
- data/ext/util/src/util.mak +91 -0
- data/ext/util/src/vecops.c +317 -0
- data/ext/util/src/vecops.h +42 -0
- data/lib/apriori/adapter.rb +13 -0
- data/lib/apriori/association_rule.rb +85 -0
- data/lib/apriori/version.rb +9 -0
- data/lib/apriori.rb +133 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/tasks/apriori.rake +20 -0
- data/tasks/attic.rake +28 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/install.rake +6 -0
- data/tasks/website.rake +17 -0
- data/test/apriori_test.rb +13 -0
- data/test/fixtures/market_basket_results_test.txt +5 -0
- data/test/fixtures/market_basket_string_test.txt +7 -0
- data/test/fixtures/results.txt +2 -0
- data/test/fixtures/sample.txt +7 -0
- data/test/test_helper.rb +5 -0
- data/test/unit/test_apriori.rb +68 -0
- data/test/unit/test_itemsets_and_parsing.rb +82 -0
- data/website/index.html +233 -0
- data/website/index.txt +142 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +142 -0
- data/website/template.html.erb +49 -0
- metadata +188 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
/*----------------------------------------------------------------------
|
2
|
+
File : params.h
|
3
|
+
Contents: command line parameter retrieval
|
4
|
+
Author : Christian Borgelt
|
5
|
+
History : 2003.06.05 file created
|
6
|
+
----------------------------------------------------------------------*/
|
7
|
+
#ifndef __PARAMS__
|
8
|
+
#define __PARAMS__
|
9
|
+
|
10
|
+
/*----------------------------------------------------------------------
|
11
|
+
Functions
|
12
|
+
----------------------------------------------------------------------*/
|
13
|
+
extern int getints (char *s, char **end, int n, ...);
|
14
|
+
extern int getdbls (char *s, char **end, int n, ...);
|
15
|
+
|
16
|
+
extern int getintvec (char *s, char **end, int n, int *p);
|
17
|
+
extern int getdblvec (char *s, char **end, int n, double *p);
|
18
|
+
|
19
|
+
#endif
|
@@ -0,0 +1,133 @@
|
|
1
|
+
/*----------------------------------------------------------------------
|
2
|
+
File : parse.h
|
3
|
+
Contents: parser utilities
|
4
|
+
Author : Christian Borgelt
|
5
|
+
History : 2004.08.12 file created
|
6
|
+
2006.02.02 error E_EDGE added
|
7
|
+
2007.01.16 error E_MSDCNT added
|
8
|
+
----------------------------------------------------------------------*/
|
9
|
+
#include <string.h>
|
10
|
+
#include <assert.h>
|
11
|
+
#include "parse.h"
|
12
|
+
|
13
|
+
/*----------------------------------------------------------------------
|
14
|
+
Constants
|
15
|
+
----------------------------------------------------------------------*/
|
16
|
+
#ifdef GERMAN /* deutsche Texte */
|
17
|
+
static const char *errmsgs[] = { /* Fehlermeldungen */
|
18
|
+
/* E_CHREXP -16 */ "\"%c\" erwartet statt %s",
|
19
|
+
/* E_STREXP -17 */ "\"%s\" erwartet statt %s",
|
20
|
+
/* E_NUMEXP -18 */ "Zahl erwartet statt %s",
|
21
|
+
/* E_NUMBER -19 */ "ungültige Zahl %s",
|
22
|
+
|
23
|
+
/* E_ATTEXP -20 */ "Attribut erwartet statt %s",
|
24
|
+
/* E_UNKATT -21 */ "unbekanntes Attribut %s",
|
25
|
+
/* E_DUPATT -22 */ "doppeltes Attribut %s",
|
26
|
+
/* E_MISATT -23 */ "Attribut %s fehlt",
|
27
|
+
/* E_ATTRIB -24 */ "ungültiges Attribut %s",
|
28
|
+
/* E_ATTYPE -25 */ "Attribut %s hat falschen Typ",
|
29
|
+
|
30
|
+
/* E_VALEXP -26 */ "Attributwert erwartet statt %s",
|
31
|
+
/* E_UNKVAL -27 */ "unbekannter Attributwert %s",
|
32
|
+
/* E_DUPVAL -28 */ "doppelter Attributwert %s",
|
33
|
+
/* E_MISVAL -29 */ "fehlender Attributwert %s",
|
34
|
+
|
35
|
+
/* E_CLSEXP -30 */ "Klassenattribut erwartet statt %s",
|
36
|
+
/* E_UNKCLS -31 */ "unbekannte Klasse %s",
|
37
|
+
/* E_DUPCLS -32 */ "doppelte Klasse %s",
|
38
|
+
/* E_MISCLS -33 */ "Klasse %s fehlt",
|
39
|
+
/* E_CLSTYPE -34 */ "Klassenattribut %s hat falschen Typ",
|
40
|
+
/* E_CLSCNT -35 */ "Klassenattribut %s hat zu wenige Werte",
|
41
|
+
|
42
|
+
/* E_DOMAIN -36 */ "ungültiger Wertebereich %s",
|
43
|
+
|
44
|
+
/* E_PAREXP -37 */ "Parameter erwartet statt %s",
|
45
|
+
/* E_CMPOP -38 */ "ungültiger Vergleichsoperator %s",
|
46
|
+
/* E_COVMAT -39 */ "ungültige Kovarianzmatrix",
|
47
|
+
|
48
|
+
/* E_DUPCDL -40 */ "doppelte Kandidatenliste für Attribut %s\n",
|
49
|
+
/* E_RANGE -41 */ "ungültiger Kandidatenbereich",
|
50
|
+
/* E_CAND -42 */ "ungültiger Kandidat %s",
|
51
|
+
/* E_LINK -43 */ "ungültiger Verweis",
|
52
|
+
|
53
|
+
/* E_LYRCNT -44 */ "ungültige Anzahl Schichten",
|
54
|
+
/* E_UNITCNT -45 */ "ungültige Anzahl Einheiten",
|
55
|
+
|
56
|
+
/* E_EDGE -46 */ "ungültiger Kantentyp %s",
|
57
|
+
|
58
|
+
/* E_MSDCNT -47 */ "falsche Anzahl Zugehörigkeitsgrade",
|
59
|
+
};
|
60
|
+
#else /* English texts */
|
61
|
+
static const char *errmsgs[] = { /* error messages */
|
62
|
+
/* E_CHREXP -16 */ "\"%c\" expected instead of %s",
|
63
|
+
/* E_STREXP -17 */ "\"%s\" expected instead of %s",
|
64
|
+
/* E_NUMEXP -18 */ "number expected instead of %s",
|
65
|
+
/* E_NUMBER -19 */ "invalid number %s",
|
66
|
+
|
67
|
+
/* E_ATTEXP -20 */ "attribute expected instead of %s",
|
68
|
+
/* E_UNKATT -21 */ "unknown attribute %s",
|
69
|
+
/* E_DUPATT -22 */ "duplicate attribute %s",
|
70
|
+
/* E_MISATT -23 */ "missing attribute %s",
|
71
|
+
/* E_ATTRIB -24 */ "invalid attribute %s",
|
72
|
+
/* E_ATTYPE -25 */ "attribute %s has wrong type",
|
73
|
+
|
74
|
+
/* E_VALEXP -26 */ "attribute value expected instead of %s",
|
75
|
+
/* E_UNKVAL -27 */ "unknown attribute value %s",
|
76
|
+
/* E_DUPVAL -28 */ "duplicate attribute value %s",
|
77
|
+
/* E_MISVAL -29 */ "missing attribute value %s",
|
78
|
+
|
79
|
+
/* E_CLSEXP -30 */ "class value expected instead of %s",
|
80
|
+
/* E_UNKCLS -31 */ "unknown class value %s",
|
81
|
+
/* E_DUPCLS -32 */ "duplicate class value %s",
|
82
|
+
/* E_MISCLS -33 */ "missing class value %s",
|
83
|
+
/* E_CLSTYPE -34 */ "class attribute %s has wrong type",
|
84
|
+
/* E_CLSCNT -35 */ "class attribute %s has too few values",
|
85
|
+
|
86
|
+
/* E_DOMAIN -36 */ "invalid attribute domain %s",
|
87
|
+
|
88
|
+
/* E_PAREXP -37 */ "parameter expected instead of %s",
|
89
|
+
/* E_CMPOP -38 */ "invalid comparison operator %s",
|
90
|
+
/* E_COVMAT -39 */ "invalid covariance matrix",
|
91
|
+
|
92
|
+
/* E_DUPCDL -40 */ "duplicate candidate list for attribute %s\n",
|
93
|
+
/* E_RANGE -41 */ "invalid candidate range",
|
94
|
+
/* E_CAND -42 */ "invalid candidate %s",
|
95
|
+
/* E_LINK -43 */ "invalid link",
|
96
|
+
|
97
|
+
/* E_LYRCNT -44 */ "invalid number of layers",
|
98
|
+
/* E_UNITCNT -45 */ "invalid number of units",
|
99
|
+
|
100
|
+
/* E_EDGE -46 */ "invalid edge type %s",
|
101
|
+
|
102
|
+
/* E_MSDCNT -47 */ "wrong number of membership degrees",
|
103
|
+
};
|
104
|
+
#endif
|
105
|
+
#define MSGCNT (int)(sizeof(errmsgs)/sizeof(const char*))
|
106
|
+
|
107
|
+
/*----------------------------------------------------------------------
|
108
|
+
Functions
|
109
|
+
----------------------------------------------------------------------*/
|
110
|
+
|
111
|
+
void pa_init (SCAN *scan) /* --- initialize parsing */
|
112
|
+
{ sc_errmsgs(scan, errmsgs, MSGCNT); }
|
113
|
+
|
114
|
+
/*--------------------------------------------------------------------*/
|
115
|
+
|
116
|
+
int pa_error (SCAN *scan, int code, int c, const char *s)
|
117
|
+
{ /* --- report a parse error */
|
118
|
+
char src[256], dst[1024]; /* buffers for string formating */
|
119
|
+
|
120
|
+
assert(scan); /* check the function arguments */
|
121
|
+
if (((code == E_DUPATT) || (code == E_MISATT)
|
122
|
+
|| (code == E_DUPVAL) || (code == E_MISVAL)
|
123
|
+
|| (code == E_DUPCLS) || (code == E_MISCLS)
|
124
|
+
|| (code == E_CAND)) && s)
|
125
|
+
sc_format(dst, s, 1); /* if "missing ..." error message, */
|
126
|
+
else { /* format the given name */
|
127
|
+
strncpy(src, sc_value(scan), 255); src[255] = '\0';
|
128
|
+
sc_format(dst, src, 1); /* if normal error message, */
|
129
|
+
} /* copy and format the token value */
|
130
|
+
if (code == E_CHREXP) return sc_error(scan, code, c, dst);
|
131
|
+
else if (code == E_STREXP) return sc_error(scan, code, s, dst);
|
132
|
+
else return sc_error(scan, code, dst);
|
133
|
+
} /* _paerr() */ /* print an error message */
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*----------------------------------------------------------------------
|
2
|
+
File : parse.h
|
3
|
+
Contents: parser utilities
|
4
|
+
Author : Christian Borgelt
|
5
|
+
History : 2004.08.12 file created
|
6
|
+
2006.02.02 error E_EDGE added
|
7
|
+
2007.01.16 error E_MSDCNT added
|
8
|
+
----------------------------------------------------------------------*/
|
9
|
+
#ifndef __PARSE__
|
10
|
+
#define __PARSE__
|
11
|
+
#ifndef SC_SCAN
|
12
|
+
#define SC_SCAN
|
13
|
+
#endif
|
14
|
+
#include "scan.h"
|
15
|
+
|
16
|
+
/*----------------------------------------------------------------------
|
17
|
+
Preprocessor Definitions
|
18
|
+
----------------------------------------------------------------------*/
|
19
|
+
/* --- error codes --- */
|
20
|
+
#define E_CHREXP (-16) /* character expected */
|
21
|
+
#define E_STREXP (-17) /* string expected */
|
22
|
+
#define E_NUMEXP (-18) /* number expected */
|
23
|
+
#define E_NUMBER (-19) /* invalid number */
|
24
|
+
|
25
|
+
#define E_ATTEXP (-20) /* attribute expected */
|
26
|
+
#define E_UNKATT (-21) /* unknown attribute */
|
27
|
+
#define E_DUPATT (-22) /* duplicate attribute value */
|
28
|
+
#define E_MISATT (-23) /* missing attribute */
|
29
|
+
#define E_ATTRIB (-24) /* invalid attribute */
|
30
|
+
#define E_ATTYPE (-25) /* wrong attribute type */
|
31
|
+
|
32
|
+
#define E_VALEXP (-26) /* attribute value expected */
|
33
|
+
#define E_UNKVAL (-27) /* unknown attribute value */
|
34
|
+
#define E_DUPVAL (-28) /* duplicate attribute value */
|
35
|
+
#define E_MISVAL (-29) /* missing attribute value */
|
36
|
+
|
37
|
+
#define E_CLSEXP (-30) /* class value expected */
|
38
|
+
#define E_UNKCLS (-31) /* unknown class value */
|
39
|
+
#define E_DUPCLS (-32) /* duplicate class value */
|
40
|
+
#define E_MISCLS (-33) /* missing class value */
|
41
|
+
#define E_CLSTYPE (-34) /* class attribute must be nominal */
|
42
|
+
#define E_CLSCNT (-35) /* class attribute has too few values */
|
43
|
+
|
44
|
+
#define E_DOMAIN (-36) /* invalid attribute domain */
|
45
|
+
|
46
|
+
#define E_PAREXP (-37) /* parameter expected */
|
47
|
+
#define E_CMPOP (-38) /* invalid comparison operator */
|
48
|
+
#define E_COVMAT (-39) /* invalid covariance matrix */
|
49
|
+
|
50
|
+
#define E_DUPCDL (-40) /* duplicate candidate list */
|
51
|
+
#define E_RANGE (-41) /* invalid candidate range */
|
52
|
+
#define E_CAND (-42) /* invalid candidate */
|
53
|
+
#define E_LINK (-43) /* invalid link */
|
54
|
+
|
55
|
+
#define E_LYRCNT (-44) /* invalid number of layers */
|
56
|
+
#define E_UNITCNT (-45) /* invalid number of units */
|
57
|
+
|
58
|
+
#define E_EDGE (-46) /* invalid edge type */
|
59
|
+
|
60
|
+
#define E_MSDCNT (-47) /* wrong number of membership degrees */
|
61
|
+
|
62
|
+
/*----------------------------------------------------------------------
|
63
|
+
Functions
|
64
|
+
----------------------------------------------------------------------*/
|
65
|
+
extern void pa_init (SCAN *scan);
|
66
|
+
extern int pa_error (SCAN *scan, int code, int c, const char *s);
|
67
|
+
|
68
|
+
/*----------------------------------------------------------------------
|
69
|
+
Preprocessor Definitions
|
70
|
+
----------------------------------------------------------------------*/
|
71
|
+
#define ERROR(c) return pa_error(scan, c, -1, NULL)
|
72
|
+
#define XERROR(c,s) return pa_error(scan, c, -1, s)
|
73
|
+
#define ERR_CHR(c) return pa_error(scan, E_CHREXP, c, NULL)
|
74
|
+
#define ERR_STR(s) return pa_error(scan, E_STREXP, -1, s)
|
75
|
+
#define GET_TOK() if (sc_next(scan) < 0) \
|
76
|
+
return sc_error(scan, sc_token(scan))
|
77
|
+
#define GET_CHR(c) if (sc_token(scan) != (c)) ERR_CHR(c); \
|
78
|
+
else GET_TOK()
|
79
|
+
#define RECOVER() if (sc_recover(scan, ';', '{', '}', 0) == T_EOF) \
|
80
|
+
return 1
|
81
|
+
#endif
|