Just a collection of python functions I think I'll need more than once.
The quality varies wildly across functions and I do not intend to make this usable by anyone besides myself in the foreseeable future. You've been warned.
A bunch of matplotlib plots that I seem to use over and over again.
Create filterbanks as tuples of np.array
s. Available filterbanks:
- Difference of oriented Gaussians (DooG)
IPython interactive progressbar. TODO: update to new interactive widget.
Utility to very simply time things, including parts of loops. Use as follows:
c = Chrono()
for e in range(10):
with c.measure("transmogrifying"):
tm = transmogrify(e)
with c.measure("plotting"):
plot(tm)
print(c)
print(c.avgtime("plotting"))
Layers and other stuff for making neural networks with Theano.
This stuff is still highly in flux while I'm figuring out The Right Way to implement most of this stuff in a as reusable and as orthogonal way as possible.
I will soon add example notebooks and scripts. The following are quick references to get the big picture.
Create a model class or use one of those in nnet_models.py
, then:
model = MyModel(imshape=(1,28,28), batchsize=1000, npred=10)
model_bgd = lbnn.BatchGradDescent(model)
model_bgd_trainer = lbnn.BGDTrainer(model_bgd)
'{:.3f}M params'.format(lbthutil.count_params(model)/1000000)
model_bgd_trainer.fit(Xtr, ytr, Xva, yva, Xte, yte,
lr0=0.01, lr_decrease=2, max_reducs=20, valid_freq=5, test_freq=10,
skip_initial=True, skip_final=True)
Create the pipeline via
aug = lbaug.AugmentationPipeline((32,32), Xtr, ytr,
lbaug.HorizontalFlipper(),
lbaug.Rotator(0, 180, 5),
lbaug.Cropper((28,28))
)
then pass it to the fit
function as parameter aug=aug
and, if it includes a
resizing augmentation, be sure to create the model using aug.outshape()
as
image-shape, not the original image-shape.
Minor utilities for working with Theano. Currently checks for GPU.
Install nanomsg
, then pip install nnpy
(needs libffi-dev
).