Naive Bayes

class sklego.naive_bayes.BayesianGaussianMixtureNB(n_components=1, covariance_type='full', tol=0.001, reg_covar=1e-06, max_iter=100, n_init=1, init_params='kmeans', weight_concentration_prior_type='dirichlet_process', weight_concentration_prior=None, mean_precision_prior=None, mean_prior=None, degrees_of_freedom_prior=None, covariance_prior=None, random_state=None, warm_start=False, verbose=0, verbose_interval=10)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.ClassifierMixin

The BayesianGaussianMixtureNB trains a Naive Bayes Classifier that uses a bayesian mixture of gaussians instead of merely training a single one.

You can pass any keyword parameter that scikit-learn’s Bayesian Gaussian Mixture Model uses and it will be passed along.

fit(X: numpy.array, y: numpy.array) → sklego.naive_bayes.BayesianGaussianMixtureNB[source]

Fit the model using X, y as training data.

Parameters:
  • X – array-like, shape=(n_columns, n_samples, ) training data.
  • y – array-like, shape=(n_samples, ) training data.
Returns:

Returns an instance of self.

predict(X)[source]
predict_proba(X: numpy.array)[source]
class sklego.naive_bayes.GaussianMixtureNB(n_components=1, covariance_type='full', tol=0.001, reg_covar=1e-06, max_iter=100, n_init=1, init_params='kmeans', weights_init=None, means_init=None, precisions_init=None, random_state=None, warm_start=False)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.ClassifierMixin

The GaussianMixtureNB trains a Naive Bayes Classifier that uses a mixture of gaussians instead of merely training a single one.

You can pass any keyword parameter that scikit-learn’s Gaussian Mixture Model uses and it will be passed along.

fit(X: numpy.array, y: numpy.array) → sklego.naive_bayes.GaussianMixtureNB[source]

Fit the model using X, y as training data.

Parameters:
  • X – array-like, shape=(n_columns, n_samples, ) training data.
  • y – array-like, shape=(n_samples, ) training data.
Returns:

Returns an instance of self.

predict(X)[source]
predict_proba(X: numpy.array)[source]