def train(self, method = 'ng', n_iters = 1, learning_rate = 0.1):
        # Do batch-gradient descent to learn the parameters.

        if self.batch_size > 0 and self.batch_size <= len(self.training_set_x):
            n_minibatches = int(len(self.training_set_x) / self.batch_size)
        else:
            n_minibatches = 1
            batch_size = len(self.training_set_x)

        m_minibatches = n_minibatches/10
        if m_minibatches <= 0:
            m_minibatches = 1

        if 'fixedlr' in method:
            print 'Minibatch size:', self.batch_size, '# minibatches:', n_minibatches, "# total data:", len(self.training_set_x)
            for ni in range(n_iters):
                for m in random.sample(range(n_minibatches), n_minibatches):
                    mini_x = self.training_set_x[m*self.batch_size:(m+1)%self.batch_size]
                    mini_y = self.training_set_y[m*self.batch_size:(m+1)*self.batch_size]

                    mini_x = self.frame_multiply_x(mini_x, self.prev_frames, self.next_frames)
                    mini_y = self.frame_multiply_y(mini_y, self.prev_frames, self.next_frames)

                    log_lik = self.f_train_ret_loss(mini_x, mini_y, learning_rate)

                    #log_lik = - self.f_train2(m, learning_rate)

                    if (m % m_minibatches) == 0:
                        print "iteration (%d)" % ni, "minibatch (%d)" % m, "log likelihood %.4f" % log_lik

        elif 'rprop' in method:
            gradients_all_mb = []

            print 'Minibatch size:', self.batch_size, '# minibatches:', n_minibatches, "# total data:", len(self.training_set_x)
            for ni in range(n_iters):
                for m in range(n_minibatches):
                    mini_x = self.training_set_x[m*self.batch_size:(m+1)*self.batch_size]
                    mini_y = self.training_set_y[m*self.batch_size:(m+1)*self.batch_size]

                    mini_x = self.frame_multiply_x(mini_x, self.prev_frames, self.next_frames)
                    mini_y = self.frame_multiply_y(mini_y, self.prev_frames, self.next_frames)

                    if (m % m_minibatches) == 0:
                        log_lik, acc, gradients = self.sgrad_minibatch(mini_x, mini_y, prediction = True)
                        print "iteration (%d)" % ni, "minibatch (%d)" % m, "log likelihood %.4f" % log_lik, "accuracy %.2f" % (acc*100.0)
                    else:
                        log_lik, acc, gradients = self.sgrad_minibatch(mini_x, mini_y, prediction = False)

                    gradients_all_mb.append(gradients)


            # compute the total gradients
            gradients = {}

            for mg in gradients_all_mb:
                for j, g in enumerate(mg):
                    if j in gradients:
                        gradients[j] += g
                    else:
                        gradients[j] = g

            gradients = [gradients[k] for k in sorted(gradients.keys())]

            # iRPROP- update of parameters.
            for p, g in zip(self.params, gradients):
                # gradient update
                p.set_value(p.get_value() + learning_rate * g)
        else:
            print "Unknown update method"
            return
dataset/ETHPy150Open UFAL-DSG/cloud-asr/cloudasr/worker/vad/tffnn.py/TheanoFFNN.train/operator `*` -> `%`