Repository navigation
https://luarocks.org/modules/leafo/lapis-bayes
Added
doc_countcolumn on categories, the number of documents trained into the category. Requires a migration, see below.normalize_doc_countoption forBayesClassifier: compares per-document word rates with a uniform prior, so an unbalanced training set doesn't bias every shared word toward the larger category. Requiresdoc_counton both categories.
Changed
increment_wordsanddecrement_wordstake an optionalopts.doc_count(default1) and update the category'sdoc_count.Categories:incrementtakes an optional second argument for incrementingdoc_count.
Upgrading
Add a migration that calls run_migrations again, then run lapis migrate:
[1792300000] = require("lapis.bayes.schema").run_migrations,Existing categories will have a doc_count of 0. Retrain or backfill them before using normalize_doc_count.
Full Changelog: v1.6.0...v1.7.0