Skip to content

Instantly share code, notes, and snippets.

@LastZactionHero
Created June 20, 2016 11:37
Show Gist options
  • Save LastZactionHero/411975006737f7055a3da6cbfedc7663 to your computer and use it in GitHub Desktop.
Save LastZactionHero/411975006737f7055a3da6cbfedc7663 to your computer and use it in GitHub Desktop.
from sklearn import linear_model
Y = np.array(Y) # array of training answers, 1 or 0
X = np.array([]) # array of image brightness
for filename in filenames:
# load the images
image = misc.imread(constants.IMAGE_64_PATH + '/' + filename, mode='L')
avg_brightness = np.matrix(image).mean()
X = np.append(X, avg_brightness)
X = np.array([X]).transpose()
clf = linear_model.LogisticRegression(C=1e5)
clf.fit(X, Y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment