import theanoml
reload(theanoml)
<module 'theanoml' from 'theanoml/__init__.pyc'>
## load data - MNIST
import cPickle
X, y = cPickle.load(open('data/digits.pkl', 'rb'))
print X.shape, y.shape
(42000, 784) (42000,)
import theanoml
reload(theanoml.lenet)
reload(theanoml.formula)
clf = theanoml.lenet.LeNetClassifier(image_size=(28,28), n_classes=10)
clf.fit(X[:5000], y[:5000])
print clf.score(X[:1000], y[:1000])
epoch 1, minibatch 5 / 8, validation error 73.600000 % epoch 2, minibatch 2 / 8, validation error 45.800000 % epoch 2, minibatch 7 / 8, validation error 47.600000 % optimization complete with best valiation error 45.800000 % 0.645
The prediction() in LeNetClassifierFormula does NOT look right
## Load data - blackbox
import cPickle
import numpy as np
import math
X, y = cPickle.load(open('data/blackbox.pkl', 'rb'))
y = y - 1
X = X[:, :43*43]
classes = np.unique(y)
print X.shape, math.sqrt(X.shape[1]), y.shape, classes
(1000, 1849) 43.0 (1000,) [0 1 2 3 4 5 6 7 8]
import theanoml
reload(theanoml.lenet)
reload(theanoml.formula)
clf = theanoml.lenet.LeNetClassifier(image_size=(43,43), n_classes=len(classes), batch_size=15)
clf.partial_fit(X, y)
print clf.score(X, y)
epoch 1, minibatch 5 / 53, validation error 86.153846 % epoch 1, minibatch 10 / 53, validation error 79.487179 % epoch 1, minibatch 15 / 53, validation error 79.487179 % optimization complete with best valiation error 79.487179 % 0.0