Skip to content

Instantly share code, notes, and snippets.

@zbriscoe
zbriscoe / 4x4naive_bayes.py
Created November 7, 2012 22:13 — forked from bwrsandman/4x4naive_bayes.py
4x4 naive bayes
#!/usr/bin/env python2
"""\
We are computing the probability of features 1 through 16.
Each feature represents a pixel in a 4 x 4 bitmap.
We are taking into account the probability that a pixel is black.
This simplifies calculations as the probability of white is equal to
the probability of !black.
"""
import numpy, math