def geometric_mean_prediction(forward_props):
 presoftmax = []
 for out in forward_props:
  assert isinstance(out.owner.op, T.nnet.Softmax)
  assert (len(out.owner.inputs) == 1)
  presoftmax.append(out.owner.inputs[0])
 average = (reduce(operator.add, presoftmax) / float(len(presoftmax)))
 return T.nnet.softmax(average)

def geometric_mean_prediction ( forward_props ) : presoftmax = [ ] for out in forward_props : assert isinstance ( out . owner . op , T . nnet . Softmax ) assert ( len ( out . owner . inputs ) == 1 ) presoftmax . append ( out . owner . inputs [ 0 ] ) average = ( reduce ( operator . add , presoftmax ) / float ( len ( presoftmax ) ) ) return T . nnet . softmax ( average )
take the geometric mean over all dropout masks of an mlp with softmax outputs .