Created
April 10, 2020 08:46
-
-
Save tarlanahad/47b74dddf89be8da9b8639c9a44ef2ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fit(self): | |
for c in self.classes: | |
x_c = self.X[c == self.y] # Get a feature vector that belongs to the class | |
self.means.append(x_c.mean(axis=0)) # axis = 0 => column-wise Mean | |
self.stds.append(x_c.std(axis=0)) # axis = 0 => column-wise STD | |
self.priors.append(len(x_c) / len(self.X)) # Calculate frequency of each class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment