Skip to content

Instantly share code, notes, and snippets.

@tarlanahad
Last active April 10, 2020 08:43
Show Gist options
  • Save tarlanahad/6272d58ea53954c45a0275f76889f6c6 to your computer and use it in GitHub Desktop.
Save tarlanahad/6272d58ea53954c45a0275f76889f6c6 to your computer and use it in GitHub Desktop.
import numpy as np
class NaiveBayes:
def __init__(self, X, y):
self.priors = [] # List of priors - P(y) for each class
self.stds = [] # List of STDs of feature columns
self.means = [] # List of Mean of feature columns
self.classes = np.unique(y) # unique class labels
self.X = X
self.y = y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment