Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Created January 12, 2020 11:42
Show Gist options
  • Save jamescalam/eb79cda53ff1a079a2671daccfc9805d to your computer and use it in GitHub Desktop.
Save jamescalam/eb79cda53ff1a079a2671daccfc9805d to your computer and use it in GitHub Desktop.
Example code snippet for Naive Bayes fundamentals article, part [4]
def std(x, mu):
# calculate standard deviation (in reality np.std(x))
return np.sqrt(sum(np.power(np.subtract(x, mu), 2)) / len(x))
std_less = np.std(less, mean_less)
std_more = np.std(more, mean_more) # calculate standard deviation for both models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment