diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-08-13 18:50:29 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-08-13 18:50:29 +0400 |
commit | 868842d9c133e8823365386200f5c48442a068b5 (patch) | |
tree | 9a6961134b6d5612e870142069166cdbb5ed2ca8 /src/classifiers/classifiers.h | |
parent | 9aa989ea76ee78107ed7ae02a3d1b8e297f57b4c (diff) | |
download | rspamd-868842d9c133e8823365386200f5c48442a068b5.tar.gz rspamd-868842d9c133e8823365386200f5c48442a068b5.zip |
* Add bayesian classifier (initial version)
Diffstat (limited to 'src/classifiers/classifiers.h')
-rw-r--r-- | src/classifiers/classifiers.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/classifiers/classifiers.h b/src/classifiers/classifiers.h index f69c1284c..0e6df173a 100644 --- a/src/classifiers/classifiers.h +++ b/src/classifiers/classifiers.h @@ -6,6 +6,9 @@ #include "../statfile.h" #include "../tokenizers/tokenizers.h" +/* Consider this value as 0 */ +#define ALPHA 0.0001 + struct classifier_config; struct worker_task; @@ -41,7 +44,12 @@ gboolean winnow_learn (struct classifier_ctx* ctx, statfile_pool_t *pool, const gboolean in_class, double *sum, double multiplier, GError **err); GList *winnow_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task); - +/* Bayes algorithm */ +struct classifier_ctx* bayes_init (memory_pool_t *pool, struct classifier_config *cf); +gboolean bayes_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task); +gboolean bayes_learn (struct classifier_ctx* ctx, statfile_pool_t *pool, const char *symbol, GTree *input, + gboolean in_class, double *sum, double multiplier, GError **err); +GList *bayes_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task); /* Array of all defined classifiers */ extern struct classifier classifiers[]; |