Source

Gaussian Naive Bayes#

A version of the Naive Bayes classifier that places a probability density function over continuous features which are assumed to be normally (Gaussian) distributed.

Interfaces: Estimator, Learner, Online, Probabilistic, Persistable

Data Type Compatibility: Continuous

Parameters#

# Param Default Type Description
1 priors Auto array The user-defined class prior probabilities as an associative array with class labels as keys and the prior probabilities as values.

Additional Methods#

Return the class prior probabilities:

public priors() : array

Return the running mean of each feature column for each class:

public means() : ?array

Return the running variance of each feature column for each class:

public variances() : ?array

Example#

use Rubix\ML\Classifiers\GaussianNB;

$estimator = new GaussianNB([
    'benign' => 0.9,
    'malignant' => 0.1,
]);

References#

  • T. F. Chan et al. (1979). Updating Formulae and a Pairwise Algorithm for Computing Sample Variances.