#n_pivots = int(n_samples / 2) n_pivots = 200 # <codecell> # Theano expressions # parameters ps = breze.util.ParameterSet(P=(n_hidden, n_pivots), W=(n_targets, n_pivots), V=(n_hidden, n_features), l=(1,1)) # expressions srbf = StackedRBF(ps.P, ps.W, ps.V, ps.l) RL = srbf.regression_objective(RX, RZ) # functions f_RL = function(inputs=[ps.flat], outputs=RL) f_VL = function(inputs=[ps.flat], outputs=srbf.regression_objective(VX, VZ)) f_TL = function(inputs=[ps.flat], outputs=srbf.regression_objective(TX, TZ)) f_dRL = function(inputs=[ps.flat], outputs=T.grad(RL, ps.flat)) # <codecell> # initialize parameters ps.data[:] = np.random.random(ps.data.shape) - 0.5 ps['l'] = 2; # test Theano expressions print "Training loss: %f" % gp.as_numpy_array(f_RL(ps.data))