Naive Bayes classifier - Wikipedia, the free encyclopedia var BayesFilter = function(aMemory){ this._memory = aMemory || { t: 0, f: 0, prior: {} }; }; BayesFilter.prototype = { getMemory: function(){ return this._memory; }, train: function(bool, params){ this._memory[bool ? "t" : "f"]++; params.forEach(function(v){ if (!this._memory.prior[v]) { this._memory.prior[v] = { t: 0, f: 0 }; } this._memor