def cost(self, readouts, outputs): mu, sigma, coeff = self.components(readouts) #ipdb.set_trace() return GMM(outputs, mu, sigma, coeff)
bricks = [mlp_x, transition, mlp_gmm] for brick in bricks: brick.weights_init = IsotropicGaussian(0.01) brick.biases_init = Constant(0.) brick.initialize() ############## # Test model ############## x_g = mlp_x.apply(x) h = transition.apply(x_g) mu, sigma, coeff = mlp_gmm.apply(h[-2]) cost = GMM(y, mu, sigma, coeff) cost = cost.mean() cost.name = 'sequence_log_likelihood' cg = ComputationGraph(cost) model = Model(cost) ################# # Algorithm ################# n_batches = 139 * 16 algorithm = GradientDescent(cost=cost, parameters=cg.parameters, step_rule=CompositeRule(