torchml.naive_bayes

Classes

torchml.naive_bayes.GaussianNB

[Source]

Description

Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes' theorem with the “naive” assumption of conditional independence between every pair of features given the value of the class variable.

GaussianNB implements the Gaussian Naive Bayes algorithm for classification. The likelihood of the features is assumed to be Gaussian.

References
  1. H. Zhang (2004). The optimality of Naive Bayes. Proc. FLAIRS.
Arguments
  • priors : array-like of shape (n_classes,) Prior probabilities of the classes. If specified, the priors are not adjusted according to the data.
  • var_smoothing : float, default=1e-9 Portion of the largest variance of all features that is added to variances for calculation stability.
Example
clf = GaussianNB()
clf.fit(X_train, y_train)
clf.predict(X_test)

fit(self, X: torch.Tensor, y: torch.Tensor)

Arguments
  • X (Tensor) - Input variates.
  • y (Tensor) - Target covariates.
Example
clf = GaussianNB()
clf.fit(X_train, y_train)

predict(self, X: torch.Tensor)

Arguments
  • X (Tensor) - Input variates.
Example
clf = GaussianNB()
clf.fit(X_train, y_train)
clf.predict(X_test)