com.danylchuk.swiftlearner.bayes
We don't need the exact probabilities here, only some likelihood weights for picking the most likely class.
We don't need the exact probabilities here, only some likelihood weights for picking the most likely class. So we take the probability density values, and add them in log space instead of multiplying, to avoid type underflow from multiplying many small fractional values.
Map(class -> likelihood): weights for belonging to each class given the parameters.
Map by class: sequence of (mean, variance) for each parameter.
Predicts the most likely class given the parameters.
Gaussian naive Bayes classifier.
You can create it first time with fromTrainingSet(), then reuse the learned values if you like with the constructor.
Ref: https://en.wikipedia.org/wiki/Naive_Bayes_classifier http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/