Package pylearn :: Package sandbox :: Package sparse_random_autoassociator :: Module graph
[hide private]

Module graph

source code

Theano graph for an autoassociator for sparse inputs, which will be trained using Ronan Collobert + Jason Weston's sampling trick (2008).


To Do: Make nearly everything private.

Functions [hide private]
 
hingeloss(MARGIN) source code
Variables [hide private]
  xnonzero = t.dvector()
  w1nonzero = t.dmatrix()
  b1 = t.dvector()
  w2nonzero = t.dmatrix()
  w2zero = t.dmatrix()
  b2nonzero = t.dvector()
  b2zero = t.dvector()
  h = sigmoid(dot(xnonzero, w1nonzero)+ b1)
  ynonzero = sigmoid(dot(h, w2nonzero)+ b2nonzero)
  yzero = sigmoid(dot(h, w2zero)+ b2zero)
  nonzeroloss = hingeloss(ynonzero-t.max(yzero)-MARGIN)
  zeroloss = hingeloss(-t.max(-(ynonzero))-yzero-MARGIN)
  loss = t.sum(nonzeroloss)+ t.sum(zeroloss)
  inputs = [xnonzero, w1nonzero, b1, w2nonzero, w2zero, b2nonzer...
  outputs = [ynonzero, yzero, loss, gw1nonzero, gb1, gw2nonzero,...
  trainfn = theano.compile.function(inputs, outputs)

Imports: MARGIN, sigmoid, binary_crossentropy, t, dot, theano


Variables Details [hide private]

inputs

Value:
[xnonzero, w1nonzero, b1, w2nonzero, w2zero, b2nonzero, b2zero]

outputs

Value:
[ynonzero, yzero, loss, gw1nonzero, gb1, gw2nonzero, gw2zero, gb2nonze\
ro, gb2zero]