Expand description
ML-based transaction categorization.
Trains a Multinomial Naive Bayes classifier on existing ledger transactions to predict the expense/income account for new transactions based on their payee and narration text.
Uses TF-IDF vectorization plus a small, self-contained Multinomial
Naive Bayes classifier (see MultinomialNB) implemented in pure
std — no external ML or linear-algebra crates. Earlier versions
delegated to linfa-bayes and then ferrolearn-bayes, but both
dragged heavy, occasionally wasm-incompatible dependencies in for an
algorithm that is ~80 lines of textbook arithmetic.
§Example
ⓘ
let model = CategorizationModel::train(&existing_directives)?;
let predictions = model.predict("WHOLE FOODS", Some("groceries"));
// → [("Expenses:Groceries", 0.92), ("Expenses:Dining", 0.05), ...]Structs§
- Categorization
Model - A trained categorization model.
Enums§
- MlError
- Error type for ML operations.